diff options
author | Andrew Gaffney <agaffney@gentoo.org> | 2008-01-12 03:58:23 +0000 |
---|---|---|
committer | Andrew Gaffney <agaffney@gentoo.org> | 2008-01-12 03:58:23 +0000 |
commit | 13b6e17a910ca12433f77c7c4e62e3d1c1ef8a3e (patch) | |
tree | c9a5c136edf985c2b71734793ae6108c42ee3674 | |
parent | use proper form for send_command() (diff) | |
download | scire-13b6e17a910ca12433f77c7c4e62e3d1c1ef8a3e.tar.gz scire-13b6e17a910ca12433f77c7c4e62e3d1c1ef8a3e.tar.bz2 scire-13b6e17a910ca12433f77c7c4e62e3d1c1ef8a3e.zip |
let's actually run the jobs we get...untested
svn path=/branches/new-fu/; revision=350
-rwxr-xr-x | client/scireclient.pl | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/client/scireclient.pl b/client/scireclient.pl index c054e17..a9cfe20 100755 --- a/client/scireclient.pl +++ b/client/scireclient.pl @@ -37,6 +37,24 @@ sub run_main { } } + my @new_jobs = glob("$conf{job_dir}/queue/*.job"); + for (@new_jobs) { + my $job = Scire::Job->new(); + $job->load_jobfile($_); + $job->set_stdout_file("$conf{job_dir}/queue/$job->{jobid}.out"); + $job->set_stderr_file("$conf{job_dir}/queue/$job->{jobid}.err"); + $job->set_script_file("$conf{job_dir}/queue/$job->{jobid}.script"); + my $exitcode = $job->run(); + if(!$exitcode) { + # Successful job completion + system("mv $conf{job_dir}/queue/$job->{jobid}.* $conf{job_dir}/done/"); + } else { + # Job failed + system("mv $conf{job_dir}/queue/$job->{jobid}.* $conf{job_dir}/failed/"); + } + } + + talk_to_server(); } sub talk_to_server { @@ -196,10 +214,14 @@ sub get_jobs { sub scan_jobs_dir { #Scan the dirs for job files. - my @existing_jobs = glob("$conf{job_dir}/queue/*"); - my @failed_jobs = glob("$conf{job_dir}/failed/*"); - my @done_jobs = glob("$conf{job_dir}/done/*"); + my @existing_jobs = glob("$conf{job_dir}/queue/*.job"); + my @failed_jobs = glob("$conf{job_dir}/failed/*.job"); + my @done_jobs = glob("$conf{job_dir}/done/*.job"); + # XXX: this function should just scan the various job dirs, create a Scire::Job object + # for each job found, and return a structure containing the info, so that another + # function can act on the completed jobs + #Report on those jobs needing reporting. foreach my $job_file (@failed_jobs) { $job_file =~ /(\d+)\.job/; @@ -215,6 +237,7 @@ sub scan_jobs_dir { $job_file =~ /(\d+)\.job/; my $jobid = $1; my ($status, $message) = $comm->send_command("SET_JOB_STATUS", $jobid, "Done"); + # XXX: Send job output } return @existing_jobs; |