Stdout of function is empty

Hi,
we have a function where we use a logger = logging.getLogger() for logging. When we execute the function directly in ONE DATA via Save,Deploy&Run I get a result, where I get all my logger.info() messages in the stdout key of the response-json.

However when we trigger the function from within a python processor via SDK with

result: FunctionExecutionResult = onedata_api.functions.execute(id=function_id, arguments=function_arguments)

the result.stdout is an empty string.

What could be the issue here?
Thanks!

Hey,

did you also set

handler = logging.StreamHandler(sys.stdout)
logger.addHandler(handler)

so that your logger streams the output to the stdout?

Alternatively, you can also use

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

Hi,
since execution of the same function directly in ONE DATA by clicking a button, this is this case.
We are not setting it directly, but the settings are loaded from the environment in our case.

The only difference is how we execute the function: Execution via the button in ONE DATA works fine, only by execution via SDK the issue appears. I hope the configured environment is also correctly used when executed via SDK?

Interesting, sorry to miss-understood the situation.

I will have to ask around the team about this, but it seems to me that the SDK just does not use the correct output key there as there is no difference on the server-side in terms of who calls the function.

1 Like