Skip to content

Commit

Permalink
Add concurrency plot to the runs page
Browse files Browse the repository at this point in the history
  • Loading branch information
wendrul committed May 6, 2024
1 parent e8e5460 commit c922507
Show file tree
Hide file tree
Showing 11 changed files with 530 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ALTER TABLE concurrency_key

ALTER TABLE custom_concurrency_key_ended
DROP COLUMN job_id,
DROP COLUMN concurrency_time_window_s,
ADD PRIMARY KEY (key, ended_at);


11 changes: 2 additions & 9 deletions backend/migrations/20240428204638_job_concurrency_key.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,10 @@
ALTER TABLE custom_concurrency_key_ended
RENAME TO concurrency_key;

DROP EXTENSION "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

ALTER TABLE concurrency_key
DROP CONSTRAINT custom_concurrency_key_ended_pkey,
-- uuid_generate_v4 was not present until i dropped and reloaded uuid-ossp extension
ADD COLUMN job_id UUID DEFAULT uuid_generate_v4() NOT NULL PRIMARY KEY,
-- ADD COLUMN job_id UUID DEFAULT (SELECT md5(random()::text || clock_timestamp()::text)::uuid) NOT NULL PRIMARY KEY,
ADD COLUMN concurrency_time_window_s INTEGER DEFAULT 0 NOT NULL,
ADD COLUMN job_id UUID DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY,
ALTER COLUMN ended_at DROP NOT NULL,
ALTER COLUMN ended_at SET DEFAULT NULL;


CREATE INDEX concurrency_key_ended_at_idx ON concurrency_key (key, ended_at);
CREATE INDEX concurrency_key_ended_at_idx ON concurrency_key (key, ended_at DESC);
66 changes: 58 additions & 8 deletions backend/windmill-api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7936,9 +7936,9 @@ paths:
schema:
type: object
properties: {}
/concurrency_groups/w/{workspace}/{id}:
/w/{workspace}/concurrency_groups/job_concurrency_key/{id}:
get:
summary: Get the concurrency key for a job that's active in the concurrency_group
summary: Get the concurrency key for a job that has concurrency limits enabled
operationId: getConcurrencyKey
tags:
- concurrencyGroups
Expand All @@ -7947,11 +7947,31 @@ paths:
- $ref: "#/components/parameters/JobId"
responses:
"200":
description: concurrency key returned
description: concurrency key for given job
content:
application/json:
schema:
type: string
/w/{workspace}/concurrency_groups/intervals:
get:
summary: Get intervals of job runtime concurrency
operationId: getConcurrencyIntervals
tags:
- concurrencyGroups
parameters:
- $ref: "#/components/parameters/WorkspaceId"
- in: query
name: concurrency_key
required: false
schema:
type: string
responses:
"200":
description: time
content:
application/json:
schema:
$ref: "#/components/schemas/ConcurrencyIntervals"

components:
securitySchemes:
Expand Down Expand Up @@ -10339,12 +10359,42 @@ components:
ConcurrencyGroup:
type: object
properties:
concurrency_id:
concurrency_key:
type: string
total_running:
type: number
total_completed_within_time_window:
type: number
required:
- concurrency_key
- total_running
- total_completed_within_time_window

ConcurrencyIntervals:
type: object
properties:
concurrency_key:
type: string
job_uuids:
running_jobs:
type: array
items:
type: string
type: object
properties:
started_at:
type: string
format: date-time
completed_jobs:
type: array
items:
type: object
properties:
started_at:
type: string
format: date-time
ended_at:
type: string
format: date-time
required:
- concurrency_id
- job_uuids
- concurrency_key
- running_jobs
- completed_jobs
Loading

0 comments on commit c922507

Please sign in to comment.