function test_query_batch($req, $id) { $req->batch_id = $id; $req->get_cpu_time = true; list($r, $errmsg) = boinc_query_batch($req); if ($errmsg) { echo "Error: {$errmsg}\n"; } else { print_r($r); } }
function handle_query_batch() { global $project, $auth; $req = (object) array('project' => $project, 'authenticator' => $auth, 'batch_id' => get_int('batch_id')); list($batch, $errmsg) = boinc_query_batch($req); if ($errmsg) { error_page(htmlentities($errmsg)); } page_head("Batch {$req->batch_id}"); start_table(); row2("name", $batch->name); row2("application", $batch->app_name); row2("state", batch_state_string($batch->state)); row2("# jobs", $batch->njobs); row2("# error jobs", $batch->nerror_jobs); row2("progress", sprintf("%.0f%%", $batch->fraction_done * 100)); if ($batch->completion_time) { row2("completed", local_time_str($batch->completion_time)); } row2("GFLOP/hours, estimated", number_format(credit_to_gflop_hours($batch->credit_estimate), 2)); row2("GFLOP/hours, actual", number_format(credit_to_gflop_hours($batch->credit_canonical), 2)); end_table(); $url = boinc_get_output_files($req); show_button($url, "Get zipped output files"); switch ($batch->state) { case BATCH_STATE_IN_PROGRESS: echo "<br>"; show_button("submit_example.php?action=abort_batch_confirm&batch_id={$req->batch_id}", "Abort batch"); break; case BATCH_STATE_COMPLETE: case BATCH_STATE_ABORTED: echo "<br>"; show_button("submit_example.php?action=retire_batch_confirm&batch_id={$req->batch_id}", "Retire batch"); break; } echo "<h2>Jobs</h2>\n"; start_table(); table_header("Job ID<br><span class=note>click for details or to get output files</span>", "status", "Canonical instance<br><span class=note>click to see result page on BOINC server</span>"); foreach ($batch->jobs as $job) { $id = (int) $job->id; $resultid = (int) $job->canonical_instance_id; if ($resultid) { $x = "<a href=result.php?resultid={$resultid}>{$resultid}</a>"; $y = "completed"; } else { $x = "---"; $y = "in progress"; } echo "<tr>\n <td><a href=submit_example.php?action=query_job&job_id={$id}>{$id}</a></td>\n <td>{$y}</td>\n <td>{$x}</td>\n </tr>\n "; } end_table(); echo "<p><a href=submit_example.php>Return to job control page</a>\n"; page_tail(); }