The Scheduler on Tanzu platform is a service for scheduling the execution of Diego tasks, such as database migrations, emails, or batch jobs, as well as the execution of outbound HTTP calls.
When creating many jobs in single space, the Apps Manager UI and `cf jobs` command only returns a part of the jobs list.
Scheduler service returns the job list in multiple pages, with a max of 50 results per page. The page parameter can be specified in the Scheduler API, however it's not implemented yet in Apps Manager and the CF CLI Scheduler plugin.
Until the paging feature is implemented by CF CLI and Apps Manager, in order to fetch full list of jobs if the count is greater than 50 in single space, please execute a curl
request against scheduler endpoint directly with page parameter, modify the page from 1 until no further results:
curl -H "Authorization: $(cf oauth-token)" "https://scheduler.<SYSTEM_DOMAIN>/jobs?space_guid=<SPACE_GUID>&page=1""
The response is at JSON format, we suggest using jq utility as below:
curl -H "Authorization: $(cf oauth-token)" "https://scheduler.<SYSTEM_DOMAIN>/jobs?space_guid=<SPACE_GUID>&page=1"" | jq .
If you want to fetch job name only:
curl -H "Authorization: $(cf oauth-token)" "https://scheduler.<SYSTEM_DOMAIN>/jobs?space_guid=<SPACE_GUID>&page=1"" | jq .resources[].name "job18" "job3" "job97" "job67" "job74" "job17" "job22" "job49" "job35" "job48" "job93" "job21" "job32" "job44" "job65" "job15" "job59" "job31" "job20" ...
To fetch details of a single job, run the following:
curl -H "Authorization: $(cf oauth-token)" "https://scheduler.<SYSTEM_DOMAIN>/jobs?space_guid=<SPACE_GUID>&page=1"" | jq '.resources[] | select(.name == "job12")' { "guid": "87f178e5-2d82-4fa3-81f5-5d7c81c5d88d", "name": "job12", "state": "AVAILABLE", "command": "echo sleep; sleep 30000", "app_guid": "36bdc877-4ca0-4886-8397-5248d1d6e432", "space_guid": "0af6fa2d-d471-4fc6-905f-077d5d302dfc", "created_at": "2020-04-17T10:27:41Z", "updated_at": "2020-04-17T10:27:41Z" }