Creating job sequence conditions
Job sequence conditions enable you to specify additional logic in your job sequences. There are two different types of conditions:
And Gates
An "And" gate is a job type that enables you to define in a job sequence, multiple jobs that need to complete before the subsequent job runs.
Create a job sequence using the "And" gate condition for the following scenario:
3 separate ingest jobs run in parallel.
After all 3 ingest jobs complete, a data warehouse job runs.
The diagram below shows the workflow of this job sequence.
Let's take a look at the API request body to create the example above.
Request URL
POST {host}/api/cx-unity-api/flows
Request body:
Note the And gate is specified using "jobId": "and_gate"
. If you are using multiple gates, remember to ensure each gate has a unique id
.
{
"flowName": "Job_Sequence_Example2",
"flowId": "Job_Sequence_Example2",
"description": "Job sequence using the AND condition.",
"active": true,
"jobs": [
{
"id": "job1.1",
"jobId": "CXU_JOB_1604904383636",
"type": "INGEST",
"description": "Ingest job",
"depends": [
]
},
{
"id": "job1.2",
"jobId": "CXU_JOB_1594707228013",
"type": "INGEST",
"description": "Ingest job 2",
"depends": [
]
},
{
"id": "job1.3",
"jobId": "CXU_JOB_1610472015715",
"type": "INGEST",
"description": "Ingest job 3",
"depends": [
]
},
{
"id": "job2",
"jobId": "and_gate",
"condition": "and",
"type": "GATE",
"description": "And gate",
"depends": [
"job1.1",
"job1.2",
"job1.3"
]
},
{
"id": "job3",
"jobId": "Dw",
"type": "DW",
"description": "Data warehouse job",
"depends": [
"job2"
]
}
]
}
OR Gates
OR Gate conditions enable you to create a job sequence where at least one job out of multiple must complete before the subsequent job runs.
Create a job sequence using the "OR" condition for the following scenario:
-
3 separate ingest jobs run in parallel.
-
After at least 1 of the ingest jobs finishes, the data warehouse job runs.
Here's an illustration of this job sequence:
Let's take a look at the API request body to create the example above.
Request URL
POST {host}/api/cx-unity-api/flows
Request body:
Note the Or gate is specified using "jobId": "or_gate"
. If you are using multiple gates, remember to ensure each gate has a unique id
.
{
"flowName": "Job_Sequence_Example3",
"flowId": "Job_Sequence_Example3",
"description": "Job sequence using the OR condition.",
"active": true,
"jobs": [
{
"id": "job1.1",
"jobId": "CXU_JOB_1604904383636",
"type": "INGEST",
"description": "Ingest job.",
"depends": [
]
},
{
"id": "job1.2",
"jobId": "CXU_JOB_1594707228013",
"type": "INGEST",
"description": "Ingest job 2.",
"depends": [
]
},
{
"id": "job1.3",
"jobId": "CXU_JOB_1610472015715",
"type": "INGEST",
"description": "Ingest job 3.",
"depends": [
]
},
{
"id": "job2",
"jobId": "or_gate",
"condition": "or",
"type": "GATE",
"description": "Or gate.",
"depends": [
"job1.1",
"job1.2",
"job1.3"
]
},
{
"id": "job3",
"jobId": "Dw",
"type": "DW",
"description": "Data warehouse job",
"depends": [
"job2"
]
}
]
}
Next steps
Configuring job sequence notifications