Ejemplo n.º 1
0
 public function testStatusIsNotTrackedWhenToldNotTo()
 {
     return self::markTestSkipped();
     $token = Resque::enqueue('jobs', 'Test_Job', null, false);
     $status = new Resque_Job_Status($token);
     $this->assertFalse($status->isTracking());
 }
Ejemplo n.º 2
0
 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}]";
 }
<?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());
Ejemplo n.º 4
0
 /**
  * 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);
 }
Ejemplo n.º 5
0
 /**
  * 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']);
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 7
0
	/**
	 * 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);
	}