Reset current jobs

@param int|null $id

@return int Success
540691
public function reset($id = null) {
		$fields = [
			'completed' => null,
			'fetched' => null,
			'progress' => 0,
			'failed' => 0,
			'workerkey' => null,
			'failure_message' => null,
		];
		$conditions = [
			'completed IS' => null,
		];
		if ($id) {
			$conditions['id'] = $id;
		}

		return $this->updateAll($fields, $conditions);
	}
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}].");
		}
	}
545835
public function markJobDone($id)
    {
        $entity = $this->get($id);
        $data = ['completed' => true, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . 'Success!' . PHP_EOL]];
        $this->patchEntity($entity, $data, ['validate' => false]);
        return $this->save($entity);
    }
659670
public static function get($id)
    {
        $jobset = new static();

        // find jobset model
        $model = $jobset->findModel($id);
        // update local model
        $jobset->setModel($model);
        // Init job instances
        $jobset->initJobs();

        return $jobset;
    }
1132995
public function renew(int $id)
    {
        $this->updates[$id] = $this->now + $this->timeout;
    }
553330
public function run($id = null)
    {
        $app = $this->getApp();
        if ($app->getRequest()->getMethod() !== 'OPTIONS') {
            $app->getResponse()->setStatusCode(405);
        }
        $options = $id === null ? $this->collectionOptions : $this->resourceOptions;
        $app->getResponse()->getHeaderCollection()->set('Allow', implode(', ', $options));
        $app->getResponse()->getHeaderCollection()->set('Access-Control-Allow-Method', implode(', ', $options));
    }
584458
public function delete($id = null) {
        $task = $this->Tasks->get($id);
        if ($this->request->is(['patch', 'post', 'put'])) {
            if ($this->Tasks->delete($task)) {
                $this->Flash->success(__('The task has been deleted.'));
            } else {
                $this->Flash->error(__('The task could not be deleted. Please, try again.'));
            }
            return $this->redirect(['action' => 'index']);
        }
        $this->set(compact('task'));
    }
558814
public function delete($id = null)
    {
        if (!is_null($id)) {
            $this->setId($id);
        }

        return $this->getDbGateway()->delete($this->getId());
    }
268141
public function delete($id) {
		$request = new CPS_DeleteRequest($id);
		$this->_lastResponse = $this->_connection->sendRequest($request);
		return count($this->_lastResponse->getModifiedIds());
	}
322648
public function findFailed($id)
    {
        $attributes = $this->connection()->hmget(
            $id, $this->keys
        );

        $job = is_array($attributes) && $attributes[0] !== null ? (object) array_combine($this->keys, $attributes) : null;

        if ($job && $job->status !== 'failed') {
            return;
        }

        return $job;
    }
743251
public function delete($id = null) {
		$country = $this->Countries->get($id);

		if ($this->Countries->delete($country)) {
			$this->Flash->success(__('record del {0} done', $id));
			return $this->redirect(['action' => 'index']);
		}

		$this->Flash->error(__('record del {0} not done exception', $id));
		return $this->redirect(['action' => 'index']);
	}
92135
public function edit($id = null)
    {
        $position = $this->BannersPositions->get($id);

        if ($this->request->is(['patch', 'post', 'put'])) {
            $position = $this->BannersPositions->patchEntity($position, $this->request->getData());

            if ($this->BannersPositions->save($position)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('position'));
    }
416222
public function getJob($id)
    {
		$url = $this->service_url . '/jobs/' . $id;
		$data = $this->service->prepAndSend($url, array(200), 'GET', null, true, 'application/job+json', 'application/job+json');
        return Job::createFromJSON(json_decode($data));
	}
388590
public function delete($id = null) {
		$block = $this->Blocks->get($id);
		$this->request->allowMethod('post', 'delete');
		if ($this->Blocks->delete($block)) {
			$this->Flash->success('The block has been deleted.');
		} else {
			$this->Flash->error('The block could not be deleted. Please, try again.');
		}
		return $this->redirect(['action' => 'index']);
	}
1180952
public function delete($id = null)
    {
        // If an ID is passed to the method, we will set the where clause to check
        // the ID to allow developers to simply and quickly remove a single item
        // without manually specifying the where clauses.
        if (! is_null($id)) {
            $this->where('id', '=', $id);
        }

        return $this->processor->processDeleteRequest($this, $this->runRequest());
    }
1253728
public function delete($id = null)
    {
        $this->request->allowMethod(['post', 'delete']);
        $cmsTerm = $this->CmsTerm->get($id);
        if ($this->CmsTerm->delete($cmsTerm)) {
            $this->Flash->success('The cms term has been deleted.');
        } else {
            $this->Flash->error('The cms term could not be deleted. Please, try again.');
        }
        return $this->redirect(['action' => 'index']);
    }
335241
public function deleteJob($id)
    {
        $payload = $this->getPayload($id);

        if (!in_array($payload[self::JOB_PAYLOAD_STATE], [self::STATE_RESERVED, self::STATE_BURIED])) {
            return true;
        }

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

        $result = $this->getRedis()->transaction(
            function ($tx) use ($id, $keyBuried, $keyReserved, $redisJobNamespace) {
                /** @var $tx \Predis\Client */
                $tx->zrem($keyReserved, $id);
                $tx->zrem($keyBuried, $id);
                $tx->hdel($redisJobNamespace, $id);
            }
        );

        return array_count_values($result) >= 1;
    }