Package org.gorpipe.spark.platform
Interface GorJob
public interface GorJob
-
Method Summary
Modifier and Type Method Description voidcancel()Signal job for canceljava.lang.StringgetClientJobId()Get client job id (unique across multiple clusters)java.lang.StringgetError()Get error messagelonggetExpirationTimestamp()Get expiration timestampjava.lang.StringgetJobId()Get job id (cluster unique)intgetProgress()Get job progress (0..100)GorQuerygetQuery()Get the job query.java.lang.StringgetResult()Get job resultJobStatusgetStatus()Get job statuslonggetSubmitTimestamp()Get submit timestampbooleanhasExpirationTimestamp()Check if this gorjob has an expiration timestampbooleanhasSubmitTimestamp()Check if this gorjob has a submit timestampbooleanisCancelling()Check if job is cancelling.java.util.Map<java.lang.String,java.lang.String>toMap()Convert job data to mapdefault booleanwaitFor(boolean giveUp, JobMonitor monitor, java.time.Duration jobRetention)Wait for job completion.booleanwaitFor(int count, int periodMs, boolean giveUp, JobMonitor monitor)Wait for job completion
-
Method Details
-
getStatus
JobStatus getStatus()Get job status- Returns:
- Status
-
waitFor
default boolean waitFor(boolean giveUp, JobMonitor monitor, java.time.Duration jobRetention) throws java.lang.InterruptedExceptionWait for job completion.- Parameters:
giveUp- If true, throw exception if failed/timeoutmonitor- to receive callbacksjobRetention- 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.InterruptedExceptionWait for job completion- Parameters:
count- Number of periodsperiodMs- Period length in msgiveUp- If true, throw exception if failed/timeoutmonitor- 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
-