diff --git a/checkin_notes b/checkin_notes index 009ec25b3c..9de5ec82e8 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/html/user/submit.php b/html/user/submit.php index f69613a355..6a74d5593f 100644 --- a/html/user/submit.php +++ b/html/user/submit.php @@ -188,14 +188,13 @@ function submit_batch($r) { echo "$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 "\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 " \n"; print_batch_params($batch); echo " \n"; @@ -355,6 +356,17 @@ function retire_batch($r) { echo "1"; } +if (0) { +$r = simplexml_load_string(" + + x + 54 + +"); +query_batch($r); +exit; +} + if (0) { $r = simplexml_load_string(" diff --git a/html/user/submit_example.php b/html/user/submit_example.php index c2da8db227..f9c62ff9aa 100644 --- a/html/user/submit_example.php +++ b/html/user/submit_example.php @@ -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.

+ To use this, you must be logged in as a user + with permission to submit jobs. +

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

In progress

\n"; + echo "

Batches in progress

\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 " - Return to job control page. - "; echo "

Return to job control page\n"; page_tail(); } diff --git a/sched/credit.cpp b/sched/credit.cpp index 926c0b2aa5..23e754a9cb 100644 --- a/sched/credit.cpp +++ b/sched/credit.cpp @@ -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", diff --git a/sched/sched_types.cpp b/sched/sched_types.cpp index 851592d879..11a971a5c1 100644 --- a/sched/sched_types.cpp +++ b/sched/sched_types.cpp @@ -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, "")) { @@ -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, "")) { 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, "")) { return 0;