Package com.teracloud.streams.rest
Class Job
java.lang.Object
com.teracloud.streams.rest.Element
com.teracloud.streams.rest.Job
An object describing an Streams Job submitted within a specified instance
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
cancel()
Cancels this job.Gets the name of the streams processing application that this job is runningGets the health indicator for this jobgetId()
Gets the id of this jobGets the group this job belongs togetName()
Gets the name of this jobGets a list ofoperators
for this jobgetPes()
Gets a list ofprocessing elements
for this jobGets a list ofresource allocations
for this job.Identifies the REST resource typeIdentifies the user ID that started this jobDescribes the status of this jobGets the list ofparameters
that were submitted to this joblong
Gets the Epoch time when this job was submittedretrieveLogTrace
(File directory) Retrieves the application log and trace files of the job and saves them as a compressed tar file.void
waitForHealthy
(long timeout, TimeUnit unit) Wait for this job to become healthy.Methods inherited from class com.teracloud.streams.rest.Element
getStreamsConnection, refresh, toString
-
Constructor Details
-
Job
public Job()
-
-
Method Details
-
getOperators
Gets a list ofoperators
for this job- Returns:
- List of
Streams Operators
- Throws:
IOException
-
cancel
Cancels this job.- Returns:
- the result of the cancel method
- true if this job is cancelled
- false if this job still exists
- Throws:
IOException
Exception
-
getApplicationName
Gets the name of the streams processing application that this job is running- Returns:
- the application name
-
getHealth
Gets the health indicator for this job- Returns:
- the health indicator containing one of the following values:
- healthy
- partiallyHealthy
- partiallyUnhealthy
- unhealthy
- unknown
-
getId
Gets the id of this job- Returns:
- the job identifier
-
getJobGroup
Gets the group this job belongs to- Returns:
- the job group
-
getName
Gets the name of this job- Returns:
- the job name
-
getPes
Gets a list ofprocessing elements
for this job- Returns:
- List of
Processing Elements
- Throws:
IOException
-
getResourceAllocations
Gets a list ofresource allocations
for this job.- Returns:
- List of
resource allocations
- Throws:
IOException
- Since:
- 1.9
-
getResourceType
Identifies the REST resource type- Returns:
- "job"
-
getStartedBy
Identifies the user ID that started this job- Returns:
- the user ID that started this job
-
getStatus
Describes the status of this job- Returns:
- the job status that contains one of the following values:
- canceling
- running
- canceled
- unknown
-
getSubmitParameters
Gets the list ofparameters
that were submitted to this job- Returns:
- List of (@link JobSubmitParameters job submission parameters}
-
getSubmitTime
public long getSubmitTime()Gets the Epoch time when this job was submitted- Returns:
- the epoch time when the job was submitted as a long
-
waitForHealthy
public void waitForHealthy(long timeout, TimeUnit unit) throws TimeoutException, InterruptedException, IOException Wait for this job to become healthy.
When submitted a Streams job has to reach ahealthy
state before stream processing is started. During this startup time processing elements are started on resources and then connected. This method allows code to wait for the job to become healthy before using the REST api to monitor its elements.Note that a job may subsequently become unhealthy after this call returns due to failures of processing or resources.
- Parameters:
timeout
- Time to wait for the job to become healthy.unit
- Unit fortimeout
.- Throws:
TimeoutException
- Job did not become healthy in the time allowed.InterruptedException
- Thread was interrupted.IOException
- Error communicating with Streams.
-
retrieveLogTrace
Retrieves the application log and trace files of the job and saves them as a compressed tar file.
The resulting file name isjob_<id>_<timestamp>.tar.gz
whereid
is the job identifier andtimestamp
is the number of seconds since the Unix epoch, for examplejob_355_1511995995.tar.gz
.- Parameters:
directory
- a valid directory in which to save the archive. Defaults to the current directory.- Returns:
- File obhject representing the created tar file, or
null
if retrieving a job's logs is not supported in the version of Streams to which the job is submitted. - Throws:
IOException
- Since:
- 1.11
-