Updates a Task in the manager.

@param Task $task

@return Task
487335
public function update(Task $task)
    {
        $this->om->persist($task);
        $this->om->flush();

        $this->notify(NotifierInterface::MESSAGE_UPDATE);

        return $task;
    }
566443
public function update(TaskRequest $request, Task $task)
    {
        try {
            $attributes = $request->all();

            $task->update($attributes);
            return $this->response->message(trans('messages.success.updated', ['Module' => trans('task::task.name')]))
                ->code(204)
                ->status('success')
                ->url(guard_url('task/task/status?search[status]=' . $task->status))
                ->redirect();
        } catch (Exception $e) {
            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('task/task/status?search[status]=' . $task->status))
                ->redirect();
        }

    }
1304526
protected function getTaskHandle($task)
    {
        // Check the handle if possible
        if (!is_string($task)) {
            return;
        }

        // Compute the handle and check it's bound
        $handle = 'rocketeer.tasks.'.Str::snake(class_basename($task), '-');
        $task = $this->container->has($handle) ? $handle : null;

        return $task;
    }
395686
public function execute(AbstractTask $task, $parameters = array()) {

        $this->task = $task;

        $this->loadHtml($this->obtainHtml($parameters));

        $ignore_rules = $task->getIgnoreRules();

        foreach ($ignore_rules as $rule) {
            $this->useIgnoreRule($rule);
        }

        $class = $task->getClassName();

        $entity = new $class;

        $task->setEntity($entity);

        $rules = $task->getParseRules();

        foreach ($rules as $rule) {
            $this->useParseRule($rule, $entity);
        }
        return $entity;
    }
899357
public function toGruntTask($task)
    {
        $workingDirectory = $this->moodle->directory;
        if (is_file($this->plugin->directory.'/Gruntfile.js')) {
            $workingDirectory = $this->plugin->directory;
        }
        $defaultTask = new GruntTaskModel($task, $workingDirectory);

        switch ($task) {
            case 'amd':
                $amdDir = $this->plugin->directory.'/amd';
                if (!is_dir($amdDir)) {
                    return null;
                }

                return new GruntTaskModel($task, $amdDir, 'amd/build');
            case 'shifter':
            case 'yui':
                $yuiDir = $this->plugin->directory.'/yui';
                if (!is_dir($yuiDir)) {
                    return null;
                }

                return new GruntTaskModel($task, $yuiDir.'/src', 'yui/build');
            case 'gherkinlint':
                if ($this->moodle->getBranch() < 33 || !$this->plugin->hasBehatFeatures()) {
                    return null;
                }

                return new GruntTaskModel($task, $this->moodle->directory);
            case 'stylelint:css':
                return $this->plugin->hasFilesWithName('*.css') ? $defaultTask : null;
            case 'stylelint:less':
                return $this->plugin->hasFilesWithName('*.less') ? $defaultTask : null;
            case 'stylelint:scss':
                return $this->plugin->hasFilesWithName('*.scss') ? $defaultTask : null;
            default:
                return $defaultTask;
        }
    }
1049826
public static function action($task)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();
        Splash::log()->deb("Object => ".$task->name." (".$task->desc.")");

        //====================================================================//
        //  READING OF SERVER OBJECT LIST
        //====================================================================//
        if (SPL_F_OBJECTS === $task->name) {
            return self::doObjects($task);
        }

        //====================================================================//
        // Safety Check - Minimal Parameters
        //====================================================================//
        // Verify Requested Object Type is Available
        if (!self::isValidTask($task)) {
            return self::getEmptyResponse($task);
        }

        //====================================================================//
        // Execute Admin Actions
        //====================================================================//
        if (in_array($task->name, array( SPL_F_DESC , SPL_F_FIELDS , SPL_F_LIST ), true)) {
            return self::doAdminActions($task);
        }
        if (in_array($task->name, array( SPL_F_GET , SPL_F_SET , SPL_F_DEL ), true)) {
            return self::doSyncActions($task);
        }
        if (in_array($task->name, array( SPL_F_COMMIT ), true)) {
            Splash::log()->war("Objects - Requested task not found => ".$task->name);

            return self::getEmptyResponse($task);
        }
        //====================================================================//
        // Task Not Found
        Splash::log()->err("Objects - Requested task not found => ".$task->name);

        return self::checkResponse(self::getEmptyResponse($task));
    }
1005145
public function delete(Task $task): void
    {
        $id = $task->getId();

        $task->setId(null);

        $this->client->delete($this->prepareUrlForKey('delete-task', ['id' => $id]));
    }
