From c9d38091e77795a193d92538ba75bd6f8d6169ba Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 30 May 2008 03:29:31 +0000 Subject: [PATCH] - validator/assimilator: parse s rather than s; the latter is where the flag is. svn path=/trunk/boinc/; revision=15337 --- checkin_notes | 9 +++++++++ db/bossa_schema.sql | 1 + html/inc/bossa_db.inc | 15 +++++++++++++-- sched/validate_util.C | 6 +++--- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index 80721ed9ac..09f7cf8f83 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4583,3 +4583,12 @@ David May 29 2008 single_job_assimilator.C validate_util.C,h validator.C + +David May 29 2008 + - validator/assimilator: parse s rather than s; + the latter is where the flag is. + + sched/ + validate_util.C + sched/ + validate_util.C diff --git a/db/bossa_schema.sql b/db/bossa_schema.sql index 4d046e3165..f9460699de 100644 --- a/db/bossa_schema.sql +++ b/db/bossa_schema.sql @@ -35,6 +35,7 @@ create table bossa_job ( create table bossa_job_inst ( id integer not null auto_increment, create_time integer not null, + app_id integer not null, job_id integer not null, user_id integer not null, finish_time integer not null, diff --git a/html/inc/bossa_db.inc b/html/inc/bossa_db.inc index 647dc90d1c..24cc63bfb1 100644 --- a/html/inc/bossa_db.inc +++ b/html/inc/bossa_db.inc @@ -122,7 +122,7 @@ class BossaJobInst { function insert() { $db = BossaDb::get(); $now = time(); - $query = "insert into DBNAME.bossa_job_inst (create_time, job_id, user_id, confidence) values ($now, $this->job_id, $this->user_id, $this->confidence)"; + $query = "insert into DBNAME.bossa_job_inst (create_time, app_id, job_id, user_id, confidence) values ($now, $this->app_id, $this->job_id, $this->user_id, $this->confidence)"; $result = $db->do_query($query); if (!$result) { echo "$query\n"; @@ -150,11 +150,21 @@ class BossaJobInst { // Returns the job instance or NULL. // static function assign($app, $user) { + $db = BossaDb::get(); + // first look for unfinished jobs + // + $query = "select * from DBNAME.bossa_job_inst where app_id=$app->id and user_id=$user->id and finish_time=0 limit 1"; + $result = $db->do_query($query); + if ($result) { + $ji = mysql_fetch_object($result, 'BossaJobInst'); + mysql_free_result($result); + return $ji; + } + // this query skips jobs for which this user // has already been assigned an instance // // TODO: put the following in a transaction - $db = BossaDb::get(); $query = "select * from DBNAME.bossa_job where app_id=$app->id and (select count(*) from DBNAME.bossa_job_inst where job_id=bossa_job.id and user_id=$user->id) = 0 limit 1"; $result = $db->do_query($query); if (!$result) return null; @@ -166,6 +176,7 @@ class BossaJobInst { $ji->user_id = $user->id; $ji->job_id = $job->id; $ji->confidence = $user->conf; + $ji->app_id = $app->id; if (!$ji->insert()) { echo mysql_error(); diff --git a/sched/validate_util.C b/sched/validate_util.C index 32cb91b964..0166e35349 100644 --- a/sched/validate_util.C +++ b/sched/validate_util.C @@ -46,10 +46,10 @@ int FILE_INFO::parse(XML_PARSER& xp) { optional = false; while (!xp.get(tag, sizeof(tag), is_tag)) { if (!is_tag) continue; - if (!strcmp(tag, "/file_info")) { + if (!strcmp(tag, "/file_ref")) { return found?0:ERR_XML_PARSE; } - if (xp.parse_string(tag, "name", name)) { + if (xp.parse_string(tag, "file_name", name)) { found = true; continue; } @@ -90,7 +90,7 @@ int get_output_file_infos(RESULT& result, vector& fis) { fis.clear(); while (!xp.get(tag, sizeof(tag), is_tag)) { if (!is_tag) continue; - if (!strcmp(tag, "file_info")) { + if (!strcmp(tag, "file_ref")) { FILE_INFO fi; int retval = fi.parse(xp); if (retval) return retval;