示例#1
0
 public function delete(JQManagedJob $mJob)
 {
     $dbJob = $this->getDbJob($mJob->getJobId());
     $dbJob->delete($this->con);
 }
示例#2
0
 /**
  * @dataProvider jobIsPastMaxRuntimeSecondsDataProvider
  * @testdox JQManagedJob::isPastMaxRuntimeSeconds()
  */
 function testJobIsPastMaxRuntimeSeconds($maxRuntimeSeconds, $currentStatus, $startDts, $expectedResult)
 {
     $q = $this->jqStore;
     $mJob = new JQManagedJob($q);
     $mJob->fromArray(array('status' => $currentStatus, 'maxRuntimeSeconds' => $maxRuntimeSeconds, 'startDts' => new DateTime($startDts)));
     $this->assertEquals($expectedResult, $mJob->isPastMaxRuntimeSeconds());
 }
示例#3
0
 public function delete(JQManagedJob $mJob)
 {
     unset($this->queue[$mJob->getJobId()]);
 }
示例#4
0
 function testResolveAsyncJobClearMutexWhenNotInWaitAsync()
 {
     // create a queuestore
     $q = new JQStore_Array();
     $mJob = $q->enqueue(new SampleAsyncJob(NULL));
     $mJob->markJobStarted();
     $mJob->markJobFailed();
     $this->assertEquals(JQManagedJob::STATUS_FAILED, $mJob->getStatus());
     try {
         JQManagedJob::resolveWaitAsyncJob($q, $mJob->getJobId(), NULL);
     } catch (JQManagedJob_InvalidStateException $e) {
         $this->assertEquals($mJob, $q->getWithMutex($mJob->getJobId()));
         return;
     }
     $this->fail('should never get here');
 }
示例#5
0
 /**
  * @dataProvider failedJobDetectionDataProvider
  * @testdox JQManagedJob::run() will gracefully detect and fail a job that
  */
 function testFailedJobDetection($errorGeneratorF, $exceptionMessageContains)
 {
     // setup
     $q = new JQStore_Array();
     $mJob = new JQManagedJob($q, new SampleCallbackJob($errorGeneratorF));
     $mJob->setStatus(JQManagedJob::STATUS_QUEUED);
     $mJob->markJobStarted();
     // run
     $err = $mJob->run($mJob);
     $this->assertEquals(JQManagedJob::STATUS_FAILED, $mJob->getStatus(), "failed job not marked as failed.");
     $this->assertContains($exceptionMessageContains, $err, "JQManagedJob::run() failed to detect {$exceptionMessageContains}");
 }
示例#6
0
 function statusDidChange(JQManagedJob $mJob, $oldStatus, $message)
 {
     print "Status change: {$oldStatus} => {$mJob->getStatus()}\n";
 }