diff options
Diffstat (limited to 'client/scireclient.pl')
-rwxr-xr-x | client/scireclient.pl | 27 |
1 files 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 = <SERVER_STDOUT>; + 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. |