Skip to content

Commit

Permalink
add version to workers
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Nov 5, 2023
1 parent 2d05d18 commit 12030e0
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 28 deletions.
71 changes: 48 additions & 23 deletions backend/windmill-api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2094,7 +2094,8 @@ paths:

/w/{workspace}/resources/get_value_interpolated/{path}:
get:
summary: get resource interpolated (variables and resources are fully unrolled)
summary:
get resource interpolated (variables and resources are fully unrolled)
operationId: getResourceValueInterpolated
tags:
- resource
Expand Down Expand Up @@ -2782,7 +2783,8 @@ paths:
schema:
type: string
- name: first_parent_hash
description: mask to filter scripts whom first direct parent has exact hash
description:
mask to filter scripts whom first direct parent has exact hash
in: query
schema:
type: string
Expand Down Expand Up @@ -2977,7 +2979,8 @@ paths:

/workers/custom_tags:
get:
summary: get all instance custom tags (tags are used to dispatch jobs to
summary:
get all instance custom tags (tags are used to dispatch jobs to
different worker groups)
operationId: getCustomTags
tags:
Expand Down Expand Up @@ -3028,7 +3031,8 @@ paths:

/w/{workspace}/scripts/delete/h/{hash}:
post:
summary: delete script by hash (erase content but keep hash, require admin)
summary:
delete script by hash (erase content but keep hash, require admin)
operationId: deleteScriptByHash
tags:
- script
Expand Down Expand Up @@ -3220,14 +3224,16 @@ paths:
type: string
format: date-time
- name: scheduled_in_secs
description: schedule the script to execute in the number of seconds starting now
description:
schedule the script to execute in the number of seconds starting now
in: query
schema:
type: integer
- $ref: "#/components/parameters/ParentJob"
- $ref: "#/components/parameters/NewJobId"
- name: invisible_to_owner
description: make the run invisible to the the script owner (default false)
description:
make the run invisible to the the script owner (default false)
in: query
schema:
type: boolean
Expand Down Expand Up @@ -4200,15 +4206,17 @@ paths:
type: string
format: date-time
- name: scheduled_in_secs
description: schedule the script to execute in the number of seconds starting now
description:
schedule the script to execute in the number of seconds starting now
in: query
schema:
type: integer
- $ref: "#/components/parameters/ParentJob"
- $ref: "#/components/parameters/NewJobId"
- $ref: "#/components/parameters/IncludeHeader"
- name: invisible_to_owner
description: make the run invisible to the the flow owner (default false)
description:
make the run invisible to the the flow owner (default false)
in: query
schema:
type: boolean
Expand Down Expand Up @@ -4246,7 +4254,9 @@ paths:
schema:
type: string
- name: branch_or_iteration_n
description: for branchall or loop, the iteration at which the flow should restart
description:
for branchall or loop, the iteration at which the flow should
restart
required: true
in: path
schema:
Expand All @@ -4258,15 +4268,17 @@ paths:
type: string
format: date-time
- name: scheduled_in_secs
description: schedule the script to execute in the number of seconds starting now
description:
schedule the script to execute in the number of seconds starting now
in: query
schema:
type: integer
- $ref: "#/components/parameters/ParentJob"
- $ref: "#/components/parameters/NewJobId"
- $ref: "#/components/parameters/IncludeHeader"
- name: invisible_to_owner
description: make the run invisible to the the flow owner (default false)
description:
make the run invisible to the the flow owner (default false)
in: query
schema:
type: boolean
Expand Down Expand Up @@ -4304,15 +4316,17 @@ paths:
type: string
format: date-time
- name: scheduled_in_secs
description: schedule the script to execute in the number of seconds starting now
description:
schedule the script to execute in the number of seconds starting now
in: query
schema:
type: integer
- $ref: "#/components/parameters/ParentJob"
- $ref: "#/components/parameters/NewJobId"
- $ref: "#/components/parameters/IncludeHeader"
- name: invisible_to_owner
description: make the run invisible to the the script owner (default false)
description:
make the run invisible to the the script owner (default false)
in: query
schema:
type: boolean
Expand Down Expand Up @@ -4343,7 +4357,8 @@ paths:
- $ref: "#/components/parameters/WorkspaceId"
- $ref: "#/components/parameters/IncludeHeader"
- name: invisible_to_owner
description: make the run invisible to the the script owner (default false)
description:
make the run invisible to the the script owner (default false)
in: query
schema:
type: boolean
Expand Down Expand Up @@ -4376,7 +4391,8 @@ paths:
- $ref: "#/components/parameters/WorkspaceId"
- $ref: "#/components/parameters/IncludeHeader"
- name: invisible_to_owner
description: make the run invisible to the the script owner (default false)
description:
make the run invisible to the the script owner (default false)
in: query
schema:
type: boolean
Expand Down Expand Up @@ -4591,7 +4607,8 @@ paths:
- job
responses:
"200":
description: the timestamp of the db that can be used to compute the drift
description:
the timestamp of the db that can be used to compute the drift
content:
application/json:
schema:
Expand Down Expand Up @@ -4827,7 +4844,8 @@ paths:

/w/{workspace}/jobs/resume_urls/{id}/{resume_id}:
get:
summary: get resume urls given a job_id, resume_id and a nonce to resume a flow
summary:
get resume urls given a job_id, resume_id and a nonce to resume a flow
operationId: getResumeUrls
tags:
- job
Expand Down Expand Up @@ -5340,7 +5358,8 @@ paths:
- $ref: "#/components/parameters/WorkspaceId"
- name: only_member_of
in: query
description: only list the groups the user is member of (default false)
description:
only list the groups the user is member of (default false)
schema:
type: boolean
responses:
Expand Down Expand Up @@ -5528,7 +5547,8 @@ paths:
- $ref: "#/components/parameters/WorkspaceId"
- name: only_member_of
in: query
description: only list the folders the user is member of (default false)
description:
only list the folders the user is member of (default false)
schema:
type: boolean
responses:
Expand Down Expand Up @@ -6246,7 +6266,8 @@ components:
type: integer
PerPage:
name: per_page
description: number of items to return for a given page (default 30, max 100)
description:
number of items to return for a given page (default 30, max 100)
in: query
schema:
type: integer
Expand Down Expand Up @@ -6380,7 +6401,8 @@ components:
type: boolean
ArgsFilter:
name: args
description: filter on jobs containing those args as a json subset (@> in postgres)
description:
filter on jobs containing those args as a json subset (@> in postgres)
in: query
schema:
type: string
Expand All @@ -6392,7 +6414,8 @@ components:
type: string
ResultFilter:
name: result
description: filter on jobs containing those result as a json subset (@> in postgres)
description:
filter on jobs containing those result as a json subset (@> in postgres)
in: query
schema:
type: string
Expand Down Expand Up @@ -7760,6 +7783,8 @@ components:
type: string
worker_group:
type: string
wm_version:
type: string
required:
- worker
- worker_instance
Expand All @@ -7768,7 +7793,7 @@ components:
- ip
- jobs_executed
- worker_group

- wm_version
UserWorkspaceList:
type: object
properties:
Expand Down
3 changes: 2 additions & 1 deletion backend/windmill-api/src/workers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct WorkerPing {
jobs_executed: i32,
custom_tags: Option<Vec<String>>,
worker_group: String,
wm_version: String,
}

#[derive(Serialize, Deserialize)]
Expand All @@ -57,7 +58,7 @@ async fn list_worker_pings(

let rows = sqlx::query_as!(
WorkerPing,
"SELECT worker, worker_instance, EXTRACT(EPOCH FROM (now() - ping_at))::integer as last_ping, started_at, ip, jobs_executed, custom_tags, worker_group FROM worker_ping ORDER BY ping_at desc LIMIT $1 OFFSET $2",
"SELECT worker, worker_instance, EXTRACT(EPOCH FROM (now() - ping_at))::integer as last_ping, started_at, ip, jobs_executed, custom_tags, worker_group, wm_version FROM worker_ping ORDER BY ping_at desc LIMIT $1 OFFSET $2",
per_page as i64,
offset as i64
)
Expand Down
5 changes: 3 additions & 2 deletions backend/windmill-common/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ pub async fn update_ping(worker_instance: &str, worker_name: &str, ip: &str, db:
)
};
sqlx::query!(
"INSERT INTO worker_ping (worker_instance, worker, ip, custom_tags, worker_group, dedicated_worker) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (worker) DO UPDATE set ip = $3, custom_tags = $4, worker_group = $5",
"INSERT INTO worker_ping (worker_instance, worker, ip, custom_tags, worker_group, dedicated_worker, wm_version) VALUES ($1, $2, $3, $4, $5, $6, $7) ON CONFLICT (worker) DO UPDATE set ip = $3, custom_tags = $4, worker_group = $5",
worker_instance,
worker_name,
ip,
tags.as_slice(),
*WORKER_GROUP,
dw
dw,
crate::utils::GIT_VERSION
)
.execute(db)
.await
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/routes/(root)/(logged)/workers/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
<Cell head>Last ping</Cell>
<Cell head>Worker start</Cell>
<Cell head>Nb of jobs executed</Cell>
<Cell head>Version</Cell>
<Cell head last>Liveness</Cell>
</tr>
</Head>
Expand All @@ -321,7 +322,7 @@
<tr class="border-t">
<Cell
first
colspan="6"
colspan="7"
scope="colgroup"
class="bg-surface-secondary/60 py-2 border-b"
>
Expand All @@ -334,7 +335,7 @@
</tr>

{#if workers}
{#each workers as { worker, custom_tags, last_ping, started_at, jobs_executed }}
{#each workers as { worker, custom_tags, last_ping, started_at, jobs_executed, wm_version }}
<tr>
<Cell first>{worker}</Cell>
<Cell>
Expand All @@ -348,6 +349,11 @@
<Cell>{last_ping != undefined ? last_ping + timeSinceLastPing : -1}s ago</Cell>
<Cell>{displayDate(started_at)}</Cell>
<Cell>{jobs_executed}</Cell>
<Cell
><div class="!text-2xs"
>{wm_version.split('-')[0]}<Tooltip>{wm_version}</Tooltip></div
></Cell
>
<Cell last>
<Badge
color={last_ping != undefined ? (last_ping < 60 ? 'green' : 'red') : 'gray'}
Expand Down

0 comments on commit 12030e0

Please sign in to comment.