GitHub user tomans-storygize edited a discussion: Guidance around nested 
operators: WARNING: execute cannot be called outside of the Task Runner

Apologies in advance if this is covered somewhere, I couldn't find any 
documentation around this.

Running 3.0.3

My use case is that I want to call the Kubernetes Operator with dynamic 
arguments based on the context. For example if I am running a backfill I would 
like to read the current interval from the context and pass them as arguments 
to my pod command. 

However, since I cannot access the context outside of a task - I cannot 
leverage the current context while defining off the shelf operators. 

I see this flag and deprecation warning `allow_nested_operators` 
https://github.com/apache/airflow/blob/4eb776ae19e90ca8aa2c3be890766ec880d925b4/task-sdk/src/airflow/sdk/bases/operator.py#L793-L808

My question is: what is the recommended way to implement 
`MyOperator(some_config=value_from_context) `

I see the code comment says something to the effect of: working code today will 
break in the future when the warning turns into an error. 

Any guidance appreciated,
Thanks!

GitHub link: https://github.com/apache/airflow/discussions/53515

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to