Append last task to task history.
165933
def get_task_history(last_task):
    """"""
    if hasattr(last_task, 'branch') and last_task.branch:
        return
    elif hasattr(last_task, 'hide') and last_task.hide:
        return
    else:
        return get_func_info(last_task)
632485
private static void appendTaskStateValues(List<TaskState> taskStates, StringBuffer sb, String key) {
    // Add task failure messages in a group followed by task failure exceptions
    for (TaskState taskState : taskStates) {
      if (taskState.contains(key)) {
        if (sb.length() != 0) {
          sb.append(",");
        }
        sb.append(taskState.getProp(key));
      }
    }
  }
922925
def save_task_info(self, res, mem_gb=0):
    
    mon = res.mon
    name = mon.operation[6:]  # strip 'total '
    if self.hdf5:
        mon.hdf5 = self.hdf5  # needed for the flush below
        t = (mon.task_no, mon.weight, mon.duration, len(res.pik), mem_gb)
        data = numpy.array([t], task_info_dt)
        hdf5.extend3(self.hdf5.filename, 'task_info/' + name, data,
                     argnames=self.argnames, sent=self.sent)
    mon.flush()
1251052
private void addReduceTask(TaskTracker taskTracker, List<Task> tasks,
                                  int maxReduceSlots, int currentReduceSlots) 
                    throws IOException {
    if (maxReduceSlots > currentReduceSlots) {
      reduceScheduler.updateCollectionOfQSIs();
      TaskLookupResult tlr = reduceScheduler.assignTasks(taskTracker);
      if (TaskLookupResult.LookUpStatus.TASK_FOUND == tlr.getLookUpStatus()) {
        tasks.add(tlr.getTask());
      }
    }
  }
1328754
protected boolean completeAppend(boolean succeeded, long lastLogIndex, CompletableFuture<AppendResponse> future) {
    future.complete(logResponse(AppendResponse.builder()
        .withStatus(RaftResponse.Status.OK)
        .withTerm(raft.getTerm())
        .withSucceeded(succeeded)
        .withLastLogIndex(lastLogIndex)
        .build()));
    return succeeded;
  }
567740
def join(self):
        """"""
        self._root_state.join()
        # execution finished, close execution history log file (if present)
        if len(self._execution_histories) > 0:
            if self._execution_histories[-1].execution_history_storage is not None:
                set_read_and_writable_for_all = global_config.get_config_value("EXECUTION_LOG_SET_READ_AND_WRITABLE_FOR_ALL", False)
                self._execution_histories[-1].execution_history_storage.close(set_read_and_writable_for_all)
        from rafcon.core.states.state import StateExecutionStatus
        self._root_state.state_execution_status = StateExecutionStatus.INACTIVE
1249685
def apply_async(self, entry, **kwargs):
        ''''''
        result = super(Scheduler, self).apply_async(entry, **kwargs)
        entry._task.last_run_id = result.id
        return result
872168
private void updateLastMapLocalityLevel(JobInProgress job,
      Task mapTaskLaunched, TaskTrackerStatus tracker) {
    JobInfo info = infos.get(job);
    LocalityLevel localityLevel = localManager.taskToLocalityLevel(
        job, mapTaskLaunched, tracker);
    info.lastMapLocalityLevel = localityLevel;
    info.timeWaitedForLocalMap = 0;
  }
286086
public void markTaskCompletion() {
    if (this.countDownLatch.isPresent()) {
      this.countDownLatch.get().countDown();
    }

    this.taskState.setProp(ConfigurationKeys.TASK_RETRIES_KEY, this.retryCount.get());
  }
138454
def idle_task(self):
        ''''''
        if self.download_last_timestamp is not None and time.time() - self.download_last_timestamp > 0.7:
            self.download_last_timestamp = time.time()
            self.handle_log_data_missing()
570454
def on_batch_end(self, train, **kwargs):
        ""
        if train: self.stats.append(self.hooks.stored)
650589
def add_tasks(config, tasks_file, tasks_type, priority, redundancy):
    """"""
    res = _add_tasks(config, tasks_file, tasks_type, priority, redundancy)
    click.echo(res)
843079
def idle_task(self):
        ''''''
        now = time.time()
        time_delta = now - self.last_calc
        if time_delta > 1:
            self.last_calc = now
            self.buckets.append(self.counts)
            self.counts = {}
            if len(self.buckets) > self.max_buckets:
                self.buckets = self.buckets[-self.max_buckets:]
1116527
def to_task(self):
        """"""
        from google.appengine.api.taskqueue import Task
        from google.appengine.api.taskqueue import TaskRetryOptions

        self._increment_recursion_level()
        self.check_recursion_depth()

        url = "%s/%s" % (ASYNC_ENDPOINT, self.function_path)

        kwargs = {
            'url': url,
            'headers': self.get_headers().copy(),
            'payload': json.dumps(self.to_dict())
        }
        kwargs.update(copy.deepcopy(self.get_task_args()))

        # Set task_retry_limit
        retry_options = copy.deepcopy(DEFAULT_RETRY_OPTIONS)
        retry_options.update(kwargs.pop('retry_options', {}))
        kwargs['retry_options'] = TaskRetryOptions(**retry_options)

        return Task(**kwargs)
1161041
function(cb, thisArg) {
      var lastTask = this;
      while (lastTask.afterTask_)
        lastTask = lastTask.afterTask_;
      return lastTask.after(cb, thisArg);
    }
106340
public void saveTaskUpdateForRetry(SingularityTaskHistoryUpdate taskHistoryUpdate) {
    String parentPath = ZKPaths.makePath(SNS_TASK_RETRY_ROOT, taskHistoryUpdate.getTaskId().getRequestId());
    if (!isChildNodeCountSafe(parentPath)) {
      LOG.warn("Too many queued webhooks for path {}, dropping", parentPath);
      return;
    }
    String updatePath = ZKPaths.makePath(SNS_TASK_RETRY_ROOT, taskHistoryUpdate.getTaskId().getRequestId(), getTaskHistoryUpdateId(taskHistoryUpdate));
    save(updatePath, taskHistoryUpdate, taskHistoryUpdateTranscoder);
  }
1176198
def on_epoch_end(self, last_metrics, **kwargs):
        ""
        return add_metrics(last_metrics, self.val/self.count)