-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new community provider: Flyte #22643
Conversation
Signed-off-by: Samhita Alla <[email protected]>
Signed-off-by: Samhita Alla <[email protected]>
Signed-off-by: Samhita Alla <[email protected]>
Signed-off-by: Samhita Alla <[email protected]>
Add new community provider: Flyte
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)
|
task_id = re.sub(r"[\W_]+", "", context["task"].task_id)[:5] | ||
self.execution_name = task_id + re.sub( | ||
r"[\W_]+", | ||
"", | ||
context["dag_run"].run_id.split("__")[-1].lower(), | ||
)[: (20 - len(task_id))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm currently generating a deterministic-and-unique execution name that is to be used to name a Flyte execution. It's a combination of the task_id
and run_id
. I'm using both because with task_id
, I wouldn't be able to create unique task names whenever a task runs more than once, and with run_id
I wouldn't be able to create unique task names within the same DAG cause run_id
remains the same for all tasks; hence came up with this logic.
The execution name cannot exceed 20 characters (a restriction imposed by Flyte), and hence, I'm trimming the two strings. Please let me know if there's a better way to create unique execution names, even with the task being repeated multiple times within the same DAG (with different task_id
s, of course), or run multiple times.
Signed-off-by: Samhita Alla [email protected]
This PR adds a new community provider to allow Airflow users to interact with Flyte from within Airflow.
A bit about Flyte: Flyte is an open-source, container-native, structured programming and distributed processing platform that enables highly concurrent, scalable, and maintainable workflows for machine learning and data processing pipelines.
As a more significant chunk of the users who are into pipelines are using Airflow, it'd be really helpful to have a provider that bridges the gap between Airflow and Flyte, to help the Airflow users retain their existing pipelines and use Flyte from within the Airflow DAGs to run the machine learning jobs (say).
We've had this operator in the back of our minds for a long time; here's the issue.
Code Interface
The provider defines a
hook
, anoperator
, and asensor
. When the user instantiates theAirflowFlyteOperator
, it creates aFlyteRemote
(Flyte's Python API) object, triggers the execution in the Flyte environment, waits for the execution to complete, and finally, returns the execution name. This implementation is carried out using the methods defined in thehook
. The executions are triggered synchronously by default. One can setasynchronous
toTrue
if the execution needs to be polled asynchronously; the polling would be handled by thesensor
.Tests
Unit tests have been added and tested. Also, I spun up an Airflow instance to validate the code in real-time.
TODO
0.32.0b0
to0.32.0
after the latter release is out.^ 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.