[GitHub] [airflow] houqp commented on a change in pull request #9631: Add function to get current context

2020-07-14 Thread GitBox


houqp commented on a change in pull request #9631:
URL: https://github.com/apache/airflow/pull/9631#discussion_r454433163



##
File path: airflow/models/taskinstance.py
##
@@ -1132,7 +1133,8 @@ def signal_handler(signum, frame):  # pylint: 
disable=unused-argument
 self._run_execute_callback(context, task)
 
 # Execute the task
-result = self._execute_task(context, task_copy)
+with set_current_context(context):

Review comment:
   If we can move the logic into functional dag module, that would be 
definitely more explicit and easier to maintain going forward.





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:
us...@infra.apache.org




[GitHub] [airflow] houqp commented on a change in pull request #9631: Add function to get current context

2020-07-11 Thread GitBox


houqp commented on a change in pull request #9631:
URL: https://github.com/apache/airflow/pull/9631#discussion_r453231930



##
File path: airflow/models/taskinstance.py
##
@@ -1132,7 +1133,8 @@ def signal_handler(signum, frame):  # pylint: 
disable=unused-argument
 self._run_execute_callback(context, task)
 
 # Execute the task
-result = self._execute_task(context, task_copy)
+with set_current_context(context):

Review comment:
   Sounds good, just wanted to make sure this expected behavior. Probably 
worth documenting since the method name itself doesn't convey the message that 
it should only be used within functional dags.





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:
us...@infra.apache.org




[GitHub] [airflow] houqp commented on a change in pull request #9631: Add function to get current context

2020-07-10 Thread GitBox


houqp commented on a change in pull request #9631:
URL: https://github.com/apache/airflow/pull/9631#discussion_r452967324



##
File path: airflow/models/taskinstance.py
##
@@ -1132,7 +1133,8 @@ def signal_handler(signum, frame):  # pylint: 
disable=unused-argument
 self._run_execute_callback(context, task)
 
 # Execute the task
-result = self._execute_task(context, task_copy)
+with set_current_context(context):

Review comment:
   I am curious what's the contract for `get_current_context` here. For any 
function/method that takes context argument during task execution, should they 
expect the passed in context to be the same as what gets returned from 
`get_current_context`?
   
   Asking this because post_execute callback is not wrapped in the same context 
that _execute_task is in.





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:
us...@infra.apache.org