change task status using  task persistence

@deprecated since version 7.10.0, to be removed in 8.0.

@param $taskId
@param $status
@return self
491518
public function updateTaskStatus($taskId, $status)
    {
        if ($this->getPersistence()->has($taskId)) {
            $this->getPersistence()->update($taskId , $status);
        }
        return $this;
    }
900783
public function set_status($status = self::STATUS_ACTIVE) {
        $this->statusactive = $status == static::STATUS_ACTIVE;
        $this->statussuspended = $status == static::STATUS_SUSPENDED;
        $this->statusnotcurrent = $status == static::STATUS_NOT_CURRENT;

        return $this;
    }
824524
public function setTask(Task $task = null)
    {
        $this->task = $task;
        if (null !== $task) {
            $task->addComment($this);
        }

        return $this;
    }
106441
public function delete(string $taskID, string $listID = ''): \BearFramework\Tasks
    {
        $app = App::get();
        $this->lockList($listID);
        $list = $this->getListData($listID);
        if (isset($list[$taskID])) {
            unset($list[$taskID]);
            $this->setListData($listID, $list);
            $app->data->delete($this->getTaskDataKey($taskID, $listID));
        }
        $this->unlockList($listID);
        return $this;
    }
232085
public function addProjectToTask($taskId, $projectId = null)
    {
        $data = [
            'project' => $projectId ?: $this->defaultProjectId
        ];

        return $this->curl->post("tasks/{$taskId}/addProject", ['data' => $data]);
    }
1110450
public function setStatus(\Flowcode\ShopBundle\Entity\ProductOrderStatus $status = null)
    {
        $this->status = $status;

        return $this;
    }
976578
public function withStatus(string $status): self
    {
        $this->status = JobEventStatusEnum::ensureValid($status);
        return $this;
    }
999476
public static function runImmediateTask($taskId)
    {
        $command = new ProcessBuilder();
        $command->setWorkingDirectory(Yii::getAlias('@app'));
        $command->setPrefix(self::getPhpBinary());
        if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
            $command->add('yii');
        } else {
            $command->add('./yii');
        }
        $command->add('deferred/index')->add("$taskId");
        $process = $command->getProcess();
        $process->setWorkingDirectory(Yii::getAlias('@app'));
        $process->disableOutput();
        if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
            $process->setCommandLine('start /b "deferred" ' . $process->getCommandLine());
        } else {
            $process->setCommandLine($process->getCommandLine() . ' &');
        }
        if (isset(Yii::$app->params['deferred.env'])) {
            $process->setEnv(ArrayHelper::merge(Yii::$app->params['deferred.env'], $process->getEnv()));
        }
        $process->mustRun();
    }
858276
public function updateTask(int $taskId, string $content, array $options = []): bool
    {
        if ('' === $content) {
            return false;
        }

        unset($options['content']);
        $data   = $this->prepareRequestData(array_merge(['content' => $content], $options));
        $result = $this->post('tasks/' . $taskId, $data);

        return 204 === $result->getStatusCode();
    }
51462
public function delete(string $taskId = null)
    {
        $this->getGoogleTasks($this->taskId)->deleteTask($taskId ?? $this->id);
    }
982755
public function restart($taskId) {
		if (!$this->stop($taskId)) {
			return false;
		}

		$task = array(
			'id' => null,
			'stderr' => '',
			'stdout' => '',
			'status' => TaskType::UNSTARTED,
			'code' => '',
			'code_string' => '',
			'started' => '',
			'stopped' => '',
			'server_id' => 0,
				) + $this->read(null, $taskId)[$this->alias];
		$this->create();		
		$success = (bool)$this->saveAssociated(array(
					$this->alias => $task,
					$this->DependsOnTask->alias => array($taskId)
		));
		return $success ? $this->id : $success;
	}
28794
public function cancelTask($task_id)
    {
        if (empty($task_id)) {
            throw new \InvalidArgumentException("Please set task_id");
        }
        $url = "projects/{$this->project_id}/tasks/$task_id/cancel";
        $request = array();

        $this->setCommonHeaders();
        $res = $this->apiCall(self::POST, $url, $request);
        return self::json_decode($res);
    }
1343679
public function withStatus(string $status): self
    {
        $this->status = JobStatusEnum::ensureValid($status);
        return $this;
    }
376828
public function updateStatus($status)
    {
        if(empty($this->payload['id'])) {
            return;
        }

        $statusInstance = new Status($this->payload['id']);
        $statusInstance->update($status);
    }
1040727
public static function createFromString($status)
    {
        switch ($status) {
            case TaskLogInterface::STATUS_ENQUEUED:
                return TaskLogCategorizedStatus::created();
                break;

            case TaskLogInterface::STATUS_DEQUEUED:
            case TaskLogInterface::STATUS_RUNNING:
            case TaskLogInterface::STATUS_CHILD_RUNNING:
                return TaskLogCategorizedStatus::inProgress();
                break;

            case TaskLogInterface::STATUS_COMPLETED:
                return TaskLogCategorizedStatus::completed();
                break;

            case TaskLogInterface::STATUS_ARCHIVED:
                return TaskLogCategorizedStatus::archived();
                break;

            case TaskLogInterface::STATUS_FAILED:
            case TaskLogInterface::STATUS_UNKNOWN:
                return TaskLogCategorizedStatus::failed();
                break;

            default:
                throw new \Exception('Invalid status provided');
        }
    }
1268023
public function stop($taskId) {
		if ($this->TaskClient->stop($taskId)) {
			$this->Session->setFlash("Task $taskId will be stopped shortly", 'alert/simple', array(
				'class' => 'alert-success', 'title' => 'Ok!'
			));
		} else {
			$this->Session->setFlash("Can't stop task $taskId!", 'alert/simple', array(
				'class' => 'alert-error', 'title' => 'Error!'
			));
		}
		$this->redirect($this->referer());
	}
159853
public function setStatus($status)
    {
        if (!in_array($status, array(
            self::STATUS_OPEN,
            self::STATUS_RUNNING,
            self::STATUS_CLOSED,
            self::STATUS_ERROR,
        ))) {
            throw new \InvalidArgumentException("Invalid status in ".get_class($this).".");
        }

        $this->status = $status;

        return $this;
    }