Creates a new subtask and adds it to the parent task. Returns the full record
for the newly created subtask.

@param  task The task to add a subtask to.
@return Request object
345600
public ItemRequest<Task> addSubtask(String task) {
    
        String path = String.format("/tasks/%s/subtasks", task);
        return new ItemRequest<Task>(this, Task.class, path, "POST");
    }
241523
public final int addChild (Task<E> child) {
		int index = addChildToTask(child);
		if (tree != null && tree.listeners != null) tree.notifyChildAdded(this, index);
		return index;
	}
1019422
public static void processTask(Task task) {
    logger.finest("Processing task " + task);
    try {
      switch (task.getType()) {
        case RUN_JOB:
          runJob((RunJobTask) task);
          break;
        case HANDLE_SLOT_FILLED:
          handleSlotFilled((HandleSlotFilledTask) task);
          break;
        case FINALIZE_JOB:
          finalizeJob((FinalizeJobTask) task);
          break;
        case FAN_OUT:
          handleFanoutTaskOrAbandonTask((FanoutTask) task);
          break;
        case CANCEL_JOB:
          cancelJob((CancelJobTask) task);
          break;
        case DELETE_PIPELINE:
          DeletePipelineTask deletePipelineTask = (DeletePipelineTask) task;
          try {
            backEnd.deletePipeline(
                deletePipelineTask.getRootJobKey(), deletePipelineTask.shouldForce(), false);
          } catch (Exception e) {
            logger.log(Level.WARNING, "DeletePipeline operation failed.", e);
          }
          break;
        case HANDLE_CHILD_EXCEPTION:
          handleChildException((HandleChildExceptionTask) task);
          break;
        case DELAYED_SLOT_FILL:
          handleDelayedSlotFill((DelayedSlotFillTask) task);
          break;
        default:
          throw new IllegalArgumentException("Unrecognized task type: " + task.getType());
      }
    } catch (AbandonTaskException ate) {
      // return 200;
    }
  }
1231529
private TaskRecord storeTaskRecord(Tenant tenant, Task task) {
        DBTransaction dbTran = DBService.instance(tenant).startTransaction();
        TaskRecord taskRecord = new TaskRecord(task.getTaskID());
        Map<String, String> propMap = taskRecord.getProperties();
        assert propMap.size() > 0 : "Need at least one property to store a row!";
        for (String propName : propMap.keySet()) {
            dbTran.addColumn(TaskManagerService.TASKS_STORE_NAME, task.getTaskID(), propName, propMap.get(propName));
        }
        DBService.instance(tenant).commit(dbTran);
        return taskRecord;
    }
672170
public static <T> CombinedDownloadTask<T> single(DownloadTask<T> task) {
		Objects.requireNonNull(task);
		return new SingleCombinedTask<T>(task);
	}
993197
function Task(entry) {
  if (!(this instanceof Task)) {
    return new Task(entry);
  }

  this.called = 0;
  this.now = this.calledAt = hrTime();

  if (resolutionDivisor !== DEFAULT_RESOLUTION) {
    entry.time = ~~(entry.time * (DEFAULT_RESOLUTION / resolutionDivisor));
  }

  // Side table property definitions
  this.isRunnable = true;
  this.later = this.now + entry.time;
  this.task = entry.task;
  this.type = entry.type;
  this.time = entry.time;

  if (this.later > gLast) {
    gLast = this.later;
  }

  if (!queue[this.later]) {
    queue[this.later] = [];
  }
  // console.log( entry.later, this );
  queue[this.later].push(this);
}
262349
public function create(Task $task): Task
    {
        $response = $this->client->post($this->prepareUrlForKey('add-task'), [], $task->jsonSerialize());
        $responseData = $response->getDecodedBody();

        return new Task($responseData);
    }
568691
@Override
    public void create(TaskRecord taskRecord) throws Exception {
        Task task = new Task(taskRecord);
        EntityManager em = getPersistenceServiceUnit().createEntityManager();
        try {
            em.persist(task);
            em.flush();
            taskRecord.setId(task.ID);
        } finally {
            em.close();
        }
    }
1256022
public static JoinPoint<Exception> fromTasks(Task<?,?>... tasks) {
		JoinPoint<Exception> jp = new JoinPoint<>();
		for (Task<?,?> task : tasks) jp.addToJoin(task.getOutput());
		jp.start();
		return jp;
	}
1344365
@Override
    public final TaskProcessor create(Task task)
        throws TaskProcessorCreationFailedException {
        if (isSupported(task)) {
            log.debug("creating task processor for " + task);
            AuditTask auditTask = new AuditTask();
            auditTask.readTask(task);
            return createImpl(auditTask);
        }

        throw new TaskProcessorCreationFailedException("Task is not an Audit task");

    }
473418
public int addTask(Task task, Object remoteTask)
    {
        if (m_taskMain == null)
        {
            if (task != null)
                if (task.isMainTaskCandidate())
                    m_taskMain = task;
        }
        m_mapTasks.put(task, (RemoteTask)remoteTask);
        return m_mapTasks.size();
    }
1276265
public static function create(Task $task, $name, $weight = 1, $backup = false, \Closure $work = null)
    {
        return new self($task, $name, $weight, $backup, $work);
    }
858215
@Override
    protected TaskProcessor createImpl(Task task) throws TaskProcessorCreationFailedException {

        try {
            BitIntegrityCheckReportTask bitTask = new BitIntegrityCheckReportTask();
            bitTask.readTask(task);
            String account = bitTask.getAccount();
            StorageProviderCredentials credentials =
                getCredentialRepo().getStorageProviderCredentials(account, bitTask.getStoreId());
            StorageProvider store = storageProviderFactory.create(credentials);
            StorageProviderType storageProviderType = credentials.getProviderType();

            return new SpaceComparisonTaskProcessor(bitTask,
                                                    bitLogStore,
                                                    manifestStore,
                                                    store,
                                                    storageProviderType);
        } catch (Exception e) {
            log.error("failed to create TaskProcessor: " + e.getMessage(), e);
            throw new TaskProcessorCreationFailedException("failed to create TaskProcessor: ", e);
        }
    }
866018
public <TContinuationResult> Task<TContinuationResult> onSuccessTask(
      final Continuation<TResult, Task<TContinuationResult>> continuation) {
    return onSuccessTask(continuation, IMMEDIATE_EXECUTOR);
  }
642875
protected BAMTaskSummaryImpl createOrUpdateTask(TaskEvent event, Status newStatus) {
        return updateTask(event, newStatus, null);
    }
589036
public CollectionRequest<Story> findByTask(String task) {
    
        String path = String.format("/tasks/%s/stories", task);
        return new CollectionRequest<Story>(this, Story.class, path, "GET");
    }
967698
public void add(Task task) {
    	synchronized(LOCK) {
    		//terminated task will be selected immediately before start
    		task.setListener(this);
        
    		this.task[wi] = task;        
        
    		wi++;
    	}
    }