Updates the task manager to reflect the task is processing.

    Args:
      task_identifier (str): unique identifier of the task.

    Raises:
      KeyError: if the task is not known to the task manager.
432677
def UpdateTaskAsProcessingByIdentifier(self, task_identifier):
    
    with self._lock:
      task_processing = self._tasks_processing.get(task_identifier, None)
      if task_processing:
        task_processing.UpdateProcessingTime()
        self._UpdateLatestProcessingTime(task_processing)
        return

      task_queued = self._tasks_queued.get(task_identifier, None)
      if task_queued:
        logger.debug('Task {0:s} was queued, now processing.'.format(
            task_identifier))
        self._tasks_processing[task_identifier] = task_queued
        del self._tasks_queued[task_identifier]

        task_queued.UpdateProcessingTime()
        self._UpdateLatestProcessingTime(task_queued)
        return

      task_abandoned = self._tasks_abandoned.get(task_identifier, None)
      if task_abandoned:
        del self._tasks_abandoned[task_identifier]
        self._tasks_processing[task_identifier] = task_abandoned
        logger.debug('Task {0:s} was abandoned, but now processing.'.format(
            task_identifier))

        task_abandoned.UpdateProcessingTime()
        self._UpdateLatestProcessingTime(task_abandoned)
        return

      if task_identifier in self._tasks_pending_merge:
        # No need to update the processing time, as this task is already
        # finished processing and is just waiting for merge.
        return

    # If we get here, we don't know what state the tasks is in, so raise.
    raise KeyError('Status of task {0:s} is unknown.'.format(task_identifier))
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
42385
def get_task_indicator(self, task_level=None):
        
        if task_level is None:
            task_level = len(self.tasks)
        return self.TASK_INDICATORS[task_level % len(self.TASK_INDICATORS)]
928218
def PopTask(self):
    
    try:
      _, task = heapq.heappop(self._heap)

    except IndexError:
      return None
    self._task_identifiers.remove(task.identifier)
    return task
882041
private void updateTaskStatuses(TaskTrackerStatus status) {
    TaskTrackerInfo trackerInfo = TaskTrackerInfo.fromStatus(status);
    String trackerName = status.getTrackerName();
    for (TaskStatus report : status.getTaskReports()) {
      // Ensure that every report has information about task tracker
      report.setTaskTracker(trackerName);
      LOG.debug("Task status report: " + report);
      updateTaskStatus(trackerInfo, report);
      // Take any actions outside updateTaskStatus()
      setupReduceRequests(job);
      processFetchFailures(report);
    }
  }
402662
def RemoveProcessedTaskStorage(self, task):
    
    if task.identifier not in self._task_storage_writers:
      raise IOError('Storage writer for task: {0:s} does not exist.'.format(
          task.identifier))

    del self._task_storage_writers[task.identifier]
487267
def put_info(self, key, value):
        
        return self.instance.put_task_info(self.name, key, value)
14339
def task(self, task_uuid):
        
        request = clearly_pb2.FindTaskRequest(task_uuid=task_uuid)
        task = self._stub.find_task(request)
        if task.uuid:
            ClearlyClient._display_task(task, True, True, True)
        else:
            print(EMPTY)
150204
def add_identifier(self, name, obj):
        

        name = str(name)
        self._known_identifiers[name] = obj
271000
async def addSignalHandlers(self):
        '''
        
        '''

        def sigterm():
            print('Caught SIGTERM, shutting down.')
            asyncio.create_task(self.fini())

        def sigint():
            print('Caught SIGINT, shutting down.')
            asyncio.create_task(self.fini())

        loop = asyncio.get_running_loop()
        loop.add_signal_handler(signal.SIGINT, sigint)
        loop.add_signal_handler(signal.SIGTERM, sigterm)
545699
def queue(self, *args, **kwargs):
        
        self.scraper.task_manager.put(self, args, kwargs)
        return self
1327962
def _update_record(self, identifier, rtype=None, name=None, content=None):
        
        result = False

        # TODO: some providers allow content-based updates without supplying an
        # ID, and therefore `identifier` is here optional. If we don't receive
        # an ID, look it up.
        if not identifier and rtype and name:
            records = self._list_records(rtype, name)
            if len(records) == 1:
                identifier = records[0]["id"]

        if identifier and content:
            with localzone.manage(self.filename, self.origin, autosave=True) as zone:
                if zone.update_record(identifier, content):  # pylint: disable=no-member
                    result = True

        LOGGER.debug("update_record: %s", result)
        return result
