/[scire]/branches/new-fu/client/scireclient.pl
Gentoo

Diff of /branches/new-fu/client/scireclient.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 312 Revision 313
201 my $digest = <FILE>; 201 my $digest = <FILE>;
202 chomp $digest; 202 chomp $digest;
203 close(FILE); 203 close(FILE);
204 my ($status, $message) = parse_response(send_command("IDENTIFY", $digest)); 204 my ($status, $message) = parse_response(send_command("IDENTIFY", $digest));
205 unless (defined $status && $status eq "OK") { 205 unless (defined $status && $status eq "OK") {
206 print "Could not identify to server: $message\n"; 206 print "ERROR Could not identify to server: $message\n";
207 return 0; 207 return 0;
208 } 208 }
209 debug("Client identified"); 209 debug("Client identified");
210 return 1; 210 return 1;
211} 211}
212 212
213sub get_jobs { 213sub get_jobs {
214 my ($status, $jobs) = parse_response(send_command("GET_JOBS")); 214 my ($status, $jobs) = parse_response(send_command("GET_JOBS"));
215 unless (defined $status && $status eq "OK") { 215 unless (defined $status && $status eq "OK") {
216 print "Could not get jobs list from server: $jobs\n"; 216 print "Could not get jobs list from server: $status\n";
217 return 0; 217 return 0;
218 } 218 }
219 if (defined($jobs) && $jobs) {
219 $jobs =~ s/\s//g; #Remove all whitespace 220 $jobs =~ s/\s//g; #Remove all whitespace
220 my @jobs_list = split(/,/, $jobs); 221 my @jobs_list = split(/,/, $jobs);
221 foreach my $job (@jobs_list) { 222 foreach my $job (@jobs_list) {
222 my ($status, $filename) = parse_response(send_command("GET_JOB", $job)); 223 my ($status, $filename) = parse_response(send_command("GET_JOB", $job));
223 #SCP the file to $conf{job_dir}/queue/ 224 #SCP the file to $conf{job_dir}/queue/
224 225
225 system("cp $filename $conf{job_dir}/queue/") and die("Can't copy file: $!"); #Temporary hack. only works locally. 226 system("cp $filename $conf{job_dir}/queue/") and die("Can't copy file: $!"); #Temporary hack. only works locally.
226 # XXX: Modify this to fetch a file instead 227 # XXX: Modify this to fetch a file instead
227 debug("Fetched job $job "); 228 debug("Fetched job $job ");
229 my ($status2,$message) = parse_response(send_command("JOB_FETCHED", $job));
230 unless (defined $status2 && $status2 eq "OK") {
231 die("ERROR Could not signal job was fetched: $message\n");
232 }
233
228 } 234 }
229 #This function doesn't actually need to do anything with the list of jobs, the executor handles that part. 235 #This function doesn't actually need to do anything with the list of jobs, the executor handles that part.
236 }
230} 237}
231 238
232sub scan_jobs_dir { 239sub scan_jobs_dir {
233 #Scan the dirs for job files. 240 #Scan the dirs for job files.
234 my @existing_jobs = glob("$conf{job_dir}/queue/*"); 241 my @existing_jobs = glob("$conf{job_dir}/queue/*");

Legend:
Removed from v.312  
changed lines
  Added in v.313

  ViewVC Help
Powered by ViewVC 1.1.20