vchiapaikeo opened a new pull request, #28692:
URL: https://github.com/apache/airflow/pull/28692

   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   closes: https://github.com/apache/airflow/issues/27952
   
   To test, I used the dag provided by @MaiHoangViet1809 in the above linked 
issue:
   
   ```py
   from airflow.decorators import dag, task
   from airflow.operators.python import get_current_context
   
   from airflow.sensors.external_task import ExternalTaskSensor
   from datetime import datetime
   
   configure = {
       "dag_id": "test_new_skeleton",
       "schedule": "@daily",
       "start_date": datetime(2022, 1, 1),
       "catchup": False,
   }
   
   
   @task
   def preprocess_dependency() -> list:
       return ["test_postgres_to_gcs"]
   
   
   @dag(**configure)
   def pipeline():
       t_preprocess = preprocess_dependency()
       task_dependency = ExternalTaskSensor(
           task_id=f"Check_Dependency",
           external_dag_id="test_postgres",
           external_task_ids=t_preprocess,
           poke_interval=60,
           mode="reschedule",
           timeout=172800,
           allowed_states=["success"],
           failed_states=["failed", "skipped"],
           check_existence=True,
       )
   
   
   dag = pipeline()
   ```
   
   Ran a dependent dag (test_potgres) and then ran this one:
   
   <img width="1440" alt="image" 
src="https://user-images.githubusercontent.com/9200263/210380143-e03ff967-28a7-4179-9f0e-64877eee4885.png";>
   
   Task logs:
   
   ```
   [2023-01-03, 14:45:43 UTC] {taskinstance.py:1093} INFO - Dependencies all 
met for <TaskInstance: test_new_skeleton.Check_Dependency 
scheduled__2023-01-02T00:00:00+00:00 [queued]>
   [2023-01-03, 14:45:43 UTC] {taskinstance.py:1093} INFO - Dependencies all 
met for <TaskInstance: test_new_skeleton.Check_Dependency 
scheduled__2023-01-02T00:00:00+00:00 [queued]>
   [2023-01-03, 14:45:43 UTC] {taskinstance.py:1295} INFO - 
   
--------------------------------------------------------------------------------
   [2023-01-03, 14:45:43 UTC] {taskinstance.py:1296} INFO - Starting attempt 1 
of 1
   [2023-01-03, 14:45:43 UTC] {taskinstance.py:1297} INFO - 
   
--------------------------------------------------------------------------------
   [2023-01-03, 14:45:43 UTC] {taskinstance.py:1316} INFO - Executing 
<Task(ExternalTaskSensor): Check_Dependency> on 2023-01-02 00:00:00+00:00
   [2023-01-03, 14:45:43 UTC] {standard_task_runner.py:55} INFO - Started 
process 400 to run task
   [2023-01-03, 14:45:43 UTC] {standard_task_runner.py:82} INFO - Running: 
['***', 'tasks', 'run', 'test_new_skeleton', 'Check_Dependency', 
'scheduled__2023-01-02T00:00:00+00:00', '--job-id', '7', '--raw', '--subdir', 
'DAGS_FOLDER/test_external_task_with_task_dec.py', '--cfg-path', 
'/tmp/tmp1wualdyq']
   [2023-01-03, 14:45:43 UTC] {standard_task_runner.py:83} INFO - Job 7: 
Subtask Check_Dependency
   [2023-01-03, 14:45:44 UTC] {task_command.py:391} INFO - Running 
<TaskInstance: test_new_skeleton.Check_Dependency 
scheduled__2023-01-02T00:00:00+00:00 [running]> on host d39b84574015
   [2023-01-03, 14:45:44 UTC] {taskinstance.py:1525} INFO - Exporting the 
following env vars:
   AIRFLOW_CTX_DAG_OWNER=***
   AIRFLOW_CTX_DAG_ID=test_new_skeleton
   AIRFLOW_CTX_TASK_ID=Check_Dependency
   AIRFLOW_CTX_EXECUTION_DATE=2023-01-02T00:00:00+00:00
   AIRFLOW_CTX_TRY_NUMBER=1
   AIRFLOW_CTX_DAG_RUN_ID=scheduled__2023-01-02T00:00:00+00:00
   [2023-01-03, 14:45:44 UTC] {external_task.py:209} INFO - Poking for tasks 
['test_postgres_to_gcs'] in dag test_postgres on 2023-01-02T00:00:00+00:00 ... 
   [2023-01-03, 14:45:44 UTC] {dagbag.py:538} INFO - Filling up the DagBag from 
/files/dags/test_postgres.py
   [2023-01-03, 14:45:45 UTC] {logging_mixin.py:137} WARNING - 
/opt/***/***/models/dagbag.py:339 RemovedInAirflow3Warning: The 'concurrency' 
parameter is deprecated. Please use 'max_active_tasks'.
   [2023-01-03, 14:45:45 UTC] {logging_mixin.py:137} WARNING - 
/opt/***/***/models/dagbag.py:339 RemovedInAirflow3Warning: Param 
`schedule_interval` is deprecated and will be removed in a future release. 
Please use `schedule` instead.
   [2023-01-03, 14:45:45 UTC] {base.py:228} INFO - Success criteria met. 
Exiting.
   [2023-01-03, 14:45:45 UTC] {taskinstance.py:1339} INFO - Marking task as 
SUCCESS. dag_id=test_new_skeleton, task_id=Check_Dependency, 
execution_date=20230102T000000, start_date=20230103T144543, 
end_date=20230103T144545
   [2023-01-03, 14:45:45 UTC] {local_task_job.py:211} INFO - Task exited with 
return code 0
   [2023-01-03, 14:45:45 UTC] {taskinstance.py:2613} INFO - 0 downstream tasks 
scheduled from follow-on schedule check
   ```
   
   cc @uranusjr 
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a 
newsfragment file, named `{pr_number}.significant.rst` or 
`{issue_number}.significant.rst`, in 
[newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to