Teracloud Streams Job Life Cycle
You can submit a job by uploading the Streams application bundle from the client or you can provide a URL to the application bundle. When you submit the job, the request does not return until the submission process completes.
- Upload application bundle from client
With this option, you first call the POST method on https://host:port/streams/instances/{instanceId}/applicationbundles, passing the application bundle to upload. This method copies the bundle to the Streams server and returns an application bundle identifier for the uploaded bundle. Next, you submit the job by calling the POST method on https://host:port/streams/instances/{instanceId}/jobs, passing the value of thebundleId
property from the previous call as the value ofapplication
property on this call.
curl -X POST "https://host:port/streams/instances/{instanceId}/applicationbundles" -H "accept: application/json" -H "Content-Type: application/x-jar" --data-binary "@sample.sab"
curl -X POST "https://host:port/streams/instances/{instanceId}/jobs" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"application\":\"bundleId:87764a40c0c0fc071dc9fe75264eba36648fd458b231ab39476f3636\"}"
- Provide URL to application bundle on server
With this option, you make a single call to the POST method on https://host:port/streams/instances/{instanceId}/jobs, passing the URL to the application bundle to run as the value of theapplication
property. If the host serving the application bundle is secured, also provide the required credentials as the value of theapplicationCredentials
property.
curl -X POST "https://host:port/streams/instances/{instanceId}/jobs" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"application\":\"https://myserver.com/sample.sab\"}"
You can monitor the status of your running jobs using:
curl -X GET "https://host:port/streams/instances/{instanceId}/jobs" -H "accept: application/json"
You can make changes to a job using the update operators API. For example, to update the width of a parallel region:
curl -X PATCH 'https://host:port/streams/instances/{instanceId}/jobs/{jobId}' -H 'Content-Type: application/json' -H 'Accept: application/json' --data '{"jobConfigurationOverlay" : {"jobConfigOverlays": [{"configInstructions": {"adjustmentSection": [{"targetParallelRegion": {"regionName": "TransformedData", "newWidth": 5}}]}}]}}'
To end a job, the cancel job API can be used:
curl -X DELETE "https://host:port/streams/instances/{instanceId}/jobs/{jobId}"