From 11a6cdc29d38e7cb1a439cbdba8a2dcca9097d21 Mon Sep 17 00:00:00 2001 From: David Stancu Date: Wed, 7 Dec 2022 11:35:40 -0500 Subject: [PATCH 1/2] simplify run trigger / no need to paginate --- databricks-kube/src/crds/databricks_job.rs | 48 +++------------------- 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/databricks-kube/src/crds/databricks_job.rs b/databricks-kube/src/crds/databricks_job.rs index cf4a4e0..3e638e1 100644 --- a/databricks-kube/src/crds/databricks_job.rs +++ b/databricks-kube/src/crds/databricks_job.rs @@ -230,38 +230,10 @@ impl RemoteAPIResource for DatabricksJob { return async { Ok(()) }.boxed(); } - log::info!( - "{} has a run request defined, looking for running jobs...", - self.name_unchecked() - ); + log::info!("Ensuring defined run for {}...", self.name_unchecked()); async move { - let mut all_runs: Vec = Vec::new(); - let config = Job::get_rest_config(context.clone()).await.unwrap(); - while let JobsRunsList200Response { has_more, runs } = default_api::jobs_runs_list( - &config, - Some(true), - Some(false), - job_id, - Some(all_runs.len() as i32), - None, - None, - None, - None, - None, - ) - .await? - { - all_runs.extend(runs.iter().flatten().map(Clone::clone)); - if !has_more.unwrap_or(false) { - break; - } - } - - log::info!("{} has {} active runs", &self_name, all_runs.len()); - - let newest_run_id = all_runs.first().map(|r| r.run_id).unwrap_or(Some(-1)); let mut run_request = JobsRunNowRequest { job_id, @@ -271,19 +243,11 @@ impl RemoteAPIResource for DatabricksJob { let triggered = default_api::jobs_run_now(&config, Some(run_request)).await?; - if newest_run_id.unwrap() == triggered.run_id.unwrap() { - log::info!( - "{} idempotency token matches; run_id still {}", - &self_name, - newest_run_id.unwrap() - ); - } else { - log::info!( - "{} triggered new run_id: {}", - &self_name, - triggered.run_id.unwrap(), - ); - } + log::info!( + "Job {} reconciled run {}", + &self_name, + triggered.run_id.unwrap(), + ); Ok::<(), DatabricksKubeError>(()) } From d0c04cd61110bcbb8e61c029c11108586c832dff Mon Sep 17 00:00:00 2001 From: David Stancu Date: Wed, 7 Dec 2022 11:36:50 -0500 Subject: [PATCH 2/2] bump versions --- Cargo.lock | 2 +- charts/databricks-kube-operator/Chart.yaml | 2 +- charts/databricks-kube-operator/templates/sts.yaml | 2 +- databricks-kube/Cargo.toml | 2 +- tutorial.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 544c585..f71c3ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -345,7 +345,7 @@ dependencies = [ [[package]] name = "databricks_kube" -version = "0.3.0" +version = "0.3.1" dependencies = [ "assert-json-diff", "async-stream", diff --git a/charts/databricks-kube-operator/Chart.yaml b/charts/databricks-kube-operator/Chart.yaml index ef4410f..f6d4026 100644 --- a/charts/databricks-kube-operator/Chart.yaml +++ b/charts/databricks-kube-operator/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.3.0 +version: 0.3.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/databricks-kube-operator/templates/sts.yaml b/charts/databricks-kube-operator/templates/sts.yaml index 76086e3..b3c0f9c 100644 --- a/charts/databricks-kube-operator/templates/sts.yaml +++ b/charts/databricks-kube-operator/templates/sts.yaml @@ -18,7 +18,7 @@ spec: terminationGracePeriodSeconds: 10 containers: - name: dko - image: ghcr.io/mach-kernel/databricks-kube-operator:0.3.0 + image: ghcr.io/mach-kernel/databricks-kube-operator:0.3.1 imagePullPolicy: Always env: - name: DATABRICKS_KUBE_CONFIGMAP diff --git a/databricks-kube/Cargo.toml b/databricks-kube/Cargo.toml index 211d2ec..0043a1e 100644 --- a/databricks-kube/Cargo.toml +++ b/databricks-kube/Cargo.toml @@ -5,7 +5,7 @@ path = "src/crdgen.rs" [package] name = "databricks_kube" default-run = "databricks_kube" -version = "0.3.0" +version = "0.3.1" edition = "2021" [dependencies] diff --git a/tutorial.md b/tutorial.md index 59c3f9d..3cbf3ef 100644 --- a/tutorial.md +++ b/tutorial.md @@ -36,7 +36,7 @@ In `Chart.yaml`, add a dependency to the operator chart: dependencies: - name: databricks-kube-operator repository: https://mach-kernel.github.io/databricks-kube-operator - version: 0.2.0 + version: 0.3.1 ``` ## Populating Databricks resources