Close a task.

@param int $taskId ID of the task.

@return bool True on success, false on failure.
167376
public function closeTask(int $taskId): bool
    {
        if ( ! $this->validateId($taskId)) {
            return false;
        }

        $result = $this->post('tasks/' . $taskId . '/close');

        return 204 === $result->getStatusCode();
    }
831505
private void cleanup(final String taskId)
  {
    if (!lifecycleLock.awaitStarted(1, TimeUnit.SECONDS)) {
      return;
    }
    final RemoteTaskRunnerWorkItem removed = completeTasks.remove(taskId);
    final Worker worker = removed.getWorker();
    if (removed == null || worker == null) {
      log.makeAlert("WTF?! Asked to cleanup nonexistent task")
         .addData("taskId", taskId)
         .emit();
    } else {
      final String workerId = worker.getHost();
      log.info("Cleaning up task[%s] on worker[%s]", taskId, workerId);
      final String statusPath = JOINER.join(indexerZkConfig.getStatusPath(), workerId, taskId);
      try {
        cf.delete().guaranteed().forPath(statusPath);
      }
      catch (KeeperException.NoNodeException e) {
        log.info("Tried to delete status path[%s] that didn't exist! Must've gone away already?", statusPath);
      }
      catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
  }
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);
    }
666542
public static function taskGet($task_id)
    {
        $tasks = self::taskFileLoad();
        if (isset($tasks[$task_id])) {
            return $tasks[$task_id];
        }
        return false;
    }
49294
public function kill_process($pid)
    {

        if (!is_numeric($pid)) return false;
        $pid = (int)$pid;
        $sql = "KILL $pid";

        return $this->db->query($sql);
    }
334335
function _close()
	{
		if(is_object($this->_queryID)) {
			$rez = sqlsrv_free_stmt($this->_queryID);
			$this->_queryID = false;
			return $rez;
		}
		return true;
	}
858437
public function actionTasknotedelete($taskid, $id)
    {
        Task::getTaskNoteModel($id)->delete();

        return $this->redirect(['tasknotelist', 'taskid' => $taskid]);
    }
290586
public function stop(): bool
    {
        $this->process->getPid()->onResolve(function ($error, $pid) {
            if ($error) {
                throw new ProcessException($error);
            }

            print "\nStopping Process Id: {$pid}\n";

            if ('\\' === \DIRECTORY_SEPARATOR) {
                \exec(\sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
                if ($exitCode) {
                    throw new ProcessException(\sprintf('Unable to kill the process (%s).', \implode(' ', $output)));
                }
            } else {
                $this->process->signal(15);

                if ($ok = \proc_open("kill $pid", [2 => ['pipe', 'w']], $pipes)) {
                    $ok = false === \fgets($pipes[2]);
                }

                if (!$ok) {
                    throw new ProcessException(\sprintf('Error while killing process "%s".', $pid));
                }
            }

            $this->process->kill();
        });

        return true;
    }
31184
public function tryLock($taskCallable = null)
    {
        if($this->isLocked())
        {
            return false;
        }
        if(!$this->__tryLock())
        {
            return false;
        }
        if(null === $taskCallable)
        {
            return true;
        }
        else
        {
            try {
                $taskCallable();
            } catch (\Throwable $th) {
                throw $th;
            } finally {
                $this->unlock();
            }
        }
    }
1230305
public function close($id)
	{
		$endpoint = new Close($this->getTransport());
		$endpoint->setId($id);

		try {
			$result = $endpoint->performRequest();
		} catch (ResourceNotFoundException $e) {
			return false;
		}

		return $result['status'] == 204;
	}
1038300
protected function checkResult($taskId)
    {
        $this->getLogger()->debug("Requesting Task Status for task {TaskId}", ['TaskId' => $taskId]);

        $postData = [
            'clientKey' => $this->apiKey,
            'taskId'    => $taskId
        ];

        try {
            $response = $this->getClient()->post(static::HOST . '/getTaskResult', [
                'json' => $postData,
                'headers' => [
                    'Content-Type' => 'application/json'
                ]
            ]);
        } catch (GuzzleException\RequestException $e) {
            $this->getLogger()->error("Guzzle Exception {Error}", ['Error' => $e]);
            throw new RemoteSolverException("Error fetching AntiCaptcha Task Status", 0, $e);
        }

        $decoded = json_decode($response->getBody(), true);

        if ($decoded === false) {
            $this->getLogger()->error("AntiCaptcha API error");
            return false;
        }

        if ($decoded['errorId'] !== 0) {
            $this->getLogger()->error(
                "Received AntiCaptcha ErrorId: {ErrorId}: {ErrorDescription}",
                [
                    'ErrorId'          => $decoded['errorId'],
                    'ErrorDescription' => $decoded['errorDescription']
                ]
            );
            throw new RemoteSolverException(sprintf("AntiCaptcha error: %s: %s", $decoded['errorId'], $decoded['errorDescription']));
        }

        if ($decoded['status'] == 'processing') {
            $this->getLogger()->debug("Task {TaskId} is still processing...", ['TaskId' => $taskId]);
            return true;
        }

        if ($decoded['status'] == 'ready') {
            $this->getLogger()->debug("Task {TaskId} completed.", ['TaskId' => $taskId]);
            return $decoded['solution']['gRecaptchaResponse'];
        }

        throw new RemoteSolverException(sprintf("Unknown status %s", $decoded['status']));
    }
929917
public function CloseDispute($disputeId)
    {
        $dispute = new Dispute();
        $dispute->Id = $disputeId;
        return $this->SaveObject('dispute_save_close', $dispute, '\MangoPay\Dispute');
    }
232085
public function addProjectToTask($taskId, $projectId = null)
    {
        $data = [
            'project' => $projectId ?: $this->defaultProjectId
        ];

        return $this->curl->post("tasks/{$taskId}/addProject", ['data' => $data]);
    }
383088
public function deleteTaskById( $TaskId){
        $rest = $this->getService( self::API_FS_TASK . $TaskId);
        $rest->DELETE();

        return $rest->getSuccess();
    }
293444
public function update($taskId, array $data)
    {
        $data = self::mergeData($data, [
            'finished' => false,
            'smContactTaskReq' => [
                'id' => $taskId,
            ],
        ]);

        return $this->client->doPost('contact/updateTask', $data);
    }
272714
function closeTask(taskID) {
			taskID = parseInt(taskID, 10);
			var task = this.getTaskByID(taskID);

			if(task) {
				task.open = false;
				console.log('closing:');

				return task;
			}
			else {
				return false;
			}

		}
606070
public function taskDelete()
    {
        $tasks = self::taskFileLoad();

        if (isset($tasks[$this->task_id])) {
            unset($tasks[$this->task_id]);

            return self::taskFileSave($tasks);
        }
        return false;
    }