コード例 #1
0
ファイル: JobStatusTest.php プロジェクト: php-resque/resque
 public function testStatusIsNotTrackedWhenToldNotTo()
 {
     return self::markTestSkipped();
     $token = Resque::enqueue('jobs', 'Test_Job', null, false);
     $status = new Resque_Job_Status($token);
     $this->assertFalse($status->isTracking());
 }
コード例 #2
0
ファイル: Status.php プロジェクト: hlegius/PHPResqueBundle
 public static function check($job_id, $namespace)
 {
     \Resque::setBackend('127.0.0.1:6379');
     if (!empty($namespace)) {
         \Resque_Redis::prefix($namespace);
     }
     $status = new \Resque_Job_Status($job_id);
     if (!$status->isTracking()) {
         die("Resque is not tracking the status of this job.\n");
     }
     $class = new \ReflectionObject($status);
     foreach ($class->getConstants() as $constant_name => $constant_value) {
         if ($constant_value == $status->get()) {
             break;
         }
     }
     return 'Job status in queue is ' . $status->get() . " [{$constant_name}]";
 }
コード例 #3
0
<?php

/**
 * Created by PhpStorm.
 * User: viniciusthiengo
 * Date: 7/23/15
 * Time: 10:50 AM
 */
require '../vendor/autoload.php';
require 'EchoData.php';
//include
date_default_timezone_set('GMT');
Resque::setBackend('127.0.0.1:6379');
$args = array('name' => 'Thiengo');
$jobId = Resque::enqueue('default', 'EchoData', $args, true);
echo "Queued job " . $jobId . "<br><br>";
$status = new Resque_Job_Status($jobId);
if (!$status->isTracking()) {
    die("Resque is not tracking the status of this job.\n");
}
echo $status . '<br><br>';
$jobId = Resque::enqueue('cms26', 'EchoData2', $args);
//exec('echo "create-file.php" | atnow');
//exec('php "create-file.php" | atnow');
echo 'file has being created <br><br>';
//Resque::pop('notification');
echo Resque::size('default');
print_r(Resque::queues());
コード例 #4
0
ファイル: Job.php プロジェクト: SoftwarePunt/php-resque
 /**
  * Re-queue the current job.
  * @return string
  */
 public function recreate()
 {
     $status = new Resque_Job_Status($this->payload['id']);
     $monitor = false;
     if ($status->isTracking()) {
         $monitor = true;
     }
     return self::create($this->queue, $this->payload['class'], $this->getArguments(), $monitor);
 }
コード例 #5
0
ファイル: Job.php プロジェクト: daneren2005/php-resque
 /**
  * Re-queue the current job.
  * @return string
  */
 public function recreate()
 {
     $status = new Resque_Job_Status($this->payload['id']);
     $monitor = false;
     if ($status->isTracking()) {
         $monitor = true;
         $status->update(Resque_Job_Status::STATUS_WAITING);
     }
     $this->worker->logger->log(Psr\Log\LogLevel::NOTICE, 'Requeing {job}', array('job' => $this));
     Resque::redis()->lrem('working:' . $this->queue, 0, $this->payload['id']);
     Resque_Event::trigger('onRecreate', array('job' => $this));
     return self::create($this->queue, $this->payload['class'], $this->getArguments(), $monitor, $this->payload['id']);
 }
コード例 #6
0
 public function restGetQueueJob()
 {
     $jobId = $this->params()->fromQuery('job');
     $status = new \Resque_Job_Status($jobId);
     if (!$status->isTracking()) {
         return array('status' => -1);
     }
     return array('status' => $status->get());
 }
コード例 #7
0
ファイル: Job.php プロジェクト: hungnv0789/vhtm
	/**
	 * Re-queue the current job.
	 */
	public function recreate()
	{
		$status = new Resque_Job_Status($id);
		$monitor = false;
		if($status->isTracking()) {
			$monitor = true;
		}

		self::create($this->queue, $this->payload->class, $this->payload->args, $monitor);
	}