Condor interface: bug fixes, and set WU names correctly

This commit is contained in:
David Anderson 2013-05-28 23:14:17 -07:00
parent 3eb430eaec
commit 48e044fa76
4 changed files with 51 additions and 15 deletions

View File

@ -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"
);
}
}

View File

@ -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(), "<uldl_dir_fanout>");
$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(

View File

@ -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;

View File

@ -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>", batch_id)) continue;
if (parse_int(buf, "<error_num>", error_num)) continue;
if (parse_str(buf, "<error_msg>", error_msg)) continue;
@ -279,8 +287,10 @@ int submit_jobs(
);
string request = buf;
for (unsigned int i=0; i<req.jobs.size(); i++) {
JOB job=req.jobs[i];
JOB job = req.jobs[i];
request += "<job>\n";
sprintf(buf, " <name>%s</name>\n", job.job_name);
request += buf;
if (!job.cmdline_args.empty()) {
request += "<command_line>" + job.cmdline_args + "</command_line>\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, "<batch_id>", 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, "<job>")) {
QUERY_BATCH_JOB qbj;
while (fgets(buf, 256, reply)) {
#ifdef SHOW_REPLY
printf("query_batches reply: %s", buf);
#endif
if (strstr(buf, "</job>")) {
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, "<error_num>", retval)) continue;
if (parse_str(buf, "<error_msg>", error_msg)) continue;
if (strstr(buf, "<templates>")) {
@ -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, "<error_num>", retval)) continue;
if (parse_str(buf, "<error_msg>", error_msg)) continue;
if (strstr(buf, "<completed_job>")) {
@ -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, "<error_num>", retval)) continue;
if (parse_str(buf, "<error_msg>", error_msg)) continue;
if (strstr(buf, "success")) {