From 9be3d2375b5347d420e69acd8201762dd0a2608c Mon Sep 17 00:00:00 2001 From: Preston Cody Date: Wed, 2 Jan 2008 02:01:51 +0000 Subject: add debug to response line added other paths to check_job_dir fixed up get_job a bit. svn path=/branches/new-fu/; revision=310 --- client/scireclient.pl | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/client/scireclient.pl b/client/scireclient.pl index 1da3dcd..640b3ec 100755 --- a/client/scireclient.pl +++ b/client/scireclient.pl @@ -95,6 +95,7 @@ sub send_command { #FIXME WE NEED A TIMEOUT HERE OF SOME SORT!! #if the server doesn't give you a newline this just hangs! my $response = ; + debug("Got response: ${response}"); return $response; } @@ -141,6 +142,21 @@ sub check_job_dir { mkpath( $conf{job_dir}, {verbose => 1, mode => 0660}) or die("Couldn't make $conf{job_dir} w/ perms 0660: $!"); } + if (! -d "$conf{job_dir}/queue") { + print "WARNING! $conf{job_dir}/queue does not exist...creating\n"; + mkpath( "$conf{job_dir}/queue", {verbose => 1, mode => 0660}) + or die("Couldn't make $conf{job_dir}/queue w/ perms 0660: $!"); + } + if (! -d "$conf{job_dir}/done") { + print "WARNING! $conf{job_dir}/done does not exist...creating\n"; + mkpath( "$conf{job_dir}/done", {verbose => 1, mode => 0660}) + or die("Couldn't make $conf{job_dir}/done w/ perms 0660: $!"); + } + if (! -d "$conf{job_dir}/failed") { + print "WARNING! $conf{job_dir}/failed does not exist...creating\n"; + mkpath( "$conf{job_dir}/failed", {verbose => 1, mode => 0660}) + or die("Couldn't make $conf{job_dir}/failed w/ perms 0660: $!"); + } } sub read_config_file { @@ -203,14 +219,11 @@ sub get_jobs { $jobs =~ s/\s//g; #Remove all whitespace my @jobs_list = split(/,/, $jobs); foreach my $job (@jobs_list) { - my ($status, $message) = parse_response(send_command("GET_JOB", $job)); - open(JOBFILE, ">$conf{job_dir}/queue/${job}.job") or do { - print "Could not open $conf{job_dir}/queue/${job}.job for writing: $!"; - next; - }; + my ($status, $filename) = parse_response(send_command("GET_JOB", $job)); + #SCP the file to $conf{job_dir}/queue/ + + system("cp $filename $conf{job_dir}/queue/") and die("Can't copy file: $!"); #Temporary hack. only works locally. # XXX: Modify this to fetch a file instead -# print JOBFILE parse_response($resp); - close(JOBFILE); debug("Fetched job $job "); } #This function doesn't actually need to do anything with the list of jobs, the executor handles that part. -- cgit v1.2.3-65-gdbad