Class Job


public class Job extends Element
An object describing an Streams Job submitted within a specified instance
  • Constructor Details

    • Job

      public Job()
  • Method Details

    • getOperators

      public List<Operator> getOperators() throws IOException
      Gets a list of operators for this job
      Returns:
      List of Streams Operators
      Throws:
      IOException
    • cancel

      public boolean cancel() throws Exception, IOException
      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

      public String getApplicationName()
      Gets the name of the streams processing application that this job is running
      Returns:
      the application name
    • getHealth

      public String getHealth()
      Gets the health indicator for this job
      Returns:
      the health indicator containing one of the following values:
      • healthy
      • partiallyHealthy
      • partiallyUnhealthy
      • unhealthy
      • unknown
    • getId

      public String getId()
      Gets the id of this job
      Returns:
      the job identifier
    • getJobGroup

      public String getJobGroup()
      Gets the group this job belongs to
      Returns:
      the job group
    • getName

      public String getName()
      Gets the name of this job
      Returns:
      the job name
    • getPes

      public List<ProcessingElement> getPes() throws IOException
      Gets a list of processing elements for this job
      Returns:
      List of Processing Elements
      Throws:
      IOException
    • getResourceAllocations

      public List<ResourceAllocation> getResourceAllocations() throws IOException
      Gets a list of resource allocations for this job.
      Returns:
      List of resource allocations
      Throws:
      IOException
      Since:
      1.9
    • getResourceType

      public String getResourceType()
      Identifies the REST resource type
      Returns:
      "job"
    • getStartedBy

      public String getStartedBy()
      Identifies the user ID that started this job
      Returns:
      the user ID that started this job
    • getStatus

      public String getStatus()
      Describes the status of this job
      Returns:
      the job status that contains one of the following values:
      • canceling
      • running
      • canceled
      • unknown
    • getSubmitParameters

      public List<JobSubmitParameters> getSubmitParameters()
      Gets the list of parameters 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 a healthy 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 for timeout.
      Throws:
      TimeoutException - Job did not become healthy in the time allowed.
      InterruptedException - Thread was interrupted.
      IOException - Error communicating with Streams.
    • retrieveLogTrace

      public File retrieveLogTrace(File directory) throws IOException
      Retrieves the application log and trace files of the job and saves them as a compressed tar file.
      The resulting file name is job_<id>_<timestamp>.tar.gz where id is the job identifier and timestamp is the number of seconds since the Unix epoch, for example job_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