Improvements to Status Handling
Added link to jobs page to fix any issues caused by non-synchronised time between webserver/worker machine leaving jobs permanently in the running state. Prevented the insertion of new status records unless the state is actually being changed. Made the HandBrake worker process write the status complete message instead of the run-jobs dispatched, in case it crashes.
This commit is contained in:
@@ -44,9 +44,6 @@ function gearman_created_callback($gearman_task) {
|
||||
$main = RippingCluster_Main::instance();
|
||||
$log = $main->log();
|
||||
|
||||
$job = RippingCluster_Job::fromId($gearman_task->unique());
|
||||
$job->updateStatus(RippingCluster_JobStatus::QUEUED);
|
||||
|
||||
$log->info("Job successfully queued with Gearman", $gearman_task->unique());
|
||||
}
|
||||
|
||||
@@ -57,26 +54,10 @@ function gearman_data_callback($gearman_task) {
|
||||
$log->debug("Received data callback from Gearman Task");
|
||||
}
|
||||
|
||||
function gearman_status_callback($gearman_task) {
|
||||
$main = RippingCluster_Main::instance();
|
||||
$log = $main->log();
|
||||
|
||||
$job = RippingCluster_Job::fromId($gearman_task->unique());
|
||||
$status = $job->currentStatus();
|
||||
|
||||
$rip_progress = $gearman_task->taskNumerator() / $gearman_task->taskDenominator();
|
||||
if ($rip_progress > $status->ripProgress() + 0.1) {
|
||||
$status->updateRipProgress($rip_progress);
|
||||
}
|
||||
}
|
||||
|
||||
function gearman_complete_callback($gearman_task) {
|
||||
$main = RippingCluster_Main::instance();
|
||||
$log = $main->log();
|
||||
|
||||
$job = RippingCluster_Job::fromId($gearman_task->unique());
|
||||
$job->updateStatus(RippingCluster_JobStatus::COMPLETE);
|
||||
|
||||
$log->info("Job Complete", $job->id());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user