You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/07/22 22:47:35 UTC

[GitHub] [airflow] orossini opened a new pull request #17182: dataflowjobstatus sensor dag example fixed for issue #17180

orossini opened a new pull request #17182:
URL: https://github.com/apache/airflow/pull/17182


   <!--
   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 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/
   -->
   
   
   ---
   **^ Add meaningful description above**
   
   closes issue #17180
   
   Update to the DAG examples for DataflowJobStatusSensor to avoid error.
   The current example pulls XCOM to get Dataflow job id from XCOM attributes.
   However an incorrect attribute name is used in the current DAG example.
   
   the XCOM doesn't have any attribute named "job_id" when using :
   job_id="{{task_instance.xcom_pull('start-python-job-async')['job_id']}}",
   instead "id" has to be used to get the related Dataflow job id.
   
   
   


-- 
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-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] orossini closed pull request #17182: dataflowjobstatus sensor dag example fixed for issue #17180

Posted by GitBox <gi...@apache.org>.
orossini closed pull request #17182:
URL: https://github.com/apache/airflow/pull/17182


   


-- 
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-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] boring-cyborg[bot] commented on pull request #17182: dataflowjobstatus sensor dag example fixed for issue #17180

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #17182:
URL: https://github.com/apache/airflow/pull/17182#issuecomment-885284203


   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (flake8, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, itโ€™s a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better ๐Ÿš€.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
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-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] orossini commented on a change in pull request #17182: dataflowjobstatus sensor dag example fixed for issue #17180

Posted by GitBox <gi...@apache.org>.
orossini commented on a change in pull request #17182:
URL: https://github.com/apache/airflow/pull/17182#discussion_r677026322



##########
File path: airflow/providers/google/cloud/example_dags/example_dataflow.py
##########
@@ -166,7 +166,7 @@
     # [START howto_sensor_wait_for_job_status]
     wait_for_python_job_async_done = DataflowJobStatusSensor(
         task_id="wait-for-python-job-async-done",
-        job_id="{{task_instance.xcom_pull('start-python-job-async')['job_id']}}",
+        job_id="{{task_instance.xcom_pull('start-python-job-async')['id']}}",

Review comment:
       You're right. However there is an issue for DataflowTemplatedJobStartOperator. The XCom doesn't have any job_id attribute.
   To solve this, the operators/dataflow.py can be updated for DataflowTemplatedJobStartOperator (as well as flextemplateJob and sqlJob operators): return job_id instead of job.
   
   




-- 
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-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] mik-laj commented on a change in pull request #17182: dataflowjobstatus sensor dag example fixed for issue #17180

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #17182:
URL: https://github.com/apache/airflow/pull/17182#discussion_r675212656



##########
File path: airflow/providers/google/cloud/example_dags/example_dataflow.py
##########
@@ -166,7 +166,7 @@
     # [START howto_sensor_wait_for_job_status]
     wait_for_python_job_async_done = DataflowJobStatusSensor(
         task_id="wait-for-python-job-async-done",
-        job_id="{{task_instance.xcom_pull('start-python-job-async')['job_id']}}",
+        job_id="{{task_instance.xcom_pull('start-python-job-async')['id']}}",

Review comment:
       Are you sure? Please look at https://github.com/apache/airflow/blob/82de4a87b2a36e88e0b5803ed85e17d30719819a/airflow/providers/google/cloud/operators/dataflow.py#L1150
   Did I miss something?




-- 
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-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] orossini closed pull request #17182: dataflowjobstatus sensor dag example fixed for issue #17180

Posted by GitBox <gi...@apache.org>.
orossini closed pull request #17182:
URL: https://github.com/apache/airflow/pull/17182


   


-- 
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-unsubscribe@airflow.apache.org

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