* Added --no-start to tools/anvil-daemon to allow for updating just the jobs.json file. Fixed a bug where a comma was missing when 2+ jobs were written to the JSON file as well.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 6 years ago
parent 15994727fb
commit 12073ffa08
  1. 4
      html/skins/alteeve/jobs.js
  2. 8
      tools/anvil-daemon

@ -4,10 +4,12 @@ $.ajaxSetup({
// TODO: Loop through jobs found on HTML and hide and divs that aren't found in jobs.json.
$(function() {
var say_status_waiting = $('input#status_waiting').val();
//console.log('say_status_waiting: ['+say_status_waiting+']');
if($("#running_jobs").length) {
//console.log('Looking for running jobs.');
setInterval(function() {
$.getJSON('/status/jobs.json', { get_param: 'value' }, function(data) {
//console.log('"/status/jobs.json" read.');
$.each(data.jobs, function(index, element) {
var progress = element.job_progress;
@ -40,6 +42,6 @@ $(function() {
}
else
{
//console.log('Jobs status not loaded.');
//console.log('"running_jobs" div not found.');
}
});

@ -58,8 +58,9 @@ if (not $anvil->data->{sys}{database}{connections})
}
# Read switches
$anvil->data->{switches}{'run-once'} = "";
$anvil->data->{switches}{'run-once'} = "";
$anvil->data->{switches}{'main-loop-only'} = "";
$anvil->data->{switches}{'no-start'} = 0;
$anvil->Get->switches;
# There are some things we only want to run on (re)start and don't need to always run.
@ -362,13 +363,13 @@ sub run_jobs
updated_seconds_ago => $updated_seconds_ago,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { json_string => $json_string }});
$jobs_file .= $json_string."\n";
$jobs_file .= $json_string.",\n";
# If the job is done, move on.
next if $job_progress eq "100";
# If the job is not running, start it.
if (not $job_picked_up_by)
if ((not $job_picked_up_by) && (not $anvil->data->{switches}{'no-start'}))
{
# Start the job, appending '--job-uuid' to the command.
$anvil->data->{jobs}{handles}{$job_uuid} = $anvil->System->call({
@ -389,6 +390,7 @@ sub run_jobs
}
# Close the jobs file.
$jobs_file =~ s/,\n$/\n/ms;
$jobs_file .= "]}\n";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { jobs_file => $jobs_file }});

Loading…
Cancel
Save