Job
The job block lets you define recurring requests or sequences with a given interval. The job runs at startup
and then at every interval and has its own log type: couper_job, which represents the starting point with a UID for tracing
purposes. Older configurations may still use the legacy block name beta_job, which remains supported as an alias.
| Block name | Context | Label |
|---|---|---|
job | Definitions Block | required |
Example
# ...
definitions {
job "update_data" {
# Execute once at the start of Couper and then every minute
interval = "1m"
request "origin" {
url = "/api/v1/exports/data"
backend = "read"
}
request "update" {
url = "/update"
body = backend_responses.origin.body
backend = "write"
}
}
backend "read" {
origin = "${env.MY_ORIGIN}"
basic_auth = env.MY_AUTH
}
backend "write" {
origin = "${env.ORIGIN_DATABASE}"
}
}
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
custom_log_fields | object | - | Log fields for custom logging. Inherited by nested blocks. |
interval | duration | - | Execution interval. |
startup_delay | duration | "0s" | Delays the first execution of the job after startup. |
Duration
Values of type duration are provided as number string followed by a unit listed below.
Example: timeout = "300s"
| Duration units | Description |
|---|---|
ns | nanoseconds |
us (or µs) | microseconds |
ms | milliseconds |
s | seconds |
m | minutes |
h | hours |
Nested Blocks
| Name | Description |
|---|---|
request | Configures a request (zero or more). |