#Force evaluation when returning a custom type from module (Python SDK)

1 messages · Page 1 of 1 (latest)

deft otter
#

Hello 👋

I'm implementing a custom module to be used across my pipelines. One of the functions of this module returns a custom Result object. e.g. dag.my_module().execute() --> Result

In my pipeline, I would like to force evaluation when execute() is called. Or have some kind of workaround similar to Container.sync() where you can force evaluation and then grab the results.

# Desired outcome
result = await dag.python().with_lint().execute()
env = await dag.python().with_lint().execute()
result = env.result()

The only option I have found so far is to break calls into retrieving lazy evaluated results and then call some function on that object that returns a scalar type (in order to force evaluation).

Is there a better way?

deft otter
#

I see that when returning list[Result] it does produce coroutine that can be awaited. What are the supported types that produce such behaviour? scalar and compund types?