mirror of https://github.com/BOINC/boinc.git
- 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:
parent
97239eb35c
commit
c9d38091e7
|
@ -4583,3 +4583,12 @@ David May 29 2008
|
||||||
single_job_assimilator.C
|
single_job_assimilator.C
|
||||||
validate_util.C,h
|
validate_util.C,h
|
||||||
validator.C
|
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
|
||||||
|
|
|
@ -35,6 +35,7 @@ create table bossa_job (
|
||||||
create table bossa_job_inst (
|
create table bossa_job_inst (
|
||||||
id integer not null auto_increment,
|
id integer not null auto_increment,
|
||||||
create_time integer not null,
|
create_time integer not null,
|
||||||
|
app_id integer not null,
|
||||||
job_id integer not null,
|
job_id integer not null,
|
||||||
user_id integer not null,
|
user_id integer not null,
|
||||||
finish_time integer not null,
|
finish_time integer not null,
|
||||||
|
|
|
@ -122,7 +122,7 @@ class BossaJobInst {
|
||||||
function insert() {
|
function insert() {
|
||||||
$db = BossaDb::get();
|
$db = BossaDb::get();
|
||||||
$now = time();
|
$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);
|
$result = $db->do_query($query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
echo "$query\n";
|
echo "$query\n";
|
||||||
|
@ -150,11 +150,21 @@ class BossaJobInst {
|
||||||
// Returns the job instance or NULL.
|
// Returns the job instance or NULL.
|
||||||
//
|
//
|
||||||
static function assign($app, $user) {
|
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
|
// this query skips jobs for which this user
|
||||||
// has already been assigned an instance
|
// has already been assigned an instance
|
||||||
//
|
//
|
||||||
// TODO: put the following in a transaction
|
// 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";
|
$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);
|
$result = $db->do_query($query);
|
||||||
if (!$result) return null;
|
if (!$result) return null;
|
||||||
|
@ -166,6 +176,7 @@ class BossaJobInst {
|
||||||
$ji->user_id = $user->id;
|
$ji->user_id = $user->id;
|
||||||
$ji->job_id = $job->id;
|
$ji->job_id = $job->id;
|
||||||
$ji->confidence = $user->conf;
|
$ji->confidence = $user->conf;
|
||||||
|
$ji->app_id = $app->id;
|
||||||
|
|
||||||
if (!$ji->insert()) {
|
if (!$ji->insert()) {
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
|
|
|
@ -46,10 +46,10 @@ int FILE_INFO::parse(XML_PARSER& xp) {
|
||||||
optional = false;
|
optional = false;
|
||||||
while (!xp.get(tag, sizeof(tag), is_tag)) {
|
while (!xp.get(tag, sizeof(tag), is_tag)) {
|
||||||
if (!is_tag) continue;
|
if (!is_tag) continue;
|
||||||
if (!strcmp(tag, "/file_info")) {
|
if (!strcmp(tag, "/file_ref")) {
|
||||||
return found?0:ERR_XML_PARSE;
|
return found?0:ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
if (xp.parse_string(tag, "name", name)) {
|
if (xp.parse_string(tag, "file_name", name)) {
|
||||||
found = true;
|
found = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ int get_output_file_infos(RESULT& result, vector<FILE_INFO>& fis) {
|
||||||
fis.clear();
|
fis.clear();
|
||||||
while (!xp.get(tag, sizeof(tag), is_tag)) {
|
while (!xp.get(tag, sizeof(tag), is_tag)) {
|
||||||
if (!is_tag) continue;
|
if (!is_tag) continue;
|
||||||
if (!strcmp(tag, "file_info")) {
|
if (!strcmp(tag, "file_ref")) {
|
||||||
FILE_INFO fi;
|
FILE_INFO fi;
|
||||||
int retval = fi.parse(xp);
|
int retval = fi.parse(xp);
|
||||||
if (retval) return retval;
|
if (retval) return retval;
|
||||||
|
|
Loading…
Reference in New Issue