public final class Job<T extends Keyed> extends Keyed<Job>
Jobs are Keyed
, because they need to Key to control e.g. atomic updates.
Jobs are generic on Keyed, because their primary result is a Keyed result - which is Not a Job. Obvious examples are Frames (from running Parse or CreateFrame jobs), or Models (from running ModelBuilder jobs).
Long running tasks will has-a Job, not is-a Job.
Modifier and Type | Class and Description |
---|---|
static class |
Job.JobCancelledException |
static class |
Job.JobStatus |
Modifier and Type | Field and Description |
---|---|
java.lang.String |
_description
User description
|
long |
_max_runtime_msecs |
Key<T> |
_result
Result Key
|
int |
_typeid |
long |
_work
Total expected work.
|
static Key<Job> |
LIST
A system key for global list of Job keys.
|
static long |
WORK_UNKNOWN |
Constructor and Description |
---|
Job(Key<Job> jobKey,
Key<T> resultKey,
java.lang.String clz_of_T,
java.lang.String desc,
boolean recoverable)
Create a Job
|
Job(Key<T> key,
java.lang.String clz_of_T,
java.lang.String desc)
Create a Job
|
Job(Key<T> key,
java.lang.String clz_of_T,
java.lang.String desc,
java.lang.String warningStr)
Create a Job when a warning already exists due to bad model_id
|
Modifier and Type | Method and Description |
---|---|
void |
blockingWaitForDone(long timeoutMillis)
Waits if necessary for at most the given time for the Job
to complete.
|
long |
end_time() |
java.lang.Throwable |
ex() |
void |
fail(java.lang.Throwable ex) |
T |
get()
Blocks until the Job completes
|
Job.JobStatus |
getStatus() |
long |
getWork() |
static boolean |
isCancelledException(java.lang.Throwable ex) |
boolean |
isCrashed() |
boolean |
isCrashing() |
boolean |
isDone() |
boolean |
isRecoverable() |
boolean |
isRunning() |
boolean |
isStopped() |
boolean |
isStopping() |
static Job[] |
jobs()
The list of all Jobs, past and present.
|
java.lang.Class<KeyV3.JobKeyV3> |
makeSchema() |
long |
msec()
Current runtime; zero if not started.
|
java.lang.String |
progress_msg()
Returns last progress message.
|
float |
progress()
Returns a float from 0 to 1 representing progress.
|
boolean |
readyForView() |
void |
setReadyForView(boolean ready) |
void |
setWarnings(java.lang.String[] warns) |
void |
setWork(long work)
Set the amount of work for this job - can only be called if job was started without work specification
|
long |
start_time() |
Job<T> |
start(H2O.H2OCountedCompleter fjtask,
long work)
Start this task based on given top-level fork-join task representing job computation.
|
Job<T> |
start(H2O.H2OCountedCompleter fjtask,
long work,
double max_runtime_secs) |
boolean |
stop_requested() |
void |
stop() |
static Job<?> |
tryGetDoneJob(Key<Job> key,
long timeMillis)
Tries to retrieve a completed Job from DKV.
|
void |
update(long newworked) |
static void |
update(long newworked,
Key<Job> jobkey) |
void |
update(long newworked,
java.lang.String msg)
Report new work done for this job
|
static void |
update(long newworked,
java.lang.String msg,
Key<Job> jobkey) |
void |
warn(java.lang.String warn) |
java.lang.String[] |
warns() |
checksum_impl, checksum_impl, checksum, checksum, getKey, readAll_impl, readAll, remove_impl, remove_impl, remove_self_key_impl, remove, remove, remove, remove, remove, remove, removeQuietly, writeAll_impl, writeAll
asBytes, clone, copyOver, frozenType, read, readExternal, readJSON, reloadFromBytes, toJsonBytes, toJsonString, write, writeExternal, writeJSON
public final int _typeid
public final java.lang.String _description
public long _work
public long _max_runtime_msecs
public static final long WORK_UNKNOWN
public Job(Key<Job> jobKey, Key<T> resultKey, java.lang.String clz_of_T, java.lang.String desc, boolean recoverable)
jobKey
- Key for this jobresultKey
- Key of the final resultclz_of_T
- String class of the Keyed resultdesc
- String descriptionrecoverable
- Boolean indicating that this job is recoverablepublic Job(Key<T> key, java.lang.String clz_of_T, java.lang.String desc)
key
- Key of the final resultclz_of_T
- String class of the Keyed resultdesc
- String descriptionpublic Job(Key<T> key, java.lang.String clz_of_T, java.lang.String desc, java.lang.String warningStr)
key
- Key of the final resultclz_of_T
- String class of the Keyed resultdesc
- String descriptionwarningStr
- String contains a warning on model_idpublic void warn(java.lang.String warn)
public void setWarnings(java.lang.String[] warns)
public long start_time()
public long end_time()
public boolean isRunning()
public boolean isStopped()
public boolean isStopping()
public boolean isDone()
public boolean isCrashing()
public boolean isCrashed()
public Job.JobStatus getStatus()
public long msec()
public boolean isRecoverable()
public boolean readyForView()
public void setReadyForView(boolean ready)
public boolean stop_requested()
public void stop()
public void fail(java.lang.Throwable ex)
public java.lang.Throwable ex()
public float progress()
public java.lang.String progress_msg()
public final void update(long newworked, java.lang.String msg)
public final void update(long newworked)
public java.lang.String[] warns()
public static Job[] jobs()
public final long getWork()
public final void setWork(long work)
public Job<T> start(H2O.H2OCountedCompleter fjtask, long work, double max_runtime_secs)
public Job<T> start(H2O.H2OCountedCompleter fjtask, long work)
fjtask
- top-level job computation task.work
- Amount of work to-do, for updating progress barisRunning()
stateH2O.H2OCountedCompleter
public static boolean isCancelledException(java.lang.Throwable ex)
public T get()
public java.lang.Class<KeyV3.JobKeyV3> makeSchema()
makeSchema
in class Keyed<Job>
public static Job<?> tryGetDoneJob(Key<Job> key, long timeMillis)
key
- job keytimeMillis
- timeout period in milliseconds, if job is still running it will wait
up to this amount of time for the job to finishpublic void blockingWaitForDone(long timeoutMillis)
timeoutMillis
- the maximum time in milliseconds to wait