potiuk commented on issue #35529:
URL: https://github.com/apache/airflow/issues/35529#issuecomment-1928014249

   Maybe there is an easier solution: you already have the source of the 
callable:
   
   ```
   {{ python_callable_source }}
   ```
   and name 
   
   ```
   {{ python_callable }}(
   ```
   
   and assuming you pass "unique_module_name" starting with 
`unusual_prefix_...` you can do this:
   
   ```
   {{ python_callable_source }}
   
   import types
   {{ unique_module_name }}  = types.ModuleType("{{ unique_module_name}}")
   
   {{ unique_module_name }}.python_callable = python_callable
   ```
   
   All that before op_args/kwargs loading from dill. That should do the trick:
   
   * first you define the callable in current module
   * then you create an empty "unique" module
   * then you add the callable that you created locally to be present in the 
uniquely named module you just created
   
   There is no need to copy the sources to a separate file - it would also be 
harmful, as we **really** need the callable only - not all the DAG or other 
methods defined in there.
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to