intro-jberet application in OpenShift Online
cfang Oct 16, 2017 11:33 PMI recently created my OpenShift Online free starter account, and deployed intro-jberet sample application based on WildFly 10.1 image, just to try out various batch processing operations in the cloud. The sampe application is available here.
The following is a series of curl commands for common operations, with python -m json.tool for pretty-printing json output. You can try it in your own command line, or sign up for your own OpenShift Online account, deploy intro-jberet application or your own batch processing applications.
curl -s http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/jobs | python -m json.tool
[
{
"jobName": "csv2db",
"numberOfJobInstances": 2,
"numberOfRunningJobExecutions": 0
}
]
curl -s -X POST -H 'Content-Type:application/json' http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/jobs/csv2db/start | python -m json.tool
{
"batchStatus": "STARTING",
"createTime": 1508208762666,
"endTime": null,
"executionId": 3,
"exitStatus": null,
"href": "http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/jobexecutions/3",
"jobInstanceId": 3,
"jobName": "csv2db",
"jobParameters": null,
"lastUpdatedTime": 1508208762666,
"startTime": null
}
curl -s http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/jobexecutions/3 | python -m json.tool
{
"batchStatus": "COMPLETED",
"createTime": 1508208762666,
"endTime": 1508208763795,
"executionId": 3,
"exitStatus": "COMPLETED",
"href": "http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/jobexecutions/3",
"jobInstanceId": 3,
"jobName": "csv2db",
"jobParameters": null,
"lastUpdatedTime": 1508208763795,
"startTime": 1508208762669
}
curl -s http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/jobexecutions/3/stepexecutions | python -m json.tool
[
{
"batchStatus": "COMPLETED",
"endTime": 1508208762957,
"exitStatus": "[0, 100]",
"metrics": [
{
"type": "PROCESS_SKIP_COUNT",
"value": 0
},
{
"type": "READ_COUNT",
"value": 0
},
{
"type": "COMMIT_COUNT",
"value": 0
},
{
"type": "READ_SKIP_COUNT",
"value": 0
},
{
"type": "ROLLBACK_COUNT",
"value": 0
},
{
"type": "FILTER_COUNT",
"value": 0
},
{
"type": "WRITE_SKIP_COUNT",
"value": 0
},
{
"type": "WRITE_COUNT",
"value": 0
}
],
"startTime": 1508208762669,
"stepExecutionId": 5,
"stepName": "csv2db.step1"
},
{
"batchStatus": "COMPLETED",
"endTime": 1508208763795,
"exitStatus": "COMPLETED",
"metrics": [
{
"type": "PROCESS_SKIP_COUNT",
"value": 0
},
{
"type": "READ_COUNT",
"value": 100
},
{
"type": "COMMIT_COUNT",
"value": 11
},
{
"type": "READ_SKIP_COUNT",
"value": 0
},
{
"type": "ROLLBACK_COUNT",
"value": 0
},
{
"type": "FILTER_COUNT",
"value": 0
},
{
"type": "WRITE_SKIP_COUNT",
"value": 0
},
{
"type": "WRITE_COUNT",
"value": 100
}
],
"startTime": 1508208762957,
"stepExecutionId": 6,
"stepName": "csv2db.step2"
}
]
curl -s http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/jobexecutions/3/stepexecutions/6 | python -m json.tool
{
"batchStatus": "COMPLETED",
"endTime": 1508208763795,
"exitStatus": "COMPLETED",
"metrics": [
{
"type": "PROCESS_SKIP_COUNT",
"value": 0
},
{
"type": "READ_COUNT",
"value": 100
},
{
"type": "COMMIT_COUNT",
"value": 11
},
{
"type": "READ_SKIP_COUNT",
"value": 0
},
{
"type": "ROLLBACK_COUNT",
"value": 0
},
{
"type": "FILTER_COUNT",
"value": 0
},
{
"type": "WRITE_SKIP_COUNT",
"value": 0
},
{
"type": "WRITE_COUNT",
"value": 100
}
],
"startTime": 1508208762957,
"stepExecutionId": 6,
"stepName": "csv2db.step2"
}
curl -s -X POST -H 'Content-Type:application/json' http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/jobexecutions/3/stop | python -m json.tool
{
"message": "JBERET000612: Job execution 3 has batch status COMPLETED, and is not running.",
"stackTrace": "javax.batch.operations.JobExecutionNotRunningException: JBERET000612: Job execution 3 has batch status COMPLETED, and is not running....
"type": "javax.batch.operations.JobExecutionNotRunningException"
}
curl -s -X POST -H 'Content-Type:application/json' -d '{"jobName":"csv2db", "initialDelay":1, "interval":60}' http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/jobs/csv2db/schedule | python -m json.tool
{
"createTime": 1508209025899,
"id": "1",
"jobExecutionIds": [],
"jobScheduleConfig": {
"afterDelay": 0,
"initialDelay": 1,
"interval": 60,
"jobExecutionId": 0,
"jobName": "csv2db",
"jobParameters": null,
"persistent": false,
"scheduleExpression": null
},
"status": "SCHEDULED"
}
curl -s http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/schedules/ | python -m json.tool
[
{
"createTime": 1508209025899,
"id": "1",
"jobExecutionIds": [
4
],
"jobScheduleConfig": {
"afterDelay": 0,
"initialDelay": 1,
"interval": 60,
"jobExecutionId": 0,
"jobName": "csv2db",
"jobParameters": null,
"persistent": false,
"scheduleExpression": null
},
"status": "SCHEDULED"
}
]
curl -s -X POST -H 'Content-Type:application/json' http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/schedules/1/cancel | python -m json.tool
curl -s http://intro-jberet-cfang-p1.1d35.starter-us-east-1.openshiftapps.com/intro-jberet/api/schedules/ | python -m json.tool
[
{
"createTime": 1508209025899,
"id": "1",
"jobExecutionIds": [
4
],
"jobScheduleConfig": {
"afterDelay": 0,
"initialDelay": 1,
"interval": 60,
"jobExecutionId": 0,
"jobName": "csv2db",
"jobParameters": null,
"persistent": false,
"scheduleExpression": null
},
"status": "CANCELLED"
}
]

