function handle_query_batch($user) { $batch_id = get_int('batch_id'); $batch = BoincBatch::lookup_id($batch_id); $app = BoincApp::lookup_id($batch->app_id); $wus = BoincWorkunit::enum("batch = {$batch->id}"); $batch = get_batch_params($batch, $wus); page_head("Batch {$batch_id}"); start_table(); row2("name", $batch->name); row2("application", $app->name); row2("state", batch_state_string($batch->state)); row2("# jobs", $batch->njobs); row2("# error jobs", $batch->nerror_jobs); //row2("logical end time", time_str($batch->logical_end_time)); row2("expiration time", time_str($batch->expire_time)); 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)); row2("Output File Size (MB)", number_format(batch_output_file_size($batch->id) / 1000000.0, 2)); end_table(); if (batch_output_file_size($batch->id) <= 100000000.0) { $url = boinc_get_output_files_url($user, $batch_id); show_button($url, "Get zipped output files"); } else { echo "<br/>The output file size of this batch is too big, it will be uploaded by FTP<br/>"; } switch ($batch->state) { case BATCH_STATE_IN_PROGRESS: echo "<br>"; show_button("submit.php?action=abort_batch_confirm&batch_id={$batch_id}", "Abort batch"); break; case BATCH_STATE_COMPLETE: case BATCH_STATE_ABORTED: echo "<br>"; show_button("submit.php?action=retire_batch_confirm&batch_id={$batch_id}", "Retire batch"); break; } echo "<h2>Jobs</h2>\n"; start_table(); table_header("Job ID and name<br><p class=\"text-muted\">click for details or to get output files</p>", "status", "Canonical instance<br><p class=\"text-muted\">click to see result page on BOINC server</p>", "Download Results"); foreach ($wus as $wu) { $resultid = $wu->canonical_resultid; $durl = boinc_get_wu_output_files_url($user, $wu->id); if ($resultid) { $x = "<a href=result.php?resultid={$resultid}>{$resultid}</a>"; $y = '<font color="green">completed</font>'; $text = "<a href={$durl}> Download Result Files</a>"; } else { $x = "---"; $text = "---"; if ($batch->state == BATCH_STATE_COMPLETE) { $y = '<font color="red">failed</font>'; } else { $y = "in progress"; } } echo "<tr>\n <td><a href=submit.php?action=query_job&wuid={$wu->id}>{$wu->id} · {$wu->name}</a></td>\n <td>{$y}</td>\n <td>{$x}</td>\n <td>{$text}</td>\n </tr>\n "; } end_table(); echo "<p><a href=submit.php>Return to job control page</a>\n"; page_tail(); }
function query_batch($r) { xml_start_tag("query_batch"); list($user, $user_submit) = authenticate_user($r, null); $batch = get_batch($r); if ($batch->user_id != $user->id) { xml_error(-1, "BOINC server: not owner of batch"); } $wus = BoincWorkunit::enum("batch = {$batch->id}"); $batch = get_batch_params($batch, $wus); $get_cpu_time = (int) $r->get_cpu_time; print_batch_params($batch, $get_cpu_time); $n_outfiles = n_outfiles($wus[0]); foreach ($wus as $wu) { echo " <job>\n <id>{$wu->id}</id>\n <name>{$wu->name}</name>\n <canonical_instance_id>{$wu->canonical_resultid}</canonical_instance_id>\n <n_outfiles>{$n_outfiles}</n_outfiles>\n </job>\n"; } echo "</query_batch>\n"; }
function query_batch($r) { list($user, $user_submit) = authenticate_user($r, null); $batch_id = (int) $r->batch_id; $batch = BoincBatch::lookup_id($batch_id); if (!$batch) { error("no such batch"); } if ($batch->user_id != $user->id) { error("not owner"); } $wus = BoincWorkunit::enum("batch = {$batch_id}"); $batch = get_batch_params($batch, $wus); echo "<batch>\n"; print_batch_params($batch); $n_outfiles = n_outfiles($wus[0]); foreach ($wus as $wu) { echo " <job>\n <id>{$wu->id}</id>\n <canonical_instance_id>{$wu->canonical_resultid}</canonical_instance_id>\n <n_outfiles>{$n_outfiles}</n_outfiles>\n </job>\n"; } echo "</batch>\n"; }