Interface GorJob


  • public interface GorJob
    • Method Detail

      • getStatus

        JobStatus getStatus()
        Get job status
        Returns:
        Status
      • waitFor

        default boolean waitFor​(boolean giveUp,
                                JobMonitor monitor,
                                java.time.Duration jobRetention)
                         throws java.lang.InterruptedException
        Wait for job completion.
        Parameters:
        giveUp - If true, throw exception if failed/timeout
        monitor - to receive callbacks
        jobRetention - how long can the job live.
        Returns:
        true if job completed successfully,false if failure or timeout
        Throws:
        java.lang.InterruptedException - if interrupted
      • waitFor

        boolean waitFor​(int count,
                        int periodMs,
                        boolean giveUp,
                        JobMonitor monitor)
                 throws java.lang.InterruptedException
        Wait for job completion
        Parameters:
        count - Number of periods
        periodMs - Period length in ms
        giveUp - If true, throw exception if failed/timeout
        monitor - Monitor to receive callbacks
        Returns:
        true if job completed successfully,false if failure or timeout
        Throws:
        java.lang.InterruptedException - if interrupted
      • cancel

        void cancel()
        Signal job for cancel
      • isCancelling

        boolean isCancelling()
        Check if job is cancelling.
        Returns:
        true if job is cancelling (cancel has been called but the status is not yet CANCELLED), false otherwise.
      • getProgress

        int getProgress()
        Get job progress (0..100)
        Returns:
        progress
      • getResult

        java.lang.String getResult()
        Get job result
        Returns:
        result or null if none
      • getError

        java.lang.String getError()
        Get error message
        Returns:
        Error message or null if none
      • getClientJobId

        java.lang.String getClientJobId()
        Get client job id (unique across multiple clusters)
        Returns:
        client job id. Base64 encode job url redis uri/jobid
      • getJobId

        java.lang.String getJobId()
        Get job id (cluster unique)
        Returns:
        Job id
      • getSubmitTimestamp

        long getSubmitTimestamp()
        Get submit timestamp
        Returns:
        submit timestamp
      • getExpirationTimestamp

        long getExpirationTimestamp()
        Get expiration timestamp
        Returns:
        expiration timestamp
      • hasSubmitTimestamp

        boolean hasSubmitTimestamp()
        Check if this gorjob has a submit timestamp
        Returns:
        true if there is a submit timestamp
      • hasExpirationTimestamp

        boolean hasExpirationTimestamp()
        Check if this gorjob has an expiration timestamp
        Returns:
        true if there is an expiration timestamp
      • getQuery

        GorQuery getQuery()
        Get the job query. TODO: This is the only GOR specific method on this interface, but it is called GorJob. Maybe we should move this method to child class of ResqueJob (which is child of this job).
        Returns:
        the query.
      • toMap

        java.util.Map<java.lang.String,​java.lang.String> toMap()
        Convert job data to map
        Returns:
        map