Create a new status monitor item for the supplied job ID. Will create
all necessary keys in Redis to monitor the status of a job.

@param string $id The ID of the job to monitor the status of.
16716
public function create($id)
    {
        $statusPacket = [
            'status' => self::STATUS_WAITING,
            'updated' => time(),
            'started' => time()
        ];
        $this->resqueInstance->redis->set('job:' . $id . ':status', json_encode($statusPacket));
    }
540764
public function show($id)
    {
        $questionnaire = $this->client->get(
            sprintf('buckets/%d/questionnaires/%d.json', $this->bucket, $id)
        );

        return new Questionnaire($this->response($questionnaire));
    }
679121
private function addStatusToOrder($id, $status)
    {
        $order = $this->_order->load($id);
        $order->addStatusToHistory($this->getStatusFromPaymentKey($status), null, true);
        $order->save();
    }
796587
public function deleteByID($id) {
        $result = $this->api->request(
            'monitoring.livestatus.delete',
            [
                'id' => $id
            ]
        );

        if (!array_key_exists('success', $result) ||
            $result['success'] !== true) {
            if (array_key_exists('message', $result)) {
                throw new RuntimeException(sprintf('Bad result: %s', $result['message']));
            } else {
                throw new RuntimeException('Bad result');
            }
        }

        return $this;
    }
1287903
public function work($id=1)
    {
        // Pre-work check
        if (!method_exists($this, 'handleWork'))
            throw new Exception("You need to declare `handleWork()` method in your worker controller.", 500);
        
        // INI setting
        if ($this->debug) {
            error_reporting(-1);
            ini_set('display_errors', 1);
        }
        set_time_limit(0);

        // Start worker
        $startTime = microtime(true);
        $pid = getmypid();
        // Print worker close
        $this->_print("Queue Worker - Create #{$id} (PID: {$pid})");

        // Call customized worker process, stops till catch false by callback return
        while ($this->handleWork($this->_staticWork)) {
            // Sleep if set
            if ($this->workerSleep) {
                sleep($this->workerSleep);
            }
            // Loading insurance
            sleep(0.1);
        }

        // Print worker close
        $costSeconds = number_format(microtime(true) - $startTime, 2, '.', '');
        $this->_print("Queue Worker - Close #{$id} (PID: {$pid}) | cost: {$costSeconds}s");

        return;
    }
1032962
public function run($id, $status)
    {
        $model = $this->findModel($id);
        $model->load(Yii::$app->request->post());
        $changedStatus = $model->sendToStatus($status);
        $model->save();

        return $this->response(
            $changedStatus,
            $model
        );
    }
900090
public function smsStatus($id)
    {
        $response = $this->request(
            'sms/status',
            [
                'id' => $id,
            ]
        );
        
        $response = explode("\n", $response);
        
        return new SmsStatusResponse(array_shift($response));
    }
895773
public function getStatus($id = null)
    {
        if ($this->isSuccess()) {
            if (!$id) {
                $result = $this->getResult();
                return $result[0]['status'];
            }

            foreach ($this->getResult() as $row) {
                if ($row['id'] == $id) {
                    return $row['status'];
                }
            }
        }

        return false;
    }
344910
public function setDatatableId($id)
    {
        if (!array_key_exists($id, self::$_instances))
        {
            self::$_instances[$id] = $this;
        }
        else
        {
            throw new \Exception('Identifer already exists');
        }
        return $this;
    }
916987
protected function retryJob($id)
	{
		$failed = $this->laravel['queue.failer']->find($id);

		if (! is_null($failed)) {
			$failed = (object) $failed;

			$failed->payload = $this->resetAttempts($failed->payload);

			$this->laravel['queue']->connection($failed->connection)
								->pushRaw($failed->payload, $failed->queue);

			$this->laravel['queue.failer']->forget($failed->id);

			$this->info("The failed job [{$id}] has been pushed back onto the queue!");
		} else {
			$this->error("No failed job matches the given ID [{$id}].");
		}
	}
1364929
public function regenerateTask($id)
    {
        $taskEntity = $this->taskRepo->find($id);
        if (!($taskEntity instanceof Task)) {
            throw new TaskQueueServiceException("No such task :" . $id, 1);
        }
        if ($taskEntity->getStatus() != Task::STATUS_FAILED) {
            throw new TaskQueueServiceException(
                "Invalid status for task. Current status: '" .
                $taskEntity->getStatus() .
                "' must be 'failed' to be able to restart it",
                1
            );
        }
        $data = $taskEntity->getData();
        $taskEntity->setStatus(Task::STATUS_RESTARTED);
        $this->entityManager->flush();
        $parts = explode("::", $data, 2);
        $taskObject = $this->serializer->deserialize($parts[1], $parts[0], 'json');
        $taskObject->setTaskIdentifier($taskEntity->getId());
        $data = get_class($taskObject) . '::' . $this->serializer->serialize($taskObject, 'json');
        $this->beanstalk
            ->useTube($taskEntity->getTube())
            ->put($data);
        return true;
    }
95663
public function show($id)
    {
        $vault = $this->client->get(
            sprintf('buckets/%d/vaults/%d.json', $this->bucket, $id)
        );

        return new Vault($this->response($vault));
    }
746541
public function addWaitingWorker($id)
    {
        if ($id instanceof Worker) {
            $id = $id->getId();
        }

        if (!isset($this->workerList[$id])) {
            throw new \Exception('Trying to add non existent worker to the queue.');
        }
        $worker = $this->workerList[$id];

        $this->ready = true;

        /*
         * Only add the worker to the end of the wait list if it is not
         * already there.
         */
        if (!isset($this->waitingList[$id])) {
            $this->waitingList[$id] = $worker;
        }

        return $this;
    }
557134
public function kickJob($id)
    {
        $payload = $this->getPayload($id);

        if ($payload[self::JOB_PAYLOAD_STATE] !== self::STATE_BURIED) {
            throw new QueueException(' Cannot kick state unsupported!' . $payload[self::JOB_PAYLOAD_STATE]);
        }

        $keyReady = $this->getKeyReady($payload[self::JOB_PAYLOAD_QUEUE]);
        $keyBuried = $this->getKeyBuried($payload[self::JOB_PAYLOAD_QUEUE]);
        $redisJobNamespace = $this->getRedisJobNamespace();

        $result = $this->getRedis()->transaction(
            function ($tx) use ($id, $payload, $keyBuried, $keyReady, $redisJobNamespace) {
                /** @var $tx \Predis\Client */
                $tx->zrem($keyBuried, $id);
                $payload = self::buildPayload($payload[self::JOB_PAYLOAD_QUEUE], self::STATE_READY);
                $tx->hset($redisJobNamespace, $id, $payload);
                $tx->rpush($keyReady, $id);
            }
        );

        return !in_array(false, $result);
    }
840794
public function resetJob($id = null) {
		$this->request->allowMethod('post');
		if (!$id) {
			throw new NotFoundException();
		}

		$this->QueuedJobs->reset($id);

		$this->Flash->success('Job # ' . $id . ' re-added');

		return $this->redirect(['action' => 'index']);
	}
1097721
public function activate($id)
    {
        $id = (int) $id;
        if ($id <= 0) {
            throw new Exception('Invalid param id');
        }
        $data = [];
        $data['id'] = $id;
        $data['status'] = 'active';
        return $this->update($data);
    }
1319416
public function setIssueStatus($id, $status)
    {
        $api = $this->client->issue_status;
        $statusId = $api->getIdByName($status);

        return $this->update($id, [
            'status_id' => $statusId,
        ]);
    }