public function delete(JQManagedJob $mJob) { $dbJob = $this->getDbJob($mJob->getJobId()); $dbJob->delete($this->con); }
/** * @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()); }
public function delete(JQManagedJob $mJob) { unset($this->queue[$mJob->getJobId()]); }
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'); }
/** * @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}"); }
function statusDidChange(JQManagedJob $mJob, $oldStatus, $message) { print "Status change: {$oldStatus} => {$mJob->getStatus()}\n"; }