1082116
async def insert(self, task: Task) -> None:
        ''''''

        if not isinstance(task, Task):
            task = task()

        if task.name not in self.all_tasks:
            task.tasky = self
            self.all_tasks[task.name] = task

            await task.init()

        elif task != self.all_tasks[task.name]:
            raise Exception('Duplicate task %s' % task.name)

        if task.enabled:
            task.task = asyncio.ensure_future(self.start_task(task))
            self.running_tasks.add(task)
        else:
            task.task = None

        return task
630936
void handleUnknownTasks(List<TaskRec> taskRecList) {
		long nowMs = System.currentTimeMillis();
		for (TaskRec taskRec : taskRecList) {
			if (taskRec.createTs.getTime() < nowMs - UNKNOWN_TASK_CANCEL_AFTER_MS) {
				logger.warn("Task is unknown and was not processed during 24 hours, mark as error: {}", taskRec);
				changeTaskStatus(taskRec.taskId, TedStatus.ERROR, "unknown task");
			} else {
				logger.warn("Task is unknown, mark as new, postpone: {}", taskRec);
				changeTaskStatusPostponed(taskRec.taskId, TedStatus.NEW, "unknown task. postpone", new Date(nowMs + UNKNOWN_TASK_POSTPONE_MS));
			}
		}
	}
996587
def add(self, task_cls):
		

		registry_tag = task_cls.__registry_tag__
		if registry_tag not in self.__registry.keys():
			self.__registry[registry_tag] = [task_cls]
		elif self.__multiple_tasks_per_tag__ is True:
			self.__registry[registry_tag].append(task_cls)
		else:
			raise RuntimeError('Multiple tasks with same tag appended')
1138609
public synchronized void addSoftwareIdentifier(Identifier identifier) {
        //todo the following assertion should be removed after initial testing and implementation
        assert !(identifier instanceof CpeIdentifier) : "vulnerability identifier cannot be added to software identifiers";

        final Optional<Identifier> found = softwareIdentifiers.stream().filter(id
                -> id.getValue().equals(identifier.getValue())).findFirst();
        if (found.isPresent()) {
            //TODO - should we check for type of identifier?  I.e. could we see a Purl and GenericIdentifier with the same value
            final Identifier existing = found.get();
            if (existing.getConfidence().compareTo(identifier.getConfidence()) < 0) {
                existing.setConfidence(identifier.getConfidence());
            }
            if (existing.getNotes() != null && identifier.getNotes() != null) {
                existing.setNotes(existing.getNotes() + " " + identifier.getNotes());
            } else if (identifier.getNotes() != null) {
                existing.setNotes(identifier.getNotes());
            }
            if (existing.getUrl() == null && identifier.getUrl() != null) {
                existing.setUrl(identifier.getUrl());
            }
        } else {
            this.softwareIdentifiers.add(identifier);
        }
    }
1039452
def UpdateTaskAsPendingMerge(self, task):
    
    with self._lock:
      is_abandoned = task.identifier in self._tasks_abandoned
      is_processing = task.identifier in self._tasks_processing
      is_queued = task.identifier in self._tasks_queued

      if not is_queued and not is_processing and not is_abandoned:
        raise KeyError('Status of task {0:s} is unknown.'.format(
            task.identifier))

      if is_abandoned and task.has_retry:
        raise KeyError('Will not merge a task {0:s} with retry task.'.format(
            task.identifier))

      if is_queued:
        logger.debug('Task {0:s} was queued, now merging.'.format(
            task.identifier))
        del self._tasks_queued[task.identifier]

      if is_processing:
        logger.debug('Task {0:s} was processing, now merging.'.format(
            task.identifier))
        del self._tasks_processing[task.identifier]

      if is_abandoned:
        logger.debug('Task {0:s} was abandoned, now merging.'.format(
            task.identifier))
        del self._tasks_abandoned[task.identifier]

      self._tasks_pending_merge.PushTask(task)

      self.SampleTaskStatus(task, 'pending_merge')

      task.UpdateProcessingTime()
      self._UpdateLatestProcessingTime(task)