Support using callable config in @ray.task#103
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #103 +/- ##
==========================================
+ Coverage 97.63% 98.52% +0.88%
==========================================
Files 7 7
Lines 593 610 +17
==========================================
+ Hits 579 601 +22
+ Misses 14 9 -5 ☔ View full report in Codecov by Sentry. |
pankajastro
approved these changes
Nov 29, 2024
This was referenced Nov 29, 2024
Merged
tatiana
commented
Nov 29, 2024
| return re.sub(r"[^\w\-\.]", "-", value).lower() | ||
|
|
||
|
|
||
| def create_config_from_context(context, **kwargs): |
Collaborator
Author
There was a problem hiding this comment.
The main drawback of this approach is that we are creating the YAML file dynamically and not deleting it. Ideally, we'd only materialise the YAML file during the cluster setup/tear down, and delete as part of the task execution.
tatiana
added a commit
that referenced
this pull request
Nov 29, 2024
**Breaking changes** * Removal of ``SubmitRayJob.terminal_states``. The same values are now available at ``ray_provider.constants.TERMINAL_JOB_STATUSES``. * Simplify the project structure and debugging by @tatiana in #93 In order to improve the development and troubleshooting DAGs created with this provider, we introduced breaking changes to the folder structure. It was flattened and the import paths to existing decorators, hooks, operators and trigger changed, as documented in the table below: | Type | Previous import path | Current import path | |-----------|---------------------------------------------|-----------------------------------------| | Decorator | ray_provider.decorators.ray.ray | ray_provider.decorators.ray | | Hook | ray_provider.hooks.ray.RayHook | ray_provider.hooks.RayHook | | Operator | ray_provider.operators.ray.DeleteRayCluster | ray_provider.operators.DeleteRayCluster | | Operator | ray_provider.operators.ray.SetupRayCluster | ray_provider.operators.SetupRayCluster | | Operator | ray_provider.operators.ray.SubmitRayJob | ray_provider.operators.SubmitRayJob | | Trigger | ray_provider.triggers.ray.RayJobTrigger | ray_provider.triggers.RayJobTrigger | **Features** * Support using callable ``config`` in ``@ray.task`` by @tatiana in #103 * Support running Ray jobs indefinitely without timing out by @venkatajagannath and @tatiana in #74 **Bug fixes** * Fix integration test and bug in load balancer wait logic by @pankajastro in #85 * Bugfix: Better exception handling and cluster clean up by @venkatajagannath in #68 * Stop catching generic ``Exception`` in operators by @tatiana in #100 * Stop catching generic ``Exception`` in trigger by @tatiana in #99 **Docs** * Add docs to deploy project on Astro Cloud by @pankajastro in #90 * Fix dead reference in docs index page by @pankajastro in #87 * Cloud Auth documentation update by @venkatajagannath in #58 * Improve main docs page by @TJaniF in #71 **Others** Local development * Fix the local development environment and update documentation by @tatiana in #92 * Enable secret detection precommit check by @pankajastro in #91 * Add astro cli project + kind Raycluster setup instruction by @pankajastro in #83 * Remove pytest durations from tests by @tatiana in #102 * Fix running make docker-run when there is a new version by @tatiana in #99 and #101 * Improve Astro CLI DAGs test so running hatch test-cov locally doesn't fail by @tatiana in #97 CI * CI improvement by @venkatajagannath in #73 * CI fix related to broken coverage upload artifact by @pankajkoti in #60 * Allow tests to run for PRs from forked repos by @venkatajagannath in #72 * Update CODEOWNERS by @tatiana in #84 * Add Airflow 2.10 (released in August 2024) to tests by @tatiana in #96
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Ray provider 0.2.1 allowed users to define a hard-coded configuration to materialize the Kubernetes cluster. This PR aims to enable users to define a function that can receive the Airflow context and generate the configuration dynamically using context properties. This request came from an Astronomer customer.
There is an example DAG file illustrating how to use this feature. It has a parent DAG that triggers two child DAGs, which leverage the just introduced
@ray.taskcallable configuration.Closes #81
How to test
The screenshots below show their success using the local development instructions with Astro CLI.
Parent DAG, manually trigerred:

Child 1 DAG, triggered by parent DAG:

Example of logs that illustrate the RayCluster using dynamic configuration was created and used in Kubernetes, with its own IP address:
Child 2 DAG, also triggered by the parent DAG:

Kubernetes RayClusters spun:

Limitations
The example DAGs are not currently being executed in the CI, but there is a dedicated ticket for this work:
#95
References
This PR had inspiration from:
#67
Several other actions that were done as part of this work, but they were split into other PRs aiming to simplify the review process:
Exceptionin triggerer #98make docker-runwhen there is a new version #99Exceptionin operators #100Makefile#101configin@ray.task#103