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:
BIN
webui/images/clock.png
Normal file
BIN
webui/images/clock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -52,6 +52,12 @@ if ($req->get('submit')) {
|
||||
$job->delete();
|
||||
}
|
||||
} break;
|
||||
|
||||
case 'fix-broken-timestamps': {
|
||||
foreach ($jobs as $job) {
|
||||
$job->fixBrokenTimestamps();
|
||||
}
|
||||
} break;
|
||||
|
||||
default: {
|
||||
throw new RippingCluster_Exception_InvalidParameters('action');
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<input type="image" class="icon" name="action" id="mark-failed-top" value="mark-failed" src="{$base_uri}images/caution.png" alt="Mark all marked jobs as failed" />
|
||||
<input type="image" class="icon" name="action" id="redo-top" value="retry" src="{$base_uri}images/redo.png" alt="Repeat all marked jobs" />
|
||||
<input type="image" class="icon" name="action" id="delete-top" value="delete" src="{$base_uri}images/trash.png" alt="Delete all marked jobs" />
|
||||
<input type="image" class="icon" name="action" id="fix-broken-timestamps-top" value="fix-broken-timestamps" src="{$base_uri}images/clock.png" alt="Fix Broken Timestamps in Statuses" />
|
||||
</fieldset>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -60,6 +61,7 @@
|
||||
<input type="image" class="icon" name="action" id="mark-failed-{$job->id()}" value="mark-failed[{$job->id()}]" src="{$base_uri}images/caution.png" alt="Mark job as failed" />
|
||||
<input type="image" class="icon" name="action" id="redo-{$job->id()}" value="retry[{$job->id()}]" src="{$base_uri}images/redo.png" alt="Repeat job" />
|
||||
<input type="image" class="icon" name="action" id="delete-{$job->id()}" value="delete[{$job->id()}]" src="{$base_uri}images/trash.png" alt="Delete job" />
|
||||
<input type="image" class="icon" name="action" id="fix-broken-timestamps-{$job->id()}" value="fix-broken-timestamps[{$job->id()}]" src="{$base_uri}images/clock.png" alt="Fix broken status timestamps" />
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -72,6 +74,7 @@
|
||||
<input type="image" class="icon" name="action" id="mark-failed-bottom" value="mark-failed" src="{$base_uri}images/caution.png" alt="Mark all marked jobs as failed" />
|
||||
<input type="image" class="icon" name="action" id="redo-bottom" value="retry" src="{$base_uri}images/redo.png" alt="Repeat all marked jobs" />
|
||||
<input type="image" class="icon" name="action" id="delete-bottom" value="delete" src="{$base_uri}images/trash.png" alt="Delete all marked jobs" />
|
||||
<input type="image" class="icon" name="action" id="fix-broken-timestamps-bottom" value="fix-broken-timestamps" src="{$base_uri}images/clock.png" alt="Fix Broken Timestamps in Statuses" />
|
||||
</fieldset>
|
||||
</form>
|
||||
{else}
|
||||
|
||||
Reference in New Issue
Block a user