Schedules a task.

    Args:
      task (Task): task.

    Returns:
      bool: True if the task was scheduled.
553469
def _ScheduleTask(self, task):
    
    if self._processing_profiler:
      self._processing_profiler.StartTiming('schedule_task')

    try:
      self._task_queue.PushItem(task, block=False)
      is_scheduled = True

    except errors.QueueFull:
      is_scheduled = False

    if self._processing_profiler:
      self._processing_profiler.StopTiming('schedule_task')

    return is_scheduled
621313
def task_postponed(self):
		
		tracker = self.task().tracker_storage()
		if tracker is not None and self.track_wait() is True:
			details = self.task().event_details(WTrackerEvents.wait)
			tracker.register_wait(self.task(), event_details=details)
		WScheduleRecord.task_postponed(self)
319777
def remove_task(cls, task):
        
        with cls._lock:
            if not isinstance(task, Task):
                task = cls.resolved_task(task)

            if task:
                cls.tasks.remove(task)

            cls.tasks.sort()
522650
def _update_task(self, task):
        
        self.task = task
        self.task.data.update(self.task_data)
        self.task_type = task.task_spec.__class__.__name__
        self.spec = task.task_spec
        self.task_name = task.get_name()
        self.activity = getattr(self.spec, 'service_class', '')
        self._set_lane_data()
293002
protected boolean scheduleImpl(Runnable task,
                                 ClassLoader loader,
                                 long expireTime,
                                 boolean isPriority,
                                 boolean isQueueIfFull,
                                 boolean isWakeScheduler)
  {
    Objects.requireNonNull(task);
    
    RunnableItem taskItem = new RunnableItem(task, loader);
    
    return schedule(taskItem);
  }
460008
public static String schedule(String schedulingPattern, Runnable task) {
		return scheduler.schedule(schedulingPattern, task);
	}
619697
def schedule_saved(sender, instance, **kwargs):
    
    from contentstore.tasks import sync_schedule

    sync_schedule.delay(str(instance.id))
1233299
def addTask(self, task):
        
        # Try to start task first.  If it fails then we don't need to
        # undo adding it to taskset
        task.initialize(self)
        task.start()

        with self._lock_c:
            self.numtasks += 1
            self.taskset.append(task)
693714
def queue_task
      if @task.job_class.instance_method(:perform).arity.zero?
        @task.job_class.send(perform_method)
      else
        @task.job_class.send(perform_method, @scheduled_time.to_i)
      end
    end
71854
def job(name, **kwargs):
    ''''''
    return task(name=name, schedulable=True, base=JobTask,
                bind=True, **kwargs)
972499
def schedule_next?(time)
      next_occurrence = @schedule.next_occurrence(time)
      if @last_scheduled != next_occurrence.to_i
        @last_scheduled = next_occurrence.to_i
        return true
      end
      false
    end
580758
private ProjectCalendar getTaskCalendar(Project.Tasks.Task task)
   {
      ProjectCalendar calendar = null;

      BigInteger calendarID = task.getCalendarUID();
      if (calendarID != null)
      {
         calendar = m_projectFile.getCalendarByUniqueID(Integer.valueOf(calendarID.intValue()));
      }

      return (calendar);
   }
683138
protected function scheduleTask(TaskInterface $task)
    {
        if (null !== ($execution = $this->taskExecutionRepository->findPending($task))) {
            return;
        }

        if ($task->getInterval() === null && 0 < count($this->taskExecutionRepository->findByTask($task))) {
            return;
        }

        $scheduleTime = $task->getInterval() ? $task->getInterval()->getNextRunDate() : $task->getFirstExecution();
        $execution = $this->taskExecutionRepository->create($task, $scheduleTime);
        $execution->setStatus(TaskStatus::PLANNED);

        $this->eventDispatcher->dispatch(
            Events::TASK_EXECUTION_CREATE,
            new TaskExecutionEvent($task, $execution)
        );

        $this->taskExecutionRepository->save($execution);
    }
257838
private boolean taskShouldExecute(Task task, TaskRecord taskRecord) {
        String taskID = taskRecord.getTaskID();
        if (taskRecord.getStatus() == TaskStatus.NEVER_EXECUTED) {
            m_logger.debug("Task '{}' has never executed", taskID);
            return true;
        }
        if (taskRecord.getStatus() == TaskStatus.IN_PROGRESS) {
            m_logger.debug("Task '{}' is already being executed", taskID);
            return false;
        }
        
        Calendar startTime = taskRecord.getTime(TaskRecord.PROP_START_TIME);
        long startTimeMillis = startTime == null ? 0 : startTime.getTimeInMillis();
        long taskPeriodMillis = task.getTaskFreq().getValueInMinutes() * 60 * 1000;
        long nowMillis = System.currentTimeMillis();
        boolean bShouldStart = startTimeMillis + taskPeriodMillis <= nowMillis;
        m_logger.debug("Considering task {}: Last started at {}; periodicity in millis: {}; current time: {}; next start: {}; should start: {}",
                      new Object[]{task.getTaskID(),
                                   Utils.formatDateUTC(startTimeMillis, Calendar.MILLISECOND),
                                   taskPeriodMillis,
                                   Utils.formatDateUTC(nowMillis, Calendar.MILLISECOND),
                                   Utils.formatDateUTC(startTimeMillis + taskPeriodMillis, Calendar.MILLISECOND),
                                   bShouldStart});
        return bShouldStart;
    }
1285794
def enq(self, task):
        
        if not self._stop.is_set():
            self._inq.put(task)
        else:
            raise RuntimeError("Attempted to enqueue an operation while "
                               "multi pool was shutdown!")
734109
def schedule(self, task):
        """"""
        self.task_manager.register(task)
        self.worker_manager.dispatch(task)
414251
async def execute(self, coro, name, user, info=None):
        '''
        
        '''
        task = self.schedCoro(coro)
        return await s_task.Task.anit(self, task, name, user, info=info)