Improve KubeRayCluster cleanup#149
Conversation
Ensure that KubeRayCluster resources properly delete running ray clusters in case a dagster job fails with a `BaseException` type.
|
Very cool, thanks for the PR! I've noticed this issue as well but never figured out the root case. I've modified your commit message to link this issue :)
Just for debugging purposes, typically if a Run fails it's beneficial to be able to connect to the cluster. I typically have an automated cleanup schedule (see But I agree that this behavior is neither intuitive nor always desired. I'm open to introducing another option to configure it separately. |
Ah, makes sense. I'll use these schedules than.
|
Thanks for creating this amazing package! It's been super useful for running some of our ray workloads via dagster.
Summary:
Ensure that KubeRayCluster resources properly delete running ray clusters in case a dagster job fails with a
BaseExceptiontype.Issue:
I noticed that when a ray cluster has not started yet (e.g. because it is waiting for resources in a k8s cluster) and the dagster run that created it is terminated via UI, the ray cluster is not terminated. Resolve #96
Steps to reproduce:
yield_for_executiondoes not complete yet.DagsterExecutionInterruptedError, that inherits directly fromBaseException.Proposed Change:
Catch
BaseExceptioninstead ofExceptioninside ofyield_for_execution, because some of the dagster error types like e.g.DagsterExecutionInterruptedErrorinherit directly fromBaseExceptionand were therefore not caught before this change.Verification:
I tested this in my dagster deployment. It's not clear to me how to write a unit test for it.
Open questions:
I saw that
_maybe_cleanup_rayclusteronly runs the cleanup if the dagster status is!= DagsterRunStatus.FAILURE. Why is that? Shouldn't the cluster be cleaned up in all cases, unlessskip_cleanup=True?