You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core_concepts/9_worker_groups/index.mdx
+30-2Lines changed: 30 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,8 @@ Examples of configurations include:
46
46
47
47
1.[Assign different jobs to specific worker groups](#set-tags-to-assign-specific-queues) by giving them tags.
48
48
2.[Set an init script](#init-scripts) that will run at the start of the workers (e.g. to pre-install binaries).
49
-
3.[Dedicate your worker to a specific script or flow](#dedicated-workers--high-throughput) for high throughput.
49
+
3.[Set a worker script](#worker-scripts) that will run at regular intervals on workers (e.g. for maintenance tasks).
50
+
4.[Dedicate your worker to a specific script or flow](#dedicated-workers--high-throughput) for high throughput.
50
51
51
52
## Assign custom worker groups
52
53
@@ -274,7 +275,8 @@ Examples of configurations include:
274
275
275
276
1. [Assign different jobs to specific worker groups](#set-tags-to-assign-specific-queues) by giving them tags.
276
277
2. [Set an init script](#init-scripts) that will run at the start of the workers (e.g. to pre-install binaries).
277
-
3. [Dedicate your worker to a specific script or flow](#dedicated-workers--high-throughput) for high throughput.
278
+
3. [Set a worker script](#worker-scripts) that will run at regular intervals on workers (e.g. for maintenance tasks).
279
+
4. [Dedicate your worker to a specific script or flow](#dedicated-workers--high-throughput) for high throughput.
278
280
279
281
## Alerts
280
282
@@ -363,6 +365,32 @@ Under the [Cloud plans & Self-Hosted Enterprise Edition](/pricing), they can be
363
365
/>
364
366
</div>
365
367
368
+
## Worker scripts
369
+
370
+
Worker scripts are bash scripts that run at regular intervals on workers, complementing init scripts which only run at worker startup. While init scripts handle one-time setup tasks like installing dependencies or configuring the environment, worker scripts are designed for ongoing maintenance tasks that need to be executed repeatedly during the worker's lifetime.
371
+
372
+
### Key differences from init scripts
373
+
374
+
- **Init scripts**: Run once when the worker starts, ideal for setup and configuration tasks
375
+
- **Worker scripts**: Run continuously at specified intervals (minimum 60 seconds), ideal for maintenance and monitoring tasks
376
+
377
+
### Common use cases
378
+
379
+
Worker scripts are particularly useful for:
380
+
381
+
- **System maintenance**: Cleaning temporary files, rotating logs, or performing health checks
382
+
- **Cache management**: Clearing expired cache entries or warming up caches
383
+
- **Resource monitoring**: Collecting metrics or monitoring system resources
Under the [Cloud plans & Self-Hosted Enterprise Edition](/pricing), worker scripts can be configured from the Windmill UI in the worker group settings, similar to init scripts.
389
+
390
+
When adjustments are made in the Worker Management UI, the workers will shut down and are expected to be restarted by their supervisor (Docker or k8s).
391
+
392
+
The execution of worker scripts is inspectable in the superadmin workspace, with Kind = All filter. The path of those executions are `periodic_script_{worker_name}_{timestamp}`.
393
+
366
394
## Dedicated workers / High throughput
367
395
368
396
Dedicated Workers are workers that are dedicated to a particular script. They are able to execute any job that target this script much faster than normal workers at the expense of being capable to only execute that one script.
0 commit comments