Notifications
Notifications
When job and batch status needs to be monitored, their statuses can be pulled. Another option is to use job component notifications, posted to one of Radix application components.
The URL to the Radix application component or job component endpoint can be specified in the webhook
option in the notifications
section in the radixconfig.yaml. This is an endpoint where a Radix batch events will be posted when any of the running jobs or batches for this job component changes states. Notification about changes are sent by a POST
method with an application/json
ContentType
with a Radix batch event format, which extends the Radix batch status format with fields
name
- internal name of the batch or a single job. In both cases the name begins withbatch-
batchId
- optional string value to identify a batch.created
,started
,ended
- timestamp of corresponding batch live cycle eventstatus
- status of a batch or a single jobupdated
- timestamp when a status was updatedevent
:Create
- this event is sent when a new Radix batch or job is created.Update
- this event is sent when an existing Radix batch or one of its jobs, including single job, has changed state.Delete
- this event is sent when an existing Radix batch or job is deleted.
batchType
:job
- single jobbatch
- batch of jobs
jobStatuses
- list of statuses of only changed jobs. This list can be empty when the common properties are changed (e.g. onlystarted
,status
).
Fields in the jobStatus
list items:
jobId
- optional name, specified for the job withinJobDescription
batchName
- name of a batch for job in a batch. It is not provided for single jobs.podStatuses
- list of status and attributes of one or several job pods (replicas). If the job's replica failed and job-component has backoffLimit greater then0
,podStatus
containsexitCode
andreason
for failed pods.podIndex
gives an order of pod statuses (starting from0
)- In the
podStatuses
replica attributeimage
should be the same for all pods, butimageId
can be different, if this image was updated within a period of different pods starts.
- In the
notifications
and webhook
can be specified on a job component configuration level and/or on environmentConfig
level. Property in the environmentConfig
will override those on the component level, if present.
- Only a Radix application component or job component name and their ports can be used in the webhook URL
- Only private ports of the specified component can be used, public ports cannot be used for this purpose.
components:
- name: frontend
src: frontend
ports:
- name: http
port: 8001
- name: job-monitoring
port: 8002
publicPort: http
jobs:
- name: compute
schedulerPort: 8080
notifications:
webhook: http://frontend:8002
Radix batch event
{
"name": "batch-compute-20220302155333-hrwl53mw",
"batchId": "random-batch-id-123",
"created": "2022-03-02T15:53:33+01:00",
"started": "2022-03-02T15:53:33+01:00",
"ended": "2022-03-02T15:54:00+01:00",
"status": "Succeeded",
"updated": "2022-03-02T15:54:00+01:00",
"jobStatuses": [
{
"jobId": "job1",
"batchName": "batch-compute-20220302155333-hrwl53mw",
"name": "batch-compute-20220302155333-hrwl53mw-fjhcqwj7",
"created": "2022-03-02T15:53:36+01:00",
"started": "2022-03-02T15:53:36+01:00",
"ended": "2022-03-02T15:53:56+01:00",
"status": "Succeeded",
"updated": "2022-03-02T15:53:56+01:00",
"podStatuses": [
{
"name": "batch-compute-20220302155333-hrwl53mw-fjhcqwj7-5sfnl",
"created": "2022-03-02T15:53:36Z",
"startTime": "2022-03-02T15:53:36Z",
"endTime": "2022-03-02T15:53:56Z",
"containerStarted": "2022-03-02T15:53:36Z",
"replicaStatus": {
"status": "Succeeded"
},
"image": "radixprod.azurecr.io/radix-app-dev-compute:6k8vv",
"imageId": "radixprod.azurecr.io/radix-app-dev-compute@sha256:1f9ce890db8eb89ae0369995f76676a58af2a82129fc0babe080a5daca86a44e",
"exitCode": 0,
"reason": "Completed"
}
]
},
{
"jobId": "job2",
"batchName": "batch-compute-20220302155333-hrwl53mw",
"name": "batch-compute-20220302155333-hrwl53mw-qjzykhrd",
"created": "2022-03-02T15:53:39+01:00",
"started": "2022-03-02T15:53:39+01:00",
"ended": "2022-03-02T15:53:56+01:00",
"status": "Succeeded",
"updated": "2022-03-02T15:53:56+01:00",
"podStatuses": [
{
"name": "batch-compute-20220302155333-hrwl53mw-qjzykhrd-5sfnl",
"created": "2022-03-02T15:53:39Z",
"startTime": "2022-03-02T15:53:40Z",
"endTime": "2022-03-02T15:53:56Z",
"containerStarted": "2022-03-02T15:53:40Z",
"replicaStatus": {
"status": "Succeeded"
},
"image": "radixprod.azurecr.io/radix-app-dev-compute:6k8vv",
"imageId": "radixprod.azurecr.io/radix-app-dev-compute@sha256:1f9ce890db8eb89ae0369995f76676a58af2a82129fc0babe080a5daca86a44e",
"exitCode": 0,
"reason": "Completed"
}
]
}
]
}