Skip to content

Bugfix: Better exception handling and cluster clean up#68

Merged
venkatajagannath merged 5 commits into
mainfrom
on_failure_callback
Sep 25, 2024
Merged

Bugfix: Better exception handling and cluster clean up#68
venkatajagannath merged 5 commits into
mainfrom
on_failure_callback

Conversation

@venkatajagannath
Copy link
Copy Markdown
Contributor

@venkatajagannath venkatajagannath commented Sep 19, 2024

This PR fixes a bug for cleaning up cluster resources when they are no longer required.

We make 2 changes --

  1. SubmitRayJob -- Add better exception handling to ensure cluster is deleted if there is an exception in the execute() method
  2. RayJobTrigger -- Added cleanup methods to ensure that even if there is an exception when the trigger is running, the cluster clean up still happens. This was not the case earlier

Also added additional unit tests for both operator & trigger to ensure high code coverage.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 97.29730% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.44%. Comparing base (48b9785) to head (27a2020).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ray_provider/operators/ray.py 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
+ Coverage   95.42%   96.44%   +1.02%     
==========================================
  Files           5        5              
  Lines         546      563      +17     
==========================================
+ Hits          521      543      +22     
+ Misses         25       20       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@venkatajagannath venkatajagannath marked this pull request as draft September 20, 2024 00:43
@venkatajagannath venkatajagannath marked this pull request as ready for review September 21, 2024 20:15
Comment thread ray_provider/operators/ray.py Outdated
Comment thread ray_provider/operators/ray.py Outdated
@venkatajagannath venkatajagannath changed the title Bugfix: Setting up on_failure_callback Bugfix: Better exception handling and cluster clean up Sep 24, 2024
Comment thread ray_provider/triggers/ray.py
pankajastro
pankajastro previously approved these changes Sep 25, 2024
@venkatajagannath venkatajagannath merged commit b7dc197 into main Sep 25, 2024
@venkatajagannath venkatajagannath deleted the on_failure_callback branch September 25, 2024 09:03
@tatiana tatiana added this to the Astro Ray Provider 0.3.0 milestone Nov 29, 2024
@tatiana tatiana mentioned this pull request Nov 29, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add on_failure_callback to the SubmitRayJob operator

4 participants