diff --git a/backend/.sqlx/query-11ae5e1aade2bc9a78af2d956ece73766ae3330319619a68383b508a76f2d19c.json b/backend/.sqlx/query-11ae5e1aade2bc9a78af2d956ece73766ae3330319619a68383b508a76f2d19c.json index 67bdf6ea9d..dcd14131c0 100644 --- a/backend/.sqlx/query-11ae5e1aade2bc9a78af2d956ece73766ae3330319619a68383b508a76f2d19c.json +++ b/backend/.sqlx/query-11ae5e1aade2bc9a78af2d956ece73766ae3330319619a68383b508a76f2d19c.json @@ -42,6 +42,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-254776959f60455a00a2c29a1783ee6b27c836197df6454d3bb5c59441c34f44.json b/backend/.sqlx/query-254776959f60455a00a2c29a1783ee6b27c836197df6454d3bb5c59441c34f44.json index 272aefc9d2..ad66cfa646 100644 --- a/backend/.sqlx/query-254776959f60455a00a2c29a1783ee6b27c836197df6454d3bb5c59441c34f44.json +++ b/backend/.sqlx/query-254776959f60455a00a2c29a1783ee6b27c836197df6454d3bb5c59441c34f44.json @@ -67,6 +67,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-502781c4e2fc692db7a66b850450a1934b2403a5cff0421fe9609f9b99d8ee95.json b/backend/.sqlx/query-502781c4e2fc692db7a66b850450a1934b2403a5cff0421fe9609f9b99d8ee95.json deleted file mode 100644 index a727e2f8fb..0000000000 --- a/backend/.sqlx/query-502781c4e2fc692db7a66b850450a1934b2403a5cff0421fe9609f9b99d8ee95.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "DELETE FROM completed_job WHERE started_at + ((duration_ms/1000 + $1) || ' s')::interval <= now() RETURNING id", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - } - ], - "parameters": { - "Left": [ - "Int8" - ] - }, - "nullable": [ - false - ] - }, - "hash": "502781c4e2fc692db7a66b850450a1934b2403a5cff0421fe9609f9b99d8ee95" -} diff --git a/backend/.sqlx/query-52ad1773a9f5a1b6be1bb16af408f051f27d3f21b615c468b85aa75b64d943db.json b/backend/.sqlx/query-52ad1773a9f5a1b6be1bb16af408f051f27d3f21b615c468b85aa75b64d943db.json index 4df35d6cf7..2e4467041b 100644 --- a/backend/.sqlx/query-52ad1773a9f5a1b6be1bb16af408f051f27d3f21b615c468b85aa75b64d943db.json +++ b/backend/.sqlx/query-52ad1773a9f5a1b6be1bb16af408f051f27d3f21b615c468b85aa75b64d943db.json @@ -28,6 +28,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-620ddf29c5e867079df4c2aa6e80bccb19beeb9ddfa308ca97f254cd5ba8157e.json b/backend/.sqlx/query-620ddf29c5e867079df4c2aa6e80bccb19beeb9ddfa308ca97f254cd5ba8157e.json index e6282c7e80..c84e2ab8e2 100644 --- a/backend/.sqlx/query-620ddf29c5e867079df4c2aa6e80bccb19beeb9ddfa308ca97f254cd5ba8157e.json +++ b/backend/.sqlx/query-620ddf29c5e867079df4c2aa6e80bccb19beeb9ddfa308ca97f254cd5ba8157e.json @@ -60,6 +60,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-6b9ff3fbca9e825c95d14705082a10de88172c0c748a45aba4d2d03c3b58f54d.json b/backend/.sqlx/query-6b9ff3fbca9e825c95d14705082a10de88172c0c748a45aba4d2d03c3b58f54d.json index 73e6e17c76..dabac76bfe 100644 --- a/backend/.sqlx/query-6b9ff3fbca9e825c95d14705082a10de88172c0c748a45aba4d2d03c3b58f54d.json +++ b/backend/.sqlx/query-6b9ff3fbca9e825c95d14705082a10de88172c0c748a45aba4d2d03c3b58f54d.json @@ -46,6 +46,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-9d3556319411a27a875bf6cf0e5eda837cc63e4d8be912c0b5bfeea4a0c8db2e.json b/backend/.sqlx/query-9d3556319411a27a875bf6cf0e5eda837cc63e4d8be912c0b5bfeea4a0c8db2e.json index 61da7601af..8b139967a6 100644 --- a/backend/.sqlx/query-9d3556319411a27a875bf6cf0e5eda837cc63e4d8be912c0b5bfeea4a0c8db2e.json +++ b/backend/.sqlx/query-9d3556319411a27a875bf6cf0e5eda837cc63e4d8be912c0b5bfeea4a0c8db2e.json @@ -40,6 +40,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-b6074eb9369de071f79165bf506fbc44f1688035e1928b4c3649d875187b1e1d.json b/backend/.sqlx/query-b6074eb9369de071f79165bf506fbc44f1688035e1928b4c3649d875187b1e1d.json index 40ab7503e5..0385dfd1d5 100644 --- a/backend/.sqlx/query-b6074eb9369de071f79165bf506fbc44f1688035e1928b4c3649d875187b1e1d.json +++ b/backend/.sqlx/query-b6074eb9369de071f79165bf506fbc44f1688035e1928b4c3649d875187b1e1d.json @@ -42,6 +42,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-bb0ee03198bcad69a1777447cf5c42fc22700e3cbf8cd44621a8380536d77552.json b/backend/.sqlx/query-bb0ee03198bcad69a1777447cf5c42fc22700e3cbf8cd44621a8380536d77552.json new file mode 100644 index 0000000000..91a88794f4 --- /dev/null +++ b/backend/.sqlx/query-bb0ee03198bcad69a1777447cf5c42fc22700e3cbf8cd44621a8380536d77552.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM completed_job WHERE created_at <= now() - ($1::bigint::text || ' s')::interval AND started_at + ((duration_ms/1000 + $1::bigint) || ' s')::interval <= now() RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false + ] + }, + "hash": "bb0ee03198bcad69a1777447cf5c42fc22700e3cbf8cd44621a8380536d77552" +} diff --git a/backend/.sqlx/query-c7febee7146a28481ce36f3570bceb38751a6527827525a582d9f8804981f552.json b/backend/.sqlx/query-c7febee7146a28481ce36f3570bceb38751a6527827525a582d9f8804981f552.json index 3b43ee29f5..091c4160e3 100644 --- a/backend/.sqlx/query-c7febee7146a28481ce36f3570bceb38751a6527827525a582d9f8804981f552.json +++ b/backend/.sqlx/query-c7febee7146a28481ce36f3570bceb38751a6527827525a582d9f8804981f552.json @@ -42,6 +42,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/.sqlx/query-d48070ef889723f408ed6c1a97b5ab9f0e98340cd33c6e29824f6030f0089071.json b/backend/.sqlx/query-d48070ef889723f408ed6c1a97b5ab9f0e98340cd33c6e29824f6030f0089071.json index c0c9ef873f..7df86d1a0e 100644 --- a/backend/.sqlx/query-d48070ef889723f408ed6c1a97b5ab9f0e98340cd33c6e29824f6030f0089071.json +++ b/backend/.sqlx/query-d48070ef889723f408ed6c1a97b5ab9f0e98340cd33c6e29824f6030f0089071.json @@ -37,6 +37,7 @@ "bash", "postgresql", "nativets", + "Nativets", "bun", "mysql", "bigquery", diff --git a/backend/src/monitor.rs b/backend/src/monitor.rs index 31a3b12ebd..2b9cd80ec4 100644 --- a/backend/src/monitor.rs +++ b/backend/src/monitor.rs @@ -194,7 +194,7 @@ pub async fn delete_expired_items(db: &DB) -> () { let job_retention_secs = *JOB_RETENTION_SECS.read().await; if job_retention_secs > 0 { let deleted_jobs = sqlx::query_scalar!( - "DELETE FROM completed_job WHERE started_at + ((duration_ms/1000 + $1) || ' s')::interval <= now() RETURNING id", + "DELETE FROM completed_job WHERE created_at <= now() - ($1::bigint::text || ' s')::interval AND started_at + ((duration_ms/1000 + $1::bigint) || ' s')::interval <= now() RETURNING id", job_retention_secs ) .fetch_all(db) diff --git a/backend/windmill-queue/src/jobs.rs b/backend/windmill-queue/src/jobs.rs index 7997a1ac76..2beec58939 100644 --- a/backend/windmill-queue/src/jobs.rs +++ b/backend/windmill-queue/src/jobs.rs @@ -415,7 +415,7 @@ pub async fn add_completed_job< tx.commit().await?; #[cfg(feature = "enterprise")] - if !is_flow && _duration > 1000 { + if *CLOUD_HOSTED && !is_flow && _duration > 1000 { let additional_usage = _duration / 1000; let w_id = &queued_job.workspace_id; let premium_workspace = *windmill_common::worker::CLOUD_HOSTED @@ -1716,7 +1716,7 @@ pub async fn push<'c, T: Serialize + Send + Sync, R: rsmq_async::RsmqConnection priority_override: Option, ) -> Result<(Uuid, QueueTransaction<'c, R>), Error> { #[cfg(feature = "enterprise")] - { + if *CLOUD_HOSTED { let premium_workspace = *CLOUD_HOSTED && sqlx::query_scalar!("SELECT premium FROM workspace WHERE id = $1", workspace_id) .fetch_one(_db) diff --git a/benchmarks/pulumi/index.ts b/benchmarks/pulumi/index.ts index c3a254bdde..dfd9593282 100644 --- a/benchmarks/pulumi/index.ts +++ b/benchmarks/pulumi/index.ts @@ -273,7 +273,59 @@ db.address.apply((address) => { ], environment: [ { name: "MODE", value: "worker" }, + { name: "NUM_WORKERS", value: "1" }, + // { name: "METRICS_ADDR", value: "true" }, + { name: "RUST_LOG", value: "info" }, + { + name: "DATABASE_URL", + value: `postgres://postgres:postgres@${address}/windmill?sslmode=disable`, + }, + ], + + logConfiguration: { + logDriver: "awslogs", + options: { + "awslogs-group": "windmill-worker", + "awslogs-region": "us-east-2", + "awslogs-create-group": "true", + "awslogs-stream-prefix": "windmill-worker", + }, + }, + dockerLabels: { + PROMETHEUS_EXPORTER_PORT: "8001", + }, + }, + ]), + volumes: [ + { + name: "dependency_cache", + dockerVolumeConfiguration: { + scope: "shared", + autoprovision: true, + }, + }, + ], + }); + + const worker_td2 = new aws.ecs.TaskDefinition("worker-3", { + family: "windmill-worker-2", + containerDefinitions: JSON.stringify([ + { + name: "windmill-worker", + image: "ghcr.io/windmill-labs/windmill-ee:main", + cpu: 1024, + memory: 1800, + essential: true, + mountPaths: [ + { + containerPath: "/tmp/windmill/cache", + sourceVolume: "dependency_cache", + }, + ], + environment: [ + { name: "WORKER_GROUP", value: "dedicated" }, { name: "NUM_WORKERS", value: "10" }, + { name: "MODE", value: "worker" }, // { name: "METRICS_ADDR", value: "true" }, { name: "RUST_LOG", value: "info" }, { @@ -381,6 +433,19 @@ db.address.apply((address) => { }, ], }); + + const service_worker2 = new aws.ecs.Service("service-worker-2", { + cluster: cluster.id, + taskDefinition: worker_td2.arn, + desiredCount: 5, + forceNewDeployment: true, + orderedPlacementStrategies: [ + { + type: "binpack", + field: "cpu", + }, + ], + }); }); module.exports = {