- scheduler: fix nasty bug where SCHED_DB_RESULT::parse()

was doing memset(this, 0, sizeof(RESULT)),
    i.e. it wasn't zeroing out the whole structure.
    The elapsed_time field (which isn't reported by old clients),
    is near the end of the struct,
    and it was getting garbage, e.g. 1e-304, in some cases,
    which led to zero credit (and maybe other problems)
- validator: treat 1e-304 like zero in case of other problems
    like the above.
- remote job submission: tweaks


svn path=/trunk/boinc/; revision=23947
This commit is contained in:
David Anderson 2011-08-08 04:37:53 +00:00
parent e033c50df6
commit 578d5f924f
5 changed files with 52 additions and 19 deletions

View File

@ -4686,10 +4686,29 @@ David 7 Aug 2011
submit.php
David 7 Aug 2011
- client: projects with zero resource share are always lower priority,
for both job sched and work fetch,
than projects with positive resource share.
- client: projects with zero resource share are always lower priority,
for both job sched and work fetch,
than projects with positive resource share.
client/
cpu_sched.cpp
work_fetch.cpp
client/
cpu_sched.cpp
work_fetch.cpp
David 7 Aug 2011
- scheduler: fix nasty bug where SCHED_DB_RESULT::parse()
was doing memset(this, 0, sizeof(RESULT)),
i.e. it wasn't zeroing out the whole structure.
The elapsed_time field (which isn't reported by old clients),
is near the end of the struct,
and it was getting garbage, e.g. 1e-304, in some cases,
which led to zero credit (and maybe other problems)
- validator: treat 1e-304 like zero in case of other problems
like the above.
- remote job submission: tweaks
sched/
credit.cpp
sched_types.cpp
html/user/
submit_example.php
submit.php

View File

@ -188,14 +188,13 @@ function submit_batch($r) {
echo "<batch_id>$batch_id</batch_id>\n";
}
// compute and update params of a batch
// given its WUs, compute params of a batch
// NOTE: eventually this should be done by server components
// (transitioner, validator etc.) as jobs complete or time out
//
// TODO: update est_completion_time
//
function get_batch_params($batch, $wus) {
if ($batch->state > BATCH_STATE_IN_PROGRESS) return $batch;
$fp_total = 0;
$fp_done = 0;
$completed = true;
@ -248,8 +247,10 @@ function query_batches($r) {
$batches = BoincBatch::enum("user_id = $user->id");
echo "<batches>\n";
foreach ($batches as $batch) {
$wus = BoincWorkunit::enum("batch = $batch->id");
$batch = get_batch_params($batch, $wus);
if ($batch->state < BATCH_STATE_COMPLETE) {
$wus = BoincWorkunit::enum("batch = $batch->id");
$batch = get_batch_params($batch, $wus);
}
echo " <batch>\n";
print_batch_params($batch);
echo " </batch>\n";
@ -355,6 +356,17 @@ function retire_batch($r) {
echo "<success>1</success>";
}
if (0) {
$r = simplexml_load_string("
<query_batch>
<authenticator>x</authenticator>
<batch_id>54</batch_id>
</query_batch>
");
query_batch($r);
exit;
}
if (0) {
$r = simplexml_load_string("
<query_job>

View File

@ -59,10 +59,13 @@ function handle_main() {
echo "
This is an example of a web interface
from remote submission of BOINC jobs.
for remote submission of BOINC jobs.
It lets you submit batches of jobs,
and see the status of in-progress and completed batches.
<p>
To use this, you must be logged in as a user
with permission to submit jobs.
<p>
";
show_button("submit_example.php?action=create_form", "Create new batch");
@ -71,7 +74,7 @@ function handle_main() {
if ($batch->state != BATCH_STATE_IN_PROGRESS) continue;
if ($first) {
$first = false;
echo "<h2>In progress</h2>\n";
echo "<h2>Batches in progress</h2>\n";
start_table();
table_header("name", "ID", "app", "# jobs", "progress", "submitted");
}
@ -411,9 +414,6 @@ function handle_abort_batch() {
$errmsg = boinc_abort_batch($req);
if ($errmsg) error_page($errmsg);
page_head("Batch aborted");
echo "
<a href=submit_example.php>Return to job control page</a>.
";
echo "<p><a href=submit_example.php>Return to job control page</a>\n";
page_tail();
}

View File

@ -406,7 +406,9 @@ int get_pfc(
// old clients report CPU time but not elapsed time.
// Use HOST_APP_VERSION.et to track statistics of CPU time.
//
if (!r.elapsed_time) {
if (r.elapsed_time < 1e-6) {
// in case buggy client reports elapsed time like 1e-304
if (config.debug_credit) {
log_messages.printf(MSG_NORMAL,
"[credit] [RESULT#%d] old client (elapsed time not reported)\n",

View File

@ -61,7 +61,7 @@ int CLIENT_APP_VERSION::parse(FILE* f) {
char buf[256];
double x;
memset(this, 0, sizeof(CLIENT_APP_VERSION));
memset(this, 0, sizeof(*this));
host_usage.avg_ncpus = 1;
while (fgets(buf, sizeof(buf), f)) {
if (match_tag(buf, "</app_version>")) {
@ -110,7 +110,7 @@ int CLIENT_APP_VERSION::parse(FILE* f) {
int FILE_INFO::parse(FILE* f) {
char buf[256];
memset(this, 0, sizeof(FILE_INFO));
memset(this, 0, sizeof(*this));
while (fgets(buf, sizeof(buf), f)) {
if (match_tag(buf, "</file_info>")) {
if (!strlen(name)) return ERR_XML_PARSE;
@ -1099,7 +1099,7 @@ int SCHED_DB_RESULT::parse_from_client(FILE* fin) {
// should be non-zero if exit_status is not found
exit_status = ERR_NO_EXIT_STATUS;
memset(this, 0, sizeof(RESULT));
memset(this, 0, sizeof(*this));
while (fgets(buf, sizeof(buf), fin)) {
if (match_tag(buf, "</result>")) {
return 0;