Generates a new task ID.
426194
@Override
	public Protos.TaskID newTaskID() throws Exception {
		synchronized (startStopLock) {
			verifyIsRunning();

			int nextCount;
			boolean success;
			do {
				ZooKeeperVersionedValue<Integer> count = totalTaskCountInZooKeeper.getVersionedValue();
				nextCount = count.getValue() + 1;
				success = totalTaskCountInZooKeeper.trySetCount(count, nextCount);
			}
			while (!success);

			Protos.TaskID taskID = Protos.TaskID.newBuilder().setValue(TASKID_FORMAT.format(nextCount)).build();
			return taskID;
		}
	}
152283
def serialize_task_id(self):
        
        return "{}@{}".format(
            self._identification[TASK_UUID_FIELD],
            self._nextTaskLevel().toString()).encode("ascii")
1107163
def generate_identifier(result):
    
    # Determine the playbook file path to use for the ID
    if result.task.playbook and result.task.playbook.path:
        playbook_file = result.task.playbook.path
    else:
        playbook_file = ''
    play_path = u'%s.%s' % (playbook_file, result.task.play.name)

    # Determine the task file path to use for the ID
    if result.task.file and result.task.file.path:
        task_file = result.task.file.path
    else:
        task_file = ''
    task_path = u'%s.%s' % (task_file, result.task.name)

    # Combine both of the above for a full path
    identifier_path = u'%s.%s' % (play_path, task_path)

    # Assign the identifier as a hash of the fully unique path.
    identifier = hashlib.sha1(encodeutils.to_utf8(identifier_path)).hexdigest()

    return identifier
381263
async def run_gen_task(self, container, gentask, newthread = True):
        ""
        e = TaskEvent(self, gen_task = gentask, newthread = newthread)
        await container.wait_for_send(e)
        ev = await TaskDoneEvent.createMatcher(e)
        if hasattr(ev, 'exception'):
            raise ev.exception
        else:
            return ev.result
40133
public function save() {
    if ($this->id) {
      return self::update($this->id, $this);
    }
    else {
      $new = self::create($this);
      $this->task_id = $new->task_id;
      return $this;
    }
  }
125685
private TaskID maskTaskID(TaskID taskId) {
    JobID jobId = new JobID();
    return new TaskID(jobId, taskId.isMap(), taskId.getId());
  }
470754
public String start(String taskId) {
        long now = System.currentTimeMillis();
        return insert("INSERT INTO TaskLogs (taskId, resultType, startDate) VALUES (?, ?, ?)",
                Integer.parseInt(taskId), TaskLog.INCOMPLETE, now);
    }
390112
def delete(self, task_id):
    """"""
    if isinstance(task_id, RegisteredTask):
      task_id = task_id.id

    def cloud_delete(api):
      api.delete(task_id)

    if len(self._threads):
      self.put(cloud_delete)
    else:
      cloud_delete(self._api)

    return self
934493
def _append_task(t):
    
    task_queue = _get_task_queue()
    if t not in task_queue:
        log.debug('Appended new task to the queue: %s.', t)
        task_queue.append(t)
    else:
        log.debug('Did not append duplicate task to the queue: %s.', t)
    return None
1059594
def generate_data_for_registered_problem(problem_name):
  """"""
  tf.logging.info("Generating data for %s.", problem_name)
  if FLAGS.num_shards:
    raise ValueError("--num_shards should not be set for registered Problem.")
  problem = registry.problem(problem_name)
  task_id = None if FLAGS.task_id < 0 else FLAGS.task_id
  data_dir = os.path.expanduser(FLAGS.data_dir)
  tmp_dir = os.path.expanduser(FLAGS.tmp_dir)
  if task_id is None and problem.multiprocess_generate:
    if FLAGS.task_id_start != -1:
      assert FLAGS.task_id_end != -1
      task_id_start = FLAGS.task_id_start
      task_id_end = FLAGS.task_id_end
    else:
      task_id_start = 0
      task_id_end = problem.num_generate_tasks
    pool = multiprocessing.Pool(processes=FLAGS.num_concurrent_processes)
    problem.prepare_to_generate(data_dir, tmp_dir)
    args = [(problem_name, data_dir, tmp_dir, task_id)
            for task_id in range(task_id_start, task_id_end)]
    pool.map(generate_data_in_process, args)
  else:
    problem.generate_data(data_dir, tmp_dir, task_id)
791781
public void logMessageForTask(String taskId, String logMessage) {
        Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "Task id cannot be blank");
        stub.addLog(
                TaskServicePb.AddLogRequest.newBuilder()
                        .setTaskId(taskId)
                        .setLog(logMessage)
                        .build()
        );
    }
1234216
def add_task(self, task, parent_task_result):
        
        self.tasks.append((task, parent_task_result))
        self.task_id_to_task[task.id] = task
458258
function generate_id (args, done) {
  var actnid
  var length = args.length || 6

  if (length < 65) {
    actnid = nids[length] || (nids[length] = Nid({length: length}))
  }
  else {
    actnid = Nid({length: length})
  }

  done(null, actnid())
}
276356
public int createTask(TaskCreate task, boolean silent, boolean hook) {
		TaskCreateResponse response = getResourceFactory()
				.getApiResource("/task/")
				.queryParam("silent", silent ? "1" : "0")
				.queryParam("hook", hook ? "1" : "0")
				.entity(task, MediaType.APPLICATION_JSON_TYPE)
				.post(TaskCreateResponse.class);

		return response.getId();
	}
76592
public Task getTaskDetails(String taskId) {
        Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "Task id cannot be blank");
        return protoMapper.fromProto(
                stub.getTask(TaskServicePb.GetTaskRequest.newBuilder()
                        .setTaskId(taskId)
                        .build()
                ).getTask()
        );
    }
254545
void createTaskEntry(TaskAttemptID taskid, String taskTracker, TaskInProgress tip) {
    LOG.info("Adding task (" + tip.getAttemptType(taskid) + ") " +
      "'"  + taskid + "' to tip " +
      tip.getTIPId() + ", for tracker '" + taskTracker + "'");

    // taskid --> tracker
    taskidToTrackerMap.put(taskid, taskTracker);

    // tracker --> taskid
    Set<TaskAttemptIDWithTip> taskset = trackerToTaskMap.get(taskTracker);
    if (taskset == null) {
      taskset = new HashSet<TaskAttemptIDWithTip>();
      trackerToTaskMap.put(taskTracker, taskset);
    }
    taskset.add(new TaskAttemptIDWithTip(taskid, tip));

    // taskid --> TIP
    taskidToTIPMap.put(taskid, tip);

  }
354068
def _add_task(self, *args, **kwargs):
        
        task_id = kwargs['task_id']
        status = kwargs['status']
        runnable = kwargs['runnable']
        task = self._scheduled_tasks.get(task_id)
        if task:
            self._add_task_history.append((task, status, runnable))
            kwargs['owners'] = task._owner_list()

        if task_id in self._batch_running_tasks:
            for batch_task in self._batch_running_tasks.pop(task_id):
                self._add_task_history.append((batch_task, status, True))

        if task and kwargs.get('params'):
            kwargs['param_visibilities'] = task._get_param_visibilities()

        self._scheduler.add_task(*args, **kwargs)

        logger.info('Informed scheduler that task   %s   has status   %s', task_id, status)