Jobs Resource
Exposes operations at the job scope (as opposed to the cluster, container, or task scope). The initial implementation includes the ability to list all jobs, get the status of a particular job, and start or stop an individual job.
#API The following sections provide general information about the response structure and detailed descriptions of each of the requests.
Response Structure
All responses will contain either a job status or an error message.
Job Status
Job status will be of the form:
{
"status":"STOPPED",
"statusDetail":"KILLED",
"jobName":"wikipedia-parser",
"jobId":"1"
}
status
is the abstract Samza status for the job. Initially it will be one of {STARTING, STARTED, STOPPED, UNKNOWN}.
statusDetail
is the implementation-specific status for the job. For YARN, it will be one of the values in the YarnApplicationState enum.
Error Message
Every error response have the following structure:
{
"message": "Unrecognized status parameter: null"
}
message
is the only field in the response and contains a description of the problem.
##Get All Jobs Lists all the jobs installed on the host and provides their status.
######Request GET /v1/jobs
######Response Status: 200 OK
[
{
"status":"STOPPED",
"statusDetail":"KILLED",
"jobName":"wikipedia-parser",
"jobId":"1"
},
{
"status":"STARTED",
"statusDetail":"RUNNING",
"jobName":"wikipedia-feed",
"jobId":"1"
},
{
"status":"STOPPED",
"statusDetail":null,
"jobName":"wikipedia-stats",
"jobId":"1"
}
]
######Response codes
Status | Description |
---|---|
200 OK | The operation completed successfully and the current job status for each job is returned. |
500 Server Error | There was an error executing the command on the server. e.g. The command timed out.
|
##Get Job Gets the status of the specified job.
######Format
GET /v1/jobs/{jobName}/{jobId}
The {jobName}
and {jobId}
path parameters reflect the values of ‘job.name’ and ‘job.id’ in the job config.
######Request GET /v1/jobs/wikipedia-feed/1
######Response Status: 200 OK
{
"status":"STARTED",
"statusDetail":"RUNNING",
"jobName":"wikipedia-feed",
"jobId":"1"
}
######Response codes
Status | Description |
---|---|
200 OK | The operation completed successfully and the current job status is returned. |
404 Not Found | The specified job+instance was not found.
|
500 Server Error | There was an error executing the command on the server. e.g. The command timed out.
|
##Start Job Starts the job with the specified app name if it’s not already started. The command will return when it has initiated the start operation.
######Format PUT /v1/jobs/{jobName}/{jobId}?status=started
Form parameter status
is the intended status of the job at the end of the request.
######Example PUT /v1/jobs/wikipedia-feed/1?status=started ######Response Status: 202 Accepted
{
"status":"STARTING",
"statusDetail":"ACCEPTED",
"jobName": "wikipedia-feed",
"jobId": "1"
}
######Response codes
Status | Description |
---|---|
200 OK | The operation completed successfully and the current job status is returned. |
400 Bad Request | There was a problem with the request. e.g. an invalid status parameter.
|
404 Not Found | The specified job+instance was not found.
|
500 Server Error | There was an error executing the command on the server. e.g. The command timed out.
|
Status | Description |
---|---|
200 OK | The operation completed successfully and the current job status is returned. |
400 Bad Request | There was a problem with the request. e.g. an invalid status parameter.
|
404 Not Found | The specified job+instance was not found.
|
500 Server Error | There was an error executing the command on the server. e.g. The command timed out.
|
Name | Description |
---|---|
job.proxy.factory.class | Required: The Job Proxy Factory that will be used to create a Job Proxy to control the job. The value is a fully-qualified class name which must implement JobProxyFactory. Samza ships with one implementation: org.apache.samza.rest.proxy.job.SimpleYarnJobProxy SimpleInstallationRecordabstraction to interact with Samza jobs installed on disk. |
job.installations.path | Required: The file system path which contains the Samza job installations. The path must be on the same host as the Samza REST Service. Each installation must be a directory with structure conforming to the expectations of the InstallationRecord implementation used by the JobProxy. |
job.config.factory.class | The config factory to use for reading Samza job configs. This is used to fetch the job.name and job.id properties for each job instance in the InstallationRecord. It's also used to validate that a particular directory within the installations path actually contains Samza jobs. If not specified org.apache.samza.config.factories.PropertiesConfigFactorywill be used. |
yarn.resourcemanager.api.endpoint | An optional config if YARN is used as the cluster manager. This provides the host and port at which the YARN ResourceManager REST API is exposed. If not specified localhost:8088will be used. |