function user_row($u) { $user = BoincUser::lookup_id($u->user_id); echo "\n <tr>\n <td>\n <a href=manage_project.php?action=edit_form&user_id={$u->user_id}>{$user->name}</a>\n (ID: {$user->id})\n </td>\n "; echo "<td>"; if ($u->submit_all) { echo "All applications\n"; } else { $uas = BoincUserSubmitApp::enum("user_id={$u->user_id}"); foreach ($uas as $ua) { $app = BoincApp::lookup_id($ua->app_id); echo "{$app->name} "; } if (count($uas) == 0) { echo "---"; } } echo "</td>\n"; echo "<td>{$u->quota}</td>\n"; echo "<td>{$u->max_jobs_in_progress}</td>\n"; echo "<td>"; if ($u->logical_start_time > time()) { echo local_time_str($u->logical_start_time); } else { echo "---"; } echo "\n </td>\n </tr>\n "; }
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(); }
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(); }