1022794
protected function submitTask(Task $task)
    {
        switch ($task->type) {
        case Task::JOB_LOW:
            $type = 'submit_job_low';
            break;
        case Task::JOB_LOW_BACKGROUND:
            $type = 'submit_job_low_bg';
            break;
        case Task::JOB_HIGH_BACKGROUND:
            $type = 'submit_job_high_bg';
            break;
        case Task::JOB_BACKGROUND:
            $type = 'submit_job_bg';
            break;
            case Task::JOB_EPOCH:
            $type = 'submit_job_epoch';
            break;
        case Task::JOB_HIGH:
            $type = 'submit_job_high';
            break;
        default:
            $type = 'submit_job';
            break;
        }

        $arg = $task->arg;

        $params = array(
            'func' => $task->func,
            'uniq' => $task->uniq,
            'arg' => $arg,
        );

        if ($task->type == Task::JOB_EPOCH) {
            $params['epoch'] = $task->epoch;
        }

        $s = $this->getConnection();
        Connection::send($s, $type, $params);

        if (!is_array(Connection::$waiting[(int) $s])) {
            Connection::$waiting[(int) $s] = array();
        }

        array_push(Connection::$waiting[(int) $s], $task);
    }
769423
public function action($action, $task = null)
    {
        return $this->app->make(ResolverManagerInterface::class)->resolve(func_get_args());
    }
703867
public function run(Task $task)
    {
        // get configured filters for this task
        $filters = $task
            ->getConfiguration()
            ->getParameter('filters');

        // get sources files
        $sources = $this->fetchSources($task);
        $destinations = $this->fetchDestinations($task);

        foreach ($filters as $filterName) {
            // get current configured filter
            $filter = $this->getFilter($filterName);

            // filter the files supported by this filter
            $filteredSources = $this->filterSources($sources, $filter);

            // apply the filter
            $updatedSources = $filter->run($filteredSources, $destinations);

            // update new sources if exists
            if ($updatedSources === null) {
                $updatedSources = [];
            }
            $sources = $this->updateSources($sources, $filteredSources, $updatedSources);
        }

        if (!$this->isDebug) {
            foreach ($filters as $filterName) {
                // get current configured filter
                $filter = $this->getFilter($filterName);

                // clean the files generated by the filter
                $filter->clean();
            }
        }
    }
44585
public function canWork($task)
    {
        foreach ($this as $worker) {
            if ($worker->canWork($task)) {
                return true;
            }
        }
        return false;
    }
723573
public function update($version) {
    $tasks = $this->restore($version);

    if ($tasks) {
      $tasks
        ->addTask(
          $this->taskDrush('updatedb')->option('yes')
        )
        ->addTask(
          $this->taskDrupal('update:lightning')->option('no-interaction')->arg($version)
        );
    }
    return $tasks;
  }
1013704
public function does($task)
    {
        // Store the original task before transformation
        $this->setStringTask($task);

        // Wrap string tasks
        if (is_string($task) || is_array($task)) {
            $task = $this->builder->wrapStringTasks($task);
        }

        $this->setClosure($task);

        return $this;
    }
445653
public function startTask($task, array $options = [])
    {
        ob_start() && $this->taskStack[] = $task;

        $this->taskOptions[$task] = $this->mergeDefaultOptions($options);
    }
1000888
public static function createProcess($task): Runnable
    {
        if (! self::$isInitialised) {
            self::init();
        }

        if (! Pool::isSupported()) {
            return SynchronousProcess::create($task, self::getId());
        }

        $process = new Process(implode(' ', [
            'exec php',
            self::$childProcessScript,
            self::$autoloader,
            self::encodeTask($task),
        ]));

        return ParallelProcess::create($process, self::getId());
    }
189594
public function backup($task = 'run')
    {
        if (! in_array($task, ['run', 'clean'])) {
            $message = trans('cms::utilities.backup.not_allowed',
                    ['task' => $task]) . trans('cms::utilities.field.executed_by',
                    ['name' => $this->getCurrentUserName()]);
            $this->log->info($message);

            return $this->notifyError($message);
        }

        Artisan::call('backup:' . $task);
        $message = $task == 'clean' ? trans('cms::utilities.backup.cleanup_complete') : trans('cms::utilities.backup.complete');
        $this->log->info($message . trans('cms::utilities.field.executed_by', ['name' => $this->getCurrentUserName()]));

        return $this->notifySuccess($message);
    }
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()