Skip to content

Conversation

@o-nikolas
Copy link
Contributor

This PR moves another AWS example dag to a system test implementation. This example also includes a new test context builder class which produces a TaskFlow task that computes, fetches and stores test config at runtime instead of module load time, since doing novel work (including network requests) at module load time causes a couple specific issues for these tests and is generally bad practice for dags to be doing such work on dag parse/load time.

Related: #22438


^ 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 a newsfragement file, named {pr_number}.significant.rst, in newsfragments.

@o-nikolas
Copy link
Contributor Author

@potiuk and @bhirsz do you have some spare cycles to look at this one?

Comment on lines 140 to 145
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since fetch_variable defaults default_value to None, we can just do this:

Suggested change
if variable in self.variable_defaults:
value = fetch_variable(
variable, self.variable_defaults[variable], test_name=self.test_name
)
else:
value = fetch_variable(variable, test_name=self.test_name)
default_value = self.variable_defaults.get(variable, None)
value = fetch_variable(variable, default_value, test_name=self.test_name)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was written in such a way that any default could be provided, even None (since the user may want literally None to be the default value), but you're right that the fetch_variable code wasn't written with that philosophy so we can go with your suggestion for now until someone requires otherwise.

@bhirsz
Copy link
Contributor

bhirsz commented Jun 29, 2022

Looks nice! So the TaskFlow is used to manage system test configuration. What will happen if TaskFlow itself fails, will it be clear to users that it failed in setup phase rather than in system tests (of any other service)?

@o-nikolas
Copy link
Contributor Author

Looks nice! So the TaskFlow is used to manage system test configuration. What will happen if TaskFlow itself fails, will it be clear to users that it failed in setup phase rather than in system tests (of any other service)?

I'm not sure which TaskFlow failures you're imagining here specifically, but one should get an exception like you would from any other catastrophic failure and they should be able to tell from that where the issue occurred. I'm happy to place some more error handling somewhere specific if you have any suggestions!

o-nikolas added 2 commits July 4, 2022 18:57
This factory class builds a task that will generate the environment id
and fetch any variables at runtime and store them in xcom
Moved example_step_functions example dag AWS system test dir.
Convert to AIP-47 standard.
@o-nikolas o-nikolas force-pushed the onikolas/system-tests/step_functions branch from 611f17b to 6a838a6 Compare July 5, 2022 02:04
@o-nikolas
Copy link
Contributor Author

@bhirsz I made the updates you suggested, ready for another review :) (CC @potiuk)

@potiuk potiuk merged commit c1526a2 into apache:main Jul 7, 2022
syedahsn added a commit to syedahsn/airflow that referenced this pull request Aug 5, 2022
potiuk pushed a commit that referenced this pull request Aug 6, 2022
* System test for EMR Serverless following the template in #24643 (AIP-47)

* Remove example_emr_serverless.py from example_dags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants