예제 #1
0
파일: Job.java 프로젝트: chouclee/h2o
 /**
  * Start this task based on given top-level fork-join task representing job computation.
  *
  * @param fjtask top-level job computation task.
  * @return this job in {@link JobState#RUNNING} state
  * @see JobState
  * @see H2OCountedCompleter
  */
 public
 /** FIXME: should be final or at least protected */
 Job start(final H2OCountedCompleter fjtask) {
   assert state == JobState.CREATED : "Trying to run job which was already run?";
   assert fjtask != null : "Starting a job with null working task is not permitted! Fix you API";
   _fjtask = fjtask;
   start_time = System.currentTimeMillis();
   state = JobState.RUNNING;
   // Save the full state of the job
   UKV.put(self(), this);
   // Update job list
   new TAtomic<List>() {
     @Override
     public List atomic(List old) {
       if (old == null) old = new List();
       Key[] jobs = old._jobs;
       old._jobs = Arrays.copyOf(jobs, jobs.length + 1);
       old._jobs[jobs.length] = job_key;
       return old;
     }
   }.invoke(LIST);
   return this;
 }
예제 #2
0
파일: Job.java 프로젝트: chouclee/h2o
 /**
  * Returns job execution time in milliseconds. If job is not running then returns job execution
  * time.
  */
 public final long runTimeMs() {
   long until = end_time != 0 ? end_time : System.currentTimeMillis();
   return until - start_time;
 }
예제 #3
0
파일: Job.java 프로젝트: chouclee/h2o
 /** Marks job as finished and records job end time. */
 public void remove() {
   end_time = System.currentTimeMillis();
   if (state == JobState.RUNNING) state = JobState.DONE;
   // Overwrite handle - copy end_time, state, msg
   replaceByJobHandle();
 }