diff --git a/html/inc/submit_db.inc b/html/inc/submit_db.inc index bb2bd797c8..b91ac84e8b 100644 --- a/html/inc/submit_db.inc +++ b/html/inc/submit_db.inc @@ -112,7 +112,7 @@ class BoincJobFile { } function delete() { $db = BoincDb::get(); - $db->delete(this, 'job_file'); + $db->delete($this, 'job_file'); } function update($clause) { $db = BoincDb::get(); @@ -133,7 +133,9 @@ class BoincBatchFileAssoc { } function delete() { $db = BoincDb::get(); - $db->delete(this, 'batch_file_assoc'); + $db->delete_aux('batch_file_assoc', + "job_file_id=$this->job_file_id and batch_id=$this->batch_id" + ); } } diff --git a/html/user/job_file.php b/html/user/job_file.php index 62f150aee8..233dda1e92 100644 --- a/html/user/job_file.php +++ b/html/user/job_file.php @@ -100,7 +100,7 @@ function query_files($r) { if ($job_file && $job_file->delete_time < $delete_time) { $retval = $job_file::update("delete_time=$delete_time"); if ($retval) { - xml_error(-1, "job_file::update() failed"); + xml_error(-1, "job_file::update() failed: "+mysql_error()); } } if (file_exists($path)) { @@ -119,7 +119,11 @@ function query_files($r) { $ret = BoincBatchFileAssoc::insert( "(batch_id, job_file_id) values ($batch_id, $jf_id)" ); - if (!$ret) xml_error(-1, "BointBatchFileAssoc::insert() failed"); + if (!$ret) { + xml_error(-1, + "BoincBatchFileAssoc::insert() failed: "+mysql_error() + ); + } } } else { if ($job_file) { @@ -141,7 +145,7 @@ function upload_files($r) { $fanout = parse_config(get_config(), ""); $delete_time = (int)$r->delete_time; $batch_id = (int)$r->batch_id; - print_r($_FILES); + //print_r($_FILES); $i = 0; foreach ($r->md5 as $f) { $md5 = (string)$f; @@ -154,11 +158,11 @@ function upload_files($r) { $path = dir_hier_path($fname, "../../download", $fanout); rename($tmp_name, $path); $now = time(); - $id = BoincJobFile::insert( + $jf_id = BoincJobFile::insert( "(md5, create_time, delete_time) values ('$md5', $now, $delete_time)" ); - if (!$id) { - xml_error(-1, "BoincJobFile::insert() failed"); + if (!$jf_id) { + xml_error(-1, "BoincJobFile::insert($md5) failed: "+mysql_error()); } if ($batch_id) { BoincBatchFileAssoc::insert( diff --git a/html/user/submit_rpc_handler.php b/html/user/submit_rpc_handler.php index ce59a31671..0d894b3862 100644 --- a/html/user/submit_rpc_handler.php +++ b/html/user/submit_rpc_handler.php @@ -134,7 +134,7 @@ function submit_job($job, $template, $app, $batch_id, $i, $priority) { if ($job->command_line) { $cmd .= " --command_line \"$job->command_line\""; } - $cmd .= " --wu_name batch_".$batch_id."_".$i; + $cmd .= " --wu_name $job->name"; foreach ($job->input_files as $file) { $cmd .= " $file->name"; } @@ -150,6 +150,7 @@ function xml_get_jobs($r) { $job = new StdClass; $job->input_files = array(); $job->command_line = (string)$j->command_line; + $job->name = (string)$j->name; $job->rsc_fpops_est = (double)$j->rsc_fpops_est; foreach ($j->input_file as $f) { $file = new StdClass; diff --git a/lib/remote_submit.cpp b/lib/remote_submit.cpp index 399a7007e5..8b604db047 100644 --- a/lib/remote_submit.cpp +++ b/lib/remote_submit.cpp @@ -34,6 +34,8 @@ using std::vector; using std::string; +//#define SHOW_REPLY + // do an HTTP GET request. // static int do_http_get( @@ -152,7 +154,9 @@ int query_files( retval = -1; error_msg = ""; while (fgets(buf, 256, reply)) { - //printf("reply: %s", buf); +#ifdef SHOW_REPLY + printf("query_files reply: %s", buf); +#endif if (strstr(buf, "absent_files")) { retval = 0; continue; @@ -202,7 +206,9 @@ int upload_files ( retval = -1; error_msg = ""; while (fgets(buf, 256, reply)) { - //printf("upload_files reply: %s", buf); +#ifdef SHOW_REPLY + printf("upload_files reply: %s", buf); +#endif if (strstr(buf, "success")) { retval = 0; continue; @@ -250,7 +256,9 @@ int create_batch( int error_num = 0; error_msg = ""; while (fgets(buf, 256, reply)) { - //printf("create_batch reply: %s", buf); +#ifdef SHOW_REPLY + printf("create_batch reply: %s", buf); +#endif if (parse_int(buf, "", batch_id)) continue; if (parse_int(buf, "", error_num)) continue; if (parse_str(buf, "", error_msg)) continue; @@ -279,8 +287,10 @@ int submit_jobs( ); string request = buf; for (unsigned int i=0; i%s\n", job.job_name); + request += buf; if (!job.cmdline_args.empty()) { request += "" + job.cmdline_args + "\n"; } @@ -317,7 +327,9 @@ int submit_jobs( error_msg = ""; int temp; while (fgets(buf, 256, reply)) { - //printf("submit_batch reply: %s", buf); +#ifdef SHOW_REPLY + printf("submit_batch reply: %s", buf); +#endif if (parse_int(buf, "", temp)) { retval = 0; continue; @@ -358,6 +370,9 @@ int query_batches( retval = -1; error_msg = ""; while (fgets(buf, 256, reply)) { +#ifdef SHOW_REPLY + printf("query_batches reply: %s", buf); +#endif if (strstr(buf, "jobs")) { retval = 0; continue; @@ -367,6 +382,9 @@ int query_batches( if (strstr(buf, "")) { QUERY_BATCH_JOB qbj; while (fgets(buf, 256, reply)) { +#ifdef SHOW_REPLY + printf("query_batches reply: %s", buf); +#endif if (strstr(buf, "")) { qb_reply.jobs.push_back(qbj); } @@ -411,6 +429,9 @@ int abort_jobs( retval = -1; error_msg = ""; while (fgets(buf, 256, reply)) { +#ifdef SHOW_REPLY + printf("abort_jobs reply: %s", buf); +#endif if (strstr(buf, "success")) { retval = 0; continue; @@ -455,6 +476,9 @@ int get_templates( error_msg = ""; fseek(reply, 0, SEEK_SET); while (fgets(buf, 256, reply)) { +#ifdef SHOW_REPLY + printf("get_templates reply: %s", buf); +#endif if (parse_int(buf, "", retval)) continue; if (parse_str(buf, "", error_msg)) continue; if (strstr(buf, "")) { @@ -565,6 +589,9 @@ int query_completed_job( error_msg = ""; fseek(reply, 0, SEEK_SET); while (fgets(buf, 256, reply)) { +#ifdef SHOW_REPLY + printf("query_completed_job reply: %s", buf); +#endif if (parse_int(buf, "", retval)) continue; if (parse_str(buf, "", error_msg)) continue; if (strstr(buf, "")) { @@ -597,7 +624,9 @@ int ping_server( error_msg = ""; fseek(reply, 0, SEEK_SET); while (fgets(buf, 256, reply)) { - //printf("reply: %s\n", buf); +#ifdef SHOW_REPLY + printf("reply: %s\n", buf); +#endif if (parse_int(buf, "", retval)) continue; if (parse_str(buf, "", error_msg)) continue; if (strstr(buf, "success")) {