Creating and Run Jobs
Before You Begin
You'll need to get an authentication token to run refreshes. Tokens are used for the Trigger Job to Run API or using refresh with the CLI. Review the steps in Connecting to the API.
You can only refresh if you've deployed your pipeline.
Step 1: Create a Job
- Go to Jobs in the Build sidebar.
- Select the + sign to create a new Job.
- Select Edit to add selector queries. Selector queries allow you to select a subset of Nodes to be refreshed.
- Take note of your Job ID. In this example it's
jobID: 3
. You'll need the Job ID to run it as part of the refresh.

Step 2: Commit Your Job
Jobs need to be committed into git and deployed to an environment before they can be used. You can read more about making commits in our Git Integration article.

Step 3: Configure Your Environment
Go to Build Settings > Environments and check that the environment you want to refresh is configured. It should have:
Step 4: Deploy Your Pipeline
Jobs can only be run if they have been deployed first. Review our Deployment Overview to learn different ways to deploy your pipeline.
Step 5: Run Your Jobs
Use the Coalesce Scheduler (fastest), API or CLI to run a Job.
Scheduler
The built-in Coalesce Scheduler provides the easiest and fastest way to automate your environment refresh.
API
Jobs can be triggered with the Start Job endpoint. Trigger Job to Run. By only passing the environmentID
and leaving the jobID
out, you can refresh the entire environment. You can also use the excludeNodesSelector
and includeNodesSelector
to override the Jobs created. To avoid setting the selectors manually each run, we recommend using Jobs to save and manage nodes.
- Run a Job
- Run a one-time Job
- Refresh an entire environment
curl --request POST \
--url https://app.coalescesoftware.io/scheduler/startRun \
--header 'Authorization: Bearer YOUR-API-TOKEN' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"runDetails": {
"parallelism": 16,
"jobID": "4",
"environmentID": "10"
},
"userCredentials": {
"snowflakeAuthType": "Basic",
"snowflakeRole": "ACCOUNTADMIN",
"snowflakeWarehouse": "COMPUTE_WH",
"snowflakeUsername": "SOMEUSER",
"snowflakePassword": "SOMEPASS"
}
}
'
You can also the excludeNodesSelector
and includeNodesSelector
to run a one-time Job. Leave out the jobID
.
curl --request POST \
--url https://app.coalescesoftware.io/scheduler/startRun \
--header 'Authorization: Bearer YOUR-API-TOKEN' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"runDetails": {
"parallelism": 16,
"includeNodesSelector": "{ location: SAMPLE name: CUSTOMER } OR { location: SAMPLE name: LINEITEM } OR { location: SAMPLE name: NATION } OR { location: SAMPLE name: ORDERS } OR { location: SAMPLE name: PART } OR { location: SAMPLE name: PARTSUPP } OR { location: SAMPLE name: REGION } OR { location: SAMPLE name: SUPPLIER } OR { location: QA name: STG_PARTSUPP } OR { location: PROD name: STG_PARTSUPP }",
"environmentID": "10"
},
"userCredentials": {
"snowflakeAuthType": "Basic",
"snowflakeRole": "ACCOUNTADMIN",
"snowflakeWarehouse": "COMPUTE_WH",
"snowflakeUsername": "SOMEUSER",
"snowflakePassword": "SOMEPASS"
}
}
Leave out the jobID
and selectors to refresh an entire environment.
curl --request POST \
--url https://app.coalescesoftware.io/scheduler/startRun \
--header 'Authorization: Bearer YOUR-API-TOKEN' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"runDetails": {
"parallelism": 16,
"environmentID": "10"
},
"userCredentials": {
"snowflakeAuthType": "Basic",
"snowflakeRole": "ACCOUNTADMIN",
"snowflakeWarehouse": "COMPUTE_WH",
"snowflakeUsername": "SOMEUSER",
"snowflakePassword": "SOMEPASS"
}
}
'
CLI
Refresh jobs can be triggered using our CLI tool coa
using coa refresh
. Learn more in our CLI Commands documentation. By only passing the environmentID
and leaving the jobID
out, you can refresh the entire environment. You can also use the excludeNodesSelector
and includeNodesSelector
to override the Jobs created. To avoid setting the selectors manually each run, we recommend using Jobs to save and manage nodes.
Make sure to setup your CLI. Review CLI set up.
- Run a Job
- Run a one-time Job
- Refresh an entire environment
This example assumes you are using a coa
config file.
coa refresh --environmentID 1 --jobID 4
You can also the excludeNodesSelector
and includeNodesSelector
to run a one-time Job. Leave out the jobID
.
coa refresh --environmentID 1 --include '{ location: SAMPLE name: CUSTOMER } OR { location: SAMPLE name: LINEITEM } OR { location: SAMPLE name: NATION } OR { location: SAMPLE name: ORDERS } OR { location: SAMPLE name: PART } OR { location: SAMPLE name: PARTSUPP } OR { location: SAMPLE name: REGION } OR { location: SAMPLE name: SUPPLIER } OR { location: QA name: STG_PARTSUPP } OR { location: PROD name: STG_PARTSUPP }'
Leave out the jobID
and selectors to refresh an entire environment.
coa refresh --environmentID 1
Coalesce App
Only existing, deployed Jobs can be run from the Coalesce App.
Go to the Deploy page, and next to each deploy, click on the menu, and select Run Job.
