From b2d9f7d717ba5c05fe5dd1605e0bdee28db4ec97 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 2 May 2024 09:39:40 +0200 Subject: [PATCH] add cloud compile flag --- .github/workflows/docker-image.yml | 4 ++-- backend/Cargo.toml | 1 + backend/windmill-queue/Cargo.toml | 1 + backend/windmill-queue/src/jobs.rs | 4 ++-- backend/windmill-worker/src/common.rs | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 1637dc05fd..9ca4995606 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -136,7 +136,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true build-args: | - features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect + features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee:dev ${{ steps.meta-ee-public.outputs.tags }} @@ -199,7 +199,7 @@ jobs: platforms: linux/amd64 push: true build-args: | - features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect + features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud PYTHON_IMAGE=python:3.12.2-slim-bookworm tags: | ${{ steps.meta-ee-public-py312.outputs.tags }} diff --git a/backend/Cargo.toml b/backend/Cargo.toml index da8f83070b..71e402f259 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -50,6 +50,7 @@ parquet = ["windmill-api/parquet", "windmill-common/parquet", "windmill-worker/p prometheus = ["windmill-common/prometheus", "windmill-api/prometheus", "windmill-worker/prometheus", "windmill-queue/prometheus"] flow_testing = ["windmill-worker/flow_testing"] openidconnect = ["windmill-api/openidconnect"] +cloud = ["windmill-queue/cloud"] [dependencies] anyhow.workspace = true diff --git a/backend/windmill-queue/Cargo.toml b/backend/windmill-queue/Cargo.toml index a637d3756a..ae89cb7c6c 100644 --- a/backend/windmill-queue/Cargo.toml +++ b/backend/windmill-queue/Cargo.toml @@ -11,6 +11,7 @@ path = "src/lib.rs" [features] default = [] enterprise = ["windmill-common/enterprise"] +cloud = [] benchmark = [] prometheus = ["dep:prometheus"] diff --git a/backend/windmill-queue/src/jobs.rs b/backend/windmill-queue/src/jobs.rs index f422b1b24a..999f233a81 100644 --- a/backend/windmill-queue/src/jobs.rs +++ b/backend/windmill-queue/src/jobs.rs @@ -699,7 +699,7 @@ pub async fn add_completed_job< queued_job.id ); - #[cfg(feature = "enterprise")] + #[cfg(feature = "cloud")] if *CLOUD_HOSTED && !queued_job.is_flow() && _duration > 1000 { let additional_usage = _duration / 1000; let w_id = &queued_job.workspace_id; @@ -2624,7 +2624,7 @@ pub async fn push<'c, T: Serialize + Send + Sync, R: rsmq_async::RsmqConnection flow_step_id: Option, _priority_override: Option, ) -> Result<(Uuid, QueueTransaction<'c, R>), Error> { - #[cfg(feature = "enterprise")] + #[cfg(feature = "cloud")] if *CLOUD_HOSTED { let premium_workspace = sqlx::query_scalar!("SELECT premium FROM workspace WHERE id = $1", workspace_id) diff --git a/backend/windmill-worker/src/common.rs b/backend/windmill-worker/src/common.rs index 14cb8c54e9..836765a8fd 100644 --- a/backend/windmill-worker/src/common.rs +++ b/backend/windmill-worker/src/common.rs @@ -1160,7 +1160,7 @@ pub async fn resolve_job_timeout( custom_timeout_secs: Option, ) -> (Duration, Option) { let mut warn_msg: Option = None; - #[cfg(feature = "enterprise")] + #[cfg(feature = "cloud")] let cloud_premium_workspace = *CLOUD_HOSTED && sqlx::query_scalar!("SELECT premium FROM workspace WHERE id = $1", _w_id) .fetch_one(_db) @@ -1169,7 +1169,7 @@ pub async fn resolve_job_timeout( tracing::error!(%e, "error getting premium workspace for job {_job_id}: {e}"); }) .unwrap_or(false); - #[cfg(not(feature = "enterprise"))] + #[cfg(not(feature = "cloud"))] let cloud_premium_workspace = false; // compute global max timeout