From 944e5a3b2970078969efa8bf55cbb9d3999a87aa Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 21 Apr 2014 13:19:10 -0700 Subject: [PATCH] job submission: generate physical name for remote input files Don't require job submitters to come up with (unique) names for remote input files. Just use "jf_MD5". --- html/user/submit_rpc_handler.php | 8 ++++---- tools/backend_lib.h | 9 +++++++-- tools/create_work.cpp | 2 -- tools/process_input_template.cpp | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/html/user/submit_rpc_handler.php b/html/user/submit_rpc_handler.php index 2652047216..afcbf0c4df 100644 --- a/html/user/submit_rpc_handler.php +++ b/html/user/submit_rpc_handler.php @@ -153,8 +153,6 @@ function stage_file($file) { xml_error(-1, "BOINC server: can't write to file $path"); } return $name; - case "remote": - return "jf_".$file->md5; } xml_error(-1, "BOINC server: unsupported file mode: $file->mode"); } @@ -164,7 +162,9 @@ function stage_file($file) { function stage_files(&$jobs, $template) { foreach($jobs as $job) { foreach ($job->input_files as $file) { - $file->name = stage_file($file); + if ($file->mode != "remote") { + $file->name = stage_file($file); + } } } } @@ -180,7 +180,7 @@ function submit_jobs($jobs, $template, $app, $batch_id, $priority) { } foreach ($job->input_files as $file) { if ($file->mode == "remote") { - $x .= " --remote_file $file->name $file->url $file->nbytes $file->md5"; + $x .= " --remote_file $file->url $file->nbytes $file->md5"; } else { $x .= " $file->name"; } diff --git a/tools/backend_lib.h b/tools/backend_lib.h index 6d82353370..f57d6b94a5 100644 --- a/tools/backend_lib.h +++ b/tools/backend_lib.h @@ -27,12 +27,17 @@ // describes an input file, possibly remote // struct INFILE_DESC { - char name[1024]; // physical name bool is_remote; - // the following defined if remote + + // the following defined if remote (physical name is jf_MD5) + // double nbytes; char md5[64]; char url[1024]; // make this a vector to support multiple URLs + + // the following defined if not remote + // + char name[1024]; // physical name }; extern int add_signatures(char*, R_RSA_PRIVATE_KEY&); diff --git a/tools/create_work.cpp b/tools/create_work.cpp index fd2767ff1c..7d191b7fb1 100644 --- a/tools/create_work.cpp +++ b/tools/create_work.cpp @@ -141,7 +141,6 @@ void JOB_DESC::parse_cmdline(int argc, char** argv) { } else if (arg(argv, i, (char*)"remote_file")) { INFILE_DESC id; id.is_remote = true; - strcpy(id.name, argv[++i]); strcpy(id.url, argv[++i]); id.nbytes = atof(argv[++i]); strcpy(id.md5, argv[++i]); @@ -261,7 +260,6 @@ int main(int argc, char** argv) { } else if (arg(argv, i, (char*)"remote_file")) { INFILE_DESC id; id.is_remote = true; - strcpy(id.name, argv[++i]); strcpy(id.url, argv[++i]); id.nbytes = atof(argv[++i]); strcpy(id.md5, argv[++i]); diff --git a/tools/process_input_template.cpp b/tools/process_input_template.cpp index 29f372e415..03bc2bd5f6 100644 --- a/tools/process_input_template.cpp +++ b/tools/process_input_template.cpp @@ -239,12 +239,12 @@ static int process_file_info( strcat(buf, "\n"); } else if (infile.is_remote) { sprintf(buf, - " %s\n" + " jf_%s\n" " %s\n" " %s\n" " %.0f\n" "\n", - infile.name, + infile.md5, infile.url, infile.md5, infile.nbytes