Skip to content

Updating Amazon-AWS example DAGs to use XComArgs#16868

Merged
potiuk merged 2 commits into
apache:mainfrom
josh-fell:xcomarg-update-example-dags-amazon
Jul 26, 2021
Merged

Updating Amazon-AWS example DAGs to use XComArgs#16868
potiuk merged 2 commits into
apache:mainfrom
josh-fell:xcomarg-update-example-dags-amazon

Conversation

@josh-fell

@josh-fell josh-fell commented Jul 8, 2021

Copy link
Copy Markdown
Contributor

Related to #10285

  • Updated example DAG files such that xcom_pull() calls use an operator's .output property as well access of TaskInstance objects from context to use get_current_context() function
  • Added comments to which task dependencies, if any, are handled and/or created via XComArgs for transparency
  • Removed or refactored the default_args pattern where necessary as requested by @ashb (i.e. removed a separated default_args declaration for deference for declaration as part of the DAG object)

Note: There are several instances where the xcom_pull() call was not updated. These instances involve accessing a specific value within the XCom or calling user-defined macros with an XCom value. Reference #16618 for an open issue to enhance the XComArg functionality to provide similar behavior as the classic xcom_pull() method.

Note: Not all DAGs were tested functionally (i.e. with hard integrations to source systems and executed), however each DAG was tested to compile and generate a DAG graph as expected locally.

An detailed summary of all changes made as part of this PR can be found below:

DAG File Converted xcom_pull()? Other Updates? Comments
airflow/providers/amazon/aws/example_dags/example_dms_full_load_task.py Yes Yes Removed explicit task dependencies that are created via XComArgs.

Refactored default_args pattern.
airflow/providers/amazon/aws/example_dags/example_dms_full_load_task.py No Yes Refactored default_args pattern.
airflow/providers/amazon/aws/example_dags/example_emr_job_flow_automatic_steps.py Yes Yes Removed explicit task dependencies that are created via XComArgs.

Refactored default_args pattern.
airflow/providers/amazon/aws/example_dags/example_emr_job_flow_manual_steps.py Yes ** Yes ** Current XComArg object does not support accessing specific values of an iterable XCom value elegantly. Did not update this occurrence:
"{{ task_instance.xcom_pull(task_ids='add_steps', key='return_value')[0] }}".

All other xcom_pull() calls have been updated.

Removed explicit task dependencies that are created via XComArgs.

Refactored default_args pattern.
airflow/providers/amazon/aws/example_dags/example_glacier_to_gcs.py No No Current XComArg object does not support accessing specific values of an iterable XCom value. Could not update any occurrences in this DAG.
airflow/providers/amazon/aws/example_dags/example_google_api_to_s3_transfer_advanced.py Yes Yes Removed explicit task dependencies that are created via XComArgs.

Updated to use get_current_context().

^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@boring-cyborg boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues labels Jul 8, 2021
@josh-fell
josh-fell force-pushed the xcomarg-update-example-dags-amazon branch from 4ac5efd to a46b530 Compare July 21, 2021 17:42
@josh-fell
josh-fell force-pushed the xcomarg-update-example-dags-amazon branch from cb374b5 to 79cbf56 Compare July 26, 2021 14:11
@potiuk
potiuk merged commit 569659d into apache:main Jul 26, 2021
@github-actions

Copy link
Copy Markdown
Contributor

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions Bot added the okay to merge It's ok to merge this PR as it does not require more tests label Jul 26, 2021
@josh-fell
josh-fell deleted the xcomarg-update-example-dags-amazon branch July 26, 2021 19:45
nathadfield pushed a commit to king/airflow that referenced this pull request Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers okay to merge It's ok to merge this PR as it does not require more tests provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants