diff options
author | Andrew Gaffney <agaffney@gentoo.org> | 2008-01-01 03:08:59 +0000 |
---|---|---|
committer | Andrew Gaffney <agaffney@gentoo.org> | 2008-01-01 03:08:59 +0000 |
commit | 4c8c114b137aa40b4a9b75857922e7b671df9311 (patch) | |
tree | e9ebd8139239acbe2ceda545cfa7ad3612128e1f /server | |
parent | modify get_jobs query to make sure to get the latest job_history entry for th... (diff) | |
download | scire-4c8c114b137aa40b4a9b75857922e7b671df9311.tar.gz scire-4c8c114b137aa40b4a9b75857922e7b671df9311.tar.bz2 scire-4c8c114b137aa40b4a9b75857922e7b671df9311.zip |
fully implement get_jobs
svn path=/branches/new-fu/; revision=305
Diffstat (limited to 'server')
-rwxr-xr-x | server/scireserver.pl | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/server/scireserver.pl b/server/scireserver.pl index fd2da34..d8e27c3 100755 --- a/server/scireserver.pl +++ b/server/scireserver.pl @@ -75,8 +75,8 @@ while(<>) { } if ($command eq "GET_JOBS") { - get_jobs(); - + my @jobs = get_jobs(); + print "OK " . join(",", @jobs) . "\n"; } elsif ($command eq "GET_JOB") { my $job = $args[0]; get_job($job); @@ -108,7 +108,6 @@ sub read_config_file { debug("Conf file $conf_file read."); } - #New clients must be registered so they can be given a key to use (perhaps for job file transfers?) for authentication. This must be allowed before identifying. sub register_client { my ($mac,$ip, $hostname) = @_; @@ -174,7 +173,6 @@ sub register_client { print "OK $digest\n"; } - #Identify the client by looking up the fingerprint in the database, and matching it up. sub identify_client { my $digest = shift; @@ -199,7 +197,6 @@ sub identify_client { } - sub get_jobs { my $query = <<'EndOfQuery'; SELECT jobs.jobid @@ -213,12 +210,14 @@ sub get_jobs { EndOfQuery debug("Query is $query"); - #$sth = $dbh->prepare($query); - #$sth->execute($client_id,$status_id); - #my $jobs_ref = $sth->fetchall_arrayref(); - #return $jobs_ref; - + $sth = $dbh->prepare($query); + $sth->execute($client_id,$status_id); + my $jobs_ref = $sth->fetchall_arrayref(); + # Don't ask me...ask the guys in #perl :P + my @jobs = map { @$_ } @$jobs_ref; + return @jobs; } + sub get_job { my $jobid = shift; #Validate your inputs! @@ -239,6 +238,7 @@ sub get_job { my $filename = "$conf{job_dir}/$client_id/queue/$jobid.job"; return "OK $filename\n"; } + sub set_job_status { my ($jobid,$status) = @_; #Validate your inputs! |