galak75 commented on issue #4743: [AIRFLOW-3871] render Operators template 
fields recursively
URL: https://github.com/apache/airflow/pull/4743#issuecomment-472589499
 
 
   @bjoernpollex-sc:
   Thank you for this constructive discussion. you are bringing very good 
points to this thread
   
   I totally agree with your statement below
   
   > Overall I feel like the potential for subtle bugs with an implicit 
mechanism is quite high
   
   I have another question though: coming back to the code example in the [JIRA 
description](https://issues.apache.org/jira/browse/AIRFLOW-3871):
   
   Let say that `MyAwesomeDataFileTransformer` is imported from an external 
module I cant not change. I guess I could dynamically add the `template_fields` 
class attribute before the task declaration? something like:
   ```
   MyAwesomeDataFileTransformer.template_fields=['input_file', 'output_file']
   
   simple_task = PythonOperator(
       task_id='simple_task',
       provide_context=True,
       python_callable=transform_data_file,
       templates_dict={
        'transformer': MyAwesomeDataFileTransformer(
               "/data/{{ dag.dag_id }}/{{ ts }}/input_file",
               "/data/{{ dag.dag_id }}/{{ ts }}/output_file",
           )
       },
       dag=dag
   )
   ```
   
   Would it work?
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to