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".
This commit is contained in:
David Anderson 2014-04-21 13:19:10 -07:00
parent 6c3a5792e2
commit 944e5a3b29
4 changed files with 13 additions and 10 deletions

View File

@ -153,8 +153,6 @@ function stage_file($file) {
xml_error(-1, "BOINC server: can't write to file $path"); xml_error(-1, "BOINC server: can't write to file $path");
} }
return $name; return $name;
case "remote":
return "jf_".$file->md5;
} }
xml_error(-1, "BOINC server: unsupported file mode: $file->mode"); xml_error(-1, "BOINC server: unsupported file mode: $file->mode");
} }
@ -164,7 +162,9 @@ function stage_file($file) {
function stage_files(&$jobs, $template) { function stage_files(&$jobs, $template) {
foreach($jobs as $job) { foreach($jobs as $job) {
foreach ($job->input_files as $file) { 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) { foreach ($job->input_files as $file) {
if ($file->mode == "remote") { 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 { } else {
$x .= " $file->name"; $x .= " $file->name";
} }

View File

@ -27,12 +27,17 @@
// describes an input file, possibly remote // describes an input file, possibly remote
// //
struct INFILE_DESC { struct INFILE_DESC {
char name[1024]; // physical name
bool is_remote; bool is_remote;
// the following defined if remote
// the following defined if remote (physical name is jf_MD5)
//
double nbytes; double nbytes;
char md5[64]; char md5[64];
char url[1024]; // make this a vector to support multiple URLs 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&); extern int add_signatures(char*, R_RSA_PRIVATE_KEY&);

View File

@ -141,7 +141,6 @@ void JOB_DESC::parse_cmdline(int argc, char** argv) {
} else if (arg(argv, i, (char*)"remote_file")) { } else if (arg(argv, i, (char*)"remote_file")) {
INFILE_DESC id; INFILE_DESC id;
id.is_remote = true; id.is_remote = true;
strcpy(id.name, argv[++i]);
strcpy(id.url, argv[++i]); strcpy(id.url, argv[++i]);
id.nbytes = atof(argv[++i]); id.nbytes = atof(argv[++i]);
strcpy(id.md5, 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")) { } else if (arg(argv, i, (char*)"remote_file")) {
INFILE_DESC id; INFILE_DESC id;
id.is_remote = true; id.is_remote = true;
strcpy(id.name, argv[++i]);
strcpy(id.url, argv[++i]); strcpy(id.url, argv[++i]);
id.nbytes = atof(argv[++i]); id.nbytes = atof(argv[++i]);
strcpy(id.md5, argv[++i]); strcpy(id.md5, argv[++i]);

View File

@ -239,12 +239,12 @@ static int process_file_info(
strcat(buf, "</file_info>\n"); strcat(buf, "</file_info>\n");
} else if (infile.is_remote) { } else if (infile.is_remote) {
sprintf(buf, sprintf(buf,
" <name>%s</name>\n" " <name>jf_%s</name>\n"
" <url>%s</url>\n" " <url>%s</url>\n"
" <md5_cksum>%s</md5_cksum>\n" " <md5_cksum>%s</md5_cksum>\n"
" <nbytes>%.0f</nbytes>\n" " <nbytes>%.0f</nbytes>\n"
"</file_info>\n", "</file_info>\n",
infile.name, infile.md5,
infile.url, infile.url,
infile.md5, infile.md5,
infile.nbytes infile.nbytes