- validator/assimilator: parse <file_ref>s rather than <file_info>s;

the latter is where the <optional/> flag is.

svn path=/trunk/boinc/; revision=15337
This commit is contained in:
David Anderson 2008-05-30 03:29:31 +00:00
parent 97239eb35c
commit c9d38091e7
4 changed files with 26 additions and 5 deletions

View File

@ -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 <file_ref>s rather than <file_info>s;
the latter is where the <optional/> flag is.
sched/
validate_util.C
sched/
validate_util.C

View File

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

View File

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

View File

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