From 58c3123ea8026a5b8411a066cc8fa615de79bf4f Mon Sep 17 00:00:00 2001 From: danielgafni Date: Fri, 10 Oct 2025 14:52:13 +0300 Subject: [PATCH] :wrench: reduce default ttl values --- .github/workflows/CI.yml | 2 +- docs/api/kuberay.md | 2 +- src/dagster_ray/configs.py | 2 +- src/dagster_ray/kuberay/configs.py | 2 +- src/dagster_ray/kuberay/sensors.py | 2 +- tests/kuberay/test_raycluster.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a753f80..21ad105 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -39,7 +39,7 @@ jobs: - .github/workflows/CI.yml - 'src/dagster_ray/**' - 'tests/**' - - 'examples/**' + - 'examples/**/*.py' - pyproject.toml - uv.lock - .pre-commit-config.yaml diff --git a/docs/api/kuberay.md b/docs/api/kuberay.md index 6dbd8ae..44b0a63 100644 --- a/docs/api/kuberay.md +++ b/docs/api/kuberay.md @@ -132,7 +132,7 @@ These resources initialize Ray client connection with a remote cluster. A Dagster sensor that monitors shared `RayCluster` resources created by the current Dagster [code location](https://docs.dagster.io/deployment/code-locations/managing-code-locations-with-definitions) (with a `dagster/code-location=` label selector) and submits jobs to delete clusters either: - use [Cluster Sharing](../tutorial/kuberay.md#cluster-sharing) (`dagster/cluster-sharing=true`) and have expired -- are older than `DAGSTER_RAY_CLUSTER_EXPIRATION_SECONDS` (defaults to 24 hours) +- are older than `DAGSTER_RAY_CLUSTER_EXPIRATION_SECONDS` (defaults to 4 hours) By default it monitors the `ray` namespace. This can be configured by setting `DAGSTER_RAY_NAMESPACES` (accepts a comma-separated list of namespaces). diff --git a/src/dagster_ray/configs.py b/src/dagster_ray/configs.py index c5c7b6b..a1366a6 100644 --- a/src/dagster_ray/configs.py +++ b/src/dagster_ray/configs.py @@ -10,7 +10,7 @@ DAGSTER_RAY_NAMESPACES_ENV_VAR = "DAGSTER_RAY_NAMESPACES" DAGSTER_RAY_NAMESPACES_DEFAULT_VALUE = "ray" DAGSTER_RAY_CLUSTER_EXPIRATION_SECONDS_ENV_VAR = "DAGSTER_RAY_CLUSTER_EXPIRATION_SECONDS" -DAGSTER_RAY_CLUSTER_EXPIRATION_SECONDS_DEFAULT_VALUE = str(24 * 60 * 60) +DAGSTER_RAY_CLUSTER_EXPIRATION_SECONDS_DEFAULT_VALUE = str(4 * 60 * 60) class Lifecycle(dg.Config): diff --git a/src/dagster_ray/kuberay/configs.py b/src/dagster_ray/kuberay/configs.py index 6d59f63..1486644 100644 --- a/src/dagster_ray/kuberay/configs.py +++ b/src/dagster_ray/kuberay/configs.py @@ -309,7 +309,7 @@ class MatchDagsterLabels(dg.Config): ) -DEFAULT_CLUSTER_SHARING_TTL_SECONDS = 60 * 60.0 +DEFAULT_CLUSTER_SHARING_TTL_SECONDS = 30 * 60.0 class ClusterSharing(dg.Config): diff --git a/src/dagster_ray/kuberay/sensors.py b/src/dagster_ray/kuberay/sensors.py index 139ac4f..b32b2e6 100644 --- a/src/dagster_ray/kuberay/sensors.py +++ b/src/dagster_ray/kuberay/sensors.py @@ -23,7 +23,7 @@ def cleanup_expired_kuberay_clusters( ) -> Generator[dg.RunRequest | dg.SkipReason, None, None]: f"""A Dagster sensor that monitors shared `RayCluster` resources created by the current code location and submits jobs to delete clusters that either: - use [Cluster Sharing](../tutorial/#cluster-sharing) (`dagster/cluster-sharing=true`) and have expired - - are older than `DAGSTER_RAY_CLUSTER_EXPIRATION_SECONDS` (defaults to 24 hours) + - are older than `DAGSTER_RAY_CLUSTER_EXPIRATION_SECONDS` (defaults to 4 hours) By default it monitors the `ray` namespace. This can be configured by setting `{DAGSTER_RAY_NAMESPACES_ENV_VAR}` (accepts a comma-separated list of namespaces).""" assert context.code_location_origin is not None diff --git a/tests/kuberay/test_raycluster.py b/tests/kuberay/test_raycluster.py index ccda169..e5ef593 100644 --- a/tests/kuberay/test_raycluster.py +++ b/tests/kuberay/test_raycluster.py @@ -456,7 +456,7 @@ def my_asset(context: dg.AssetExecutionContext, ray_cluster: RayResource): ): assert isinstance(item, dg.RunRequest) assert ( - item.run_config["ops"]["delete_kuberay_clusters"]["config"]["clusters"][0]["name"] + item.run_config["ops"]["delete_kuberay_clusters_op"]["config"]["clusters"][0]["name"] == cluster["metadata"]["name"] )