Skip to content

Commit a79e040

Browse files
dieribarubenfiszel
andauthored
update worker docs to include periodic script features (#1042)
* update * Update index.mdx --------- Co-authored-by: Ruben Fiszel <[email protected]>
1 parent 391cd9e commit a79e040

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

docs/core_concepts/9_worker_groups/index.mdx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Examples of configurations include:
4646

4747
1. [Assign different jobs to specific worker groups](#set-tags-to-assign-specific-queues) by giving them tags.
4848
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.
5051

5152
## Assign custom worker groups
5253

@@ -274,7 +275,8 @@ Examples of configurations include:
274275
275276
1. [Assign different jobs to specific worker groups](#set-tags-to-assign-specific-queues) by giving them tags.
276277
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.
278280
279281
## Alerts
280282
@@ -363,6 +365,32 @@ Under the [Cloud plans & Self-Hosted Enterprise Edition](/pricing), they can be
363365
/>
364366
</div>
365367
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
384+
- **Security tasks**: Running periodic security scans or updating security configurations
385+
386+
### Configuration and execution
387+
388+
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+
366394
## Dedicated workers / High throughput
367395
368396
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

Comments
 (0)