function av_desc($gavid) { if ($gavid >= 1000000) { $appid = (int) ($gavid / 1000000); $app = BoincApp::lookup_id($appid); if (!$app) { return tra("Anonymous platform, missing app"); } $rsc_type = $gavid % 1000000; $r = rsc_name($rsc_type); return "{$app->user_friendly_name} (" . tra("anonymous platform") . ", {$r})"; } else { $av = BoincAppVersion::lookup_id($gavid); if (!$av) { return tra("Missing app version"); } $app = BoincApp::lookup_id($av->appid); if (!$app) { return tra("Missing app"); } $platform = BoincPlatform::lookup_id($av->platformid); if (!$platform) { return tra("Missing platform"); } $pc = strlen($av->plan_class) ? "({$av->plan_class})" : ""; $v = number_format($av->version_num / 100, 2); return "{$app->user_friendly_name} {$v} {$platform->name} {$pc}"; } }
function show_form($all) { if ($all) { echo "<a href=manage_app_versions.php>Don't show deprecated app versions</a>\n"; } else { echo "<a href=manage_app_versions.php?all=1>Show deprecated app versions</a>\n"; } $_platforms = BoincPlatform::enum(""); foreach ($_platforms as $platform) { $platforms[$platform->id] = $platform; } $_apps = BoincApp::enum(""); foreach ($_apps as $app) { $apps[$app->id] = $app; } start_table(""); table_header("ID #<br><p class=\"text-muted\">click for details</p>", "Application<br><p class=\"text-muted\">click for details</p>", "Version", "Platform", "Plan class", "minimum<br>client version", "maximum<br>client version", "beta?", "deprecated?", ""); $clause = $all ? "true" : "deprecated = 0"; $avs = BoincAppVersion::enum("{$clause} order by appid, platformid, plan_class, version_num"); $i = 0; foreach ($avs as $av) { // grey out deprecated versions // $f1 = $f2 = ''; if ($av->deprecated) { $f1 = "<font color='GREY'>"; $f2 = "</font>"; } $all_value = $all ? 1 : 0; echo "<tr class=row{$i}><form action=manage_app_versions.php?all={$all_value}#av_{$av->id} method=POST>\n"; $i = 1 - $i; echo "<input type=hidden name=id value={$av->id}>"; echo " <TD>{$f1} <a id='av_{$av->id}' href=db_action.php?table=app_version&id={$av->id}>{$av->id}</a> {$f2}</TD>\n"; $app = $apps[$av->appid]; echo " <TD>{$f1} <a href=app_details.php?appid={$app->id}>{$app->name}</a> {$f2}</TD>\n"; echo " <TD>{$f1} {$av->version_num} {$f2}</TD>\n"; $platform = $platforms[$av->platformid]; echo " <TD>{$f1} {$platform->name} {$f2}</TD>\n"; echo " <td><input type=text name=plan_class size=12 value='{$av->plan_class}'></td>\n"; $v = $av->min_core_version; echo " <TD><input type='text' size='4' name=min_core_version value='{$v}'></TD>\n"; $v = $av->max_core_version; echo " <TD><input type='text' size='4' name=max_core_version value='{$v}'></TD>\n"; $v = ''; if ($av->beta) { $v = ' CHECKED '; } echo " <TD> <input name=beta type='checkbox' {$v}></TD>\n"; $v = ''; if ($av->deprecated) { $v = ' CHECKED '; } echo " <TD> <input name=deprecated type='checkbox' {$v}></TD>\n"; echo "<td><input class=\"btn btn-default\" name=submit type=submit value=Update>"; echo "</tr></form>"; } end_table(); }
function do_updates() { $apps = BoincApp::enum(""); foreach ($apps as $app) { $id = $app->id; // Change deprecated status? // $field = "deprecated_" . $id; $new_v = post_str($field, true) == 'on' ? 1 : 0; $old_v = $app->deprecated; if ($new_v != $old_v) { $app->update("deprecated={$new_v}"); } $field = "weight_" . $id; $new_v = $_POST[$field] + 0; $old_v = $app->weight; if ($new_v != $old_v) { $app->update("weight={$new_v}"); } $field = "homogeneous_redundancy_" . $id; $new_v = $_POST[$field]; $old_v = $app->homogeneous_redundancy; if ($new_v != $old_v) { $app->update("homogeneous_redundancy={$new_v}"); } $field = "homogeneous_app_version_" . $id; $new_v = post_str($field, true) == 'on' ? 1 : 0; $old_v = $app->homogeneous_app_version; if ($new_v != $old_v) { $app->update("homogeneous_app_version={$new_v}"); } $field = "non_cpu_intensive_" . $id; $new_v = post_str($field, true) == 'on' ? 1 : 0; $old_v = $app->non_cpu_intensive; if ($new_v != $old_v) { $app->update("non_cpu_intensive={$new_v}"); } } // Adding a new application if (post_str('add_app', true)) { $name = mysql_real_escape_string($_POST['add_name']); $user_friendly_name = mysql_real_escape_string($_POST['add_user_friendly_name']); if (empty($name) || empty($user_friendly_name)) { $commands .= "<p><font color='red'>\n To add a new application please supply both a brief name and a\n longer 'user-friendly' name.</font></p>\n "; } else { $now = time(); $cmd = "INSERT INTO app (name,user_friendly_name,create_time) " . "VALUES ('{$name}', '{$user_friendly_name}',{$now})"; $commands .= "<P><pre>{$cmd}</pre>\n"; mysql_query($cmd); } } }
function show_form() { $_platforms = BoincPlatform::enum(""); foreach ($_platforms as $platform) { $platforms[$platform->id] = $platform; } $_apps = BoincApp::enum(""); foreach ($_apps as $app) { $apps[$app->id] = $app; } start_table(""); table_header("ID #<br><span class=note>click for details</span>", "Application<br><span class=note>click for details</span>", "Version", "Platform", "Plan Class", "minimum<br>client version", "maximum<br>client version", "beta?", "deprecated?", ""); $avs = BoincAppVersion::enum("true order by appid, platformid, plan_class, version_num"); $i = 0; foreach ($avs as $av) { // grey out deprecated versions // $f1 = $f2 = ''; if ($av->deprecated) { $f1 = "<font color='GREY'>"; $f2 = "</font>"; } echo "<tr class=row{$i}><form action=manage_app_versions.php method=POST>\n"; $i = 1 - $i; echo "<input type=hidden name=id value={$av->id}>"; echo " <TD>{$f1} <a href=db_action.php?table=app_version&id={$av->id}>{$av->id}</a> {$f2}</TD>\n"; $app = $apps[$av->appid]; echo " <TD>{$f1} <a href=app_details.php?appid={$app->id}>{$app->name}</a> {$f2}</TD>\n"; echo " <TD>{$f1} {$av->version_num} {$f2}</TD>\n"; $platform = $platforms[$av->platformid]; echo " <TD>{$f1} {$platform->name} {$f2}</TD>\n"; echo " <td>{$f1} {$av->plan_class} {$f2}</td>\n"; $v = $av->min_core_version; echo " <TD><input type='text' size='4' name=min_core_version value='{$v}'></TD>\n"; $v = $av->max_core_version; echo " <TD><input type='text' size='4' name=max_core_version value='{$v}'></TD>\n"; $v = ''; if ($av->beta) { $v = ' CHECKED '; } echo " <TD> <input name=beta type='checkbox' {$v}></TD>\n"; $v = ''; if ($av->deprecated) { $v = ' CHECKED '; } echo " <TD> <input name=deprecated type='checkbox' {$v}></TD>\n"; echo "<td><input name=submit type=submit value=Update>"; echo "</tr></form>"; } end_table(); }
function add_application() { global $app_name, $app_id, $platform; $app_name = "single_job_{$platform}"; $app = BoincApp::lookup("name='{$app_name}'"); if ($app) { $app_id = $app->id; } else { $now = time(); $app_id = BoincApp::insert("(create_time, name, user_friendly_name) values ({$now}, '{$app_name}','Jobs for {$platform}')"); if (!$app_id) { error("Couldn't add application"); } } }
function process_batch($b) { $app = BoincApp::lookup_id($b->app_id); if (!$app) { echo "no app for batch {$b->id}\n"; return; } if ($b->fraction_done > 0 && $b->credit_canonical > 0) { $credit_total = $b->credit_canonical / $b->fraction_done; $fpops_total = $credit_total * (86400000000000.0 / 200); } else { $db = BoincDb::get(); $fpops_total = $db->sum("workunit", "rsc_fpops_est*target_nresults", "where batch={$b->id}"); } echo "batch {$b->id} fpops_total {$fpops_total}\n"; if ($fpops_total == 0) { return; } // adjust the user's logical start time // $user = BoincUser::lookup_id($b->user_id); if (!$user) { die("no user {$b->user_id}\n"); } $us = BoincUserSubmit::lookup_userid("{$user->id}"); if (!$us) { die("no user submit record\n"); } $lst = $us->logical_start_time; $cmd = "cd ../../bin; ./adjust_user_priority --user {$user->id} --flops {$fpops_total} --app {$app->name}"; system($cmd); $us = BoincUserSubmit::lookup_userid("{$user->id}"); $let = $us->logical_start_time; $let = (int) $let; // set the priority of workunits and results in this batch // to the user's new logical start time // $clause = "priority={$let} where batch={$b->id}"; BoincResult::update_aux($clause); BoincWorkunit::update_aux($clause); }
function show_list($is_team, $appid, $is_total) { $x = $is_team ? "teams" : "participants"; page_head("Top {$x} by application"); $apps = BoincApp::enum("deprecated=0"); if (!$appid) { $appid = $apps[0]->id; } start_table(); show_header($is_team, $apps, $appid, $is_total); $x = $is_total ? "total" : "expavg"; if ($is_team) { $items = BoincCreditTeam::enum("appid={$appid} order by {$x} desc"); } else { $items = BoincCreditUser::enum("appid={$appid} order by {$x} desc"); } $i = 0; foreach ($items as $item) { show_row($item, $apps, $is_team, $i); $i++; } end_table(); page_tail(); }
// along with BOINC. If not, see <http://www.gnu.org/licenses/>. require_once "../inc/boinc_db.inc"; require_once "../inc/util.inc"; check_get_args(array("xml")); $platforms = BoincPlatform::enum("deprecated=0"); $xml = get_str('xml', true); if ($xml) { require_once '../inc/xml.inc'; xml_header(); echo "<app_versions>\n"; } else { page_head(tra("Applications")); echo tra("%1 currently has the following applications. When you participate in %1, work for one or more of these applications will be assigned to your computer. The current version of the application will be downloaded to your computer. This happens automatically; you don't have to do anything.", PROJECT) . "<br><br>\n "; start_table(); } $apps = BoincApp::enum("deprecated=0"); foreach ($apps as $app) { if ($xml) { echo "<application>\n"; echo " <name>{$app->user_friendly_name}</name>\n"; echo " <id>{$app->id}</id>\n"; } else { echo "\n <tr><th colspan=4>{$app->user_friendly_name}</th></tr>\n <tr>\n <th>" . tra("Platform") . "</th>\n <th>" . tra("Version") . "</th>\n <th>" . tra("Installation time") . "</th>\n </tr>\n "; } foreach ($platforms as $platform) { $avs = latest_avs_app_platform($app->id, $platform->id); foreach ($avs as $av) { $create_time_f = pretty_time_str($av->create_time); if ($xml) { echo " <version>\n"; echo " <platform_short>{$platform->name}</platform_short>\n";
function handle_show_all($user) { $userid = get_int("userid"); $appid = get_int("appid"); $state = get_int("state"); if ($userid) { // user looking at their own batches // if ($userid != $user->id) { error_page("wrong user"); } $batches = BoincBatch::enum("user_id = {$user->id} and state={$state} order by id desc"); fill_in_app_and_user_names($batches); show_batches_in_state($batches, $state); } else { // admin looking at batches // check_admin_access($user, $appid); if ($appid) { $app = BoincApp::lookup_id($appid); if (!$app) { error_page("no such app"); } $batches = BoincBatch::enum("app_id = {$appid} and state={$state} order by id desc"); } else { $batches = BoincBatch::enum("state={$state} order by id desc"); } fill_in_app_and_user_names($batches); show_batches_in_state($batches, $state); } }
function eligible_apps() { global $user; $apps = BoincApp::enum("deprecated = 0"); $user_submit = BoincUserSubmit::lookup_userid($user->id); if (!$user_submit) { return null; } $a = array(); foreach ($apps as $app) { if ($user_submit->submit_all) { $a[] = $app; } else { if (BoincUserSubmitApp::lookup("user_id={$user->id} and app_id={$app->id}")) { $a[] = $app; } } } return $a; }
function show_app_select() { admin_page_head("Show FLOPS distribution"); echo "Select an application:\n <form action=job_times.php>\n "; $apps = BoincApp::enum("deprecated=0"); foreach ($apps as $app) { echo "<br><input type=radio name=appid value={$app->id}>\n {$app->user_friendly_name}\n "; } echo "<br><br><input type=submit value=OK>"; admin_page_tail(); }
function print_batch_params($batch) { $app = BoincApp::lookup_id($batch->app_id); if (!$app) { $app->name = "none"; } echo "\n <id>{$batch->id}</id>\n <create_time>{$batch->create_time}</create_time>\n <est_completion_time>{$batch->est_completion_time}</est_completion_time>\n <njobs>{$batch->njobs}</njobs>\n <fraction_done>{$batch->fraction_done}</fraction_done>\n <nerror_jobs>{$batch->nerror_jobs}</nerror_jobs>\n <state>{$batch->state}</state>\n <completion_time>{$batch->completion_time}</completion_time>\n <credit_estimate>{$batch->credit_estimate}</credit_estimate>\n <credit_canonical>{$batch->credit_canonical}</credit_canonical>\n <name>{$batch->name}</name>\n <app_name>{$app->name}</app_name>\n"; }
function show_appl($app_id) { $app = BoincApp::lookup_id($app_id); page_head("App {$app->user_friendly_name} credit"); $avs = BoincAppVersion::enum("appid={$app_id} and deprecated=0"); start_table(); table_header("platform/class/version", "PFC nsamples", "PFC avg", "PFC scale"); $avs = current_versions($avs); foreach ($avs as $av) { $plat = BoincPlatform::lookup_id($av->platformid); table_row("<a href=credit.php?av_id={$av->id}>{$plat->user_friendly_name} {$av->plan_class} {$av->version_num}</a>", $av->pfc_n, $av->pfc_avg, $av->pfc_scale); } end_table(); page_tail(); }
function get_templates($r) { xml_start_tag("get_templates"); $app_name = (string) $r->app_name; if ($app_name) { $app = get_submit_app($app_name); } else { $job_name = (string) $r->job_name; $wu = get_wu($job_name); $app = BoincApp::lookup_id($wu->appid); } list($user, $user_submit) = authenticate_user($r, $app); $in = file_get_contents(project_dir() . "/templates/" . $app->name . "_in"); $out = file_get_contents(project_dir() . "/templates/" . $app->name . "_out"); if ($in === false || $out === false) { xml_error(-1, "template file missing"); } echo "<templates>\n{$in}\n{$out}\n</templates>\n </get_templates>\n "; }
echo "updated user {$user->id}\n"; } } } function update_users($app_id) { $n = 0; $maxid = BoincUser::max("id"); while ($n <= $maxid) { $m = $n + 1000; $users = BoincUser::enum("id>={$n} and id<{$m}"); foreach ($users as $user) { update_user($user, $app_id); } $n = $m; } } if ($argc != 2) { die("usage: app_select_edit.php app_id\n"); } $app_id = $argv[1]; if (!BoincApp::lookup_id($app_id)) { die("No such app: {$app_id}\n"); } // change comments below for testing //echo get_new_prefs(BoincUser::lookup_id(1), $app_id); // show the new project prefs for a user, but don't update DB //update_user(BoincUser::lookup_id(1), $app_id); // update DB for a particular user update_users($app_id); // update DB for all users
function handle_edit_action() { $user_id = get_int('user_id'); $us = BoincUserSubmit::lookup_userid($user_id); if (!$us) { error_page("user not found"); } BoincUserSubmitApp::delete_user($user_id); $submit_all = get_str('submit_all'); if ($submit_all) { $us->update("submit_all=1"); } else { $us->update("submit_all=0"); $apps = BoincApp::enum("deprecated=0"); foreach ($apps as $app) { $x = "app_{$app->id}"; if (get_str($x, true)) { BoincUserSubmitApp::insert("(user_id, app_id) values ({$user_id}, {$app->id})"); } } } $quota = (double) get_str('quota'); if ($quota != $us->quota) { $us->update("quota={$quota}"); } page_head("Update successful"); echo "<a href=manage_project.php>Return to project-wide management functions</a>"; page_tail(); }
// along with BOINC. If not, see <http://www.gnu.org/licenses/>. // top-level management page; // shows links to the various functions available to the user. // If the only option is managing a particular app, // redirect to that page require_once "../inc/submit_db.inc"; require_once "../inc/util.inc"; $user = get_logged_in_user(); $bus = BoincUserSubmit::lookup_userid($user->id); if (!$bus) { die("no access"); } if ($bus->manage_all) { page_head("Management functions"); echo "\n <a href=manage_project.php>Project-wide management</a>\n "; $apps = BoincApp::enum(null); echo "\n <p>Application-specific management:\n <ul>\n "; foreach ($apps as $app) { echo "\n <li><a href=manage_app.php?app_id={$app->id}>{$app->name}</a>\n "; } echo "</ul>\n"; page_tail(); exit; } $apps = BoincUserSubmit::enum("user_id={$user->id} and manage<>1"); switch (count($apps)) { case 0: error_page("Nothing to manage"); case 1: $app = $apps[0]; Header("Location: manage_app.php?app_id={$app->id}");
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("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><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>", "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(); }
} if (!$r) { error("can't parse request message"); } // authenticate the user // $auth = (string) $r->auth; $user = BoincUser::lookup("authenticator='{$auth}'"); if (!$user) { error("invalid authenticator"); } $user_submit = BoincUserSubmit::lookup_userid($user->id); if (!$user_submit) { error("no submit access"); } $app = BoincApp::lookup("name='{$app_name}'"); if (!$app) { error("no tree_threader app"); } if (!$user_submit->submit_all) { $usa = BoincUserSubmitApp::lookup("user_id={$user->id} and app_id={$app->id}"); if (!$usa) { error("no submit access"); } } switch ((string) $r->action) { case 'submit': handle_submit($r, $user, $app); break; case 'get_output': $batch_id = (int) $r->batch_id;
$av = $x->on_frac; if ($x->gpu_active_frac) { $av *= $x->gpu_active_frac; } else { $av *= $x->active_frac; } } else { $av = $x->on_frac * $x->active_frac; } $a[] = 1 / $x->et_avg * $av; } _mysql_free_result($result); sort($a); $n = count($a); $f = fopen("../../size_census_" . $app->name, "w"); for ($i = 1; $i < $app->n_size_classes; $i++) { $k = (int) ($i * $n / $app->n_size_classes); fprintf($f, "%e\n", $a[$k]); } fclose($f); } echo "Starting: ", time_str(time()), "\n"; if ($argc == 2 && $argv[1] == "--all_apps") { $apps = BoincApp::enum("deprecated=0"); } else { $apps = BoincApp::enum("deprecated=0 and n_size_classes>1"); } foreach ($apps as $app) { do_app($app); } echo "Finished: ", time_str(time()), "\n";
$batch_id = BoincBatch::insert("(user_id, create_time, njobs, name, app_id, state) values ({$user->id}, {$now}, {$njobs}, '{$batch_name}', {$app->id}, " . BATCH_STATE_IN_PROGRESS . ")"); // $batch_id=99; $i = 0; foreach ($cmdlines as $cmdline) { if (preg_match("/^\\s*-var/", $cmdline)) { submit_job($app, $batch_id, $info, $cmdline, $i); $i++; } } } $user = get_logged_in_user(); $user_submit = BoincUserSubmit::lookup_userid($user->id); if (!$user_submit) { error_page("no submit access"); } $app = BoincApp::lookup("name='lammps'"); if (!$app) { error_page("no lammps app"); } if (!$user_submit->submit_all) { $usa = BoincUserSubmitApp::lookup("user_id={$user->id} and app_id={$app->id}"); if (!$usa) { error_page("no submit access"); } } $action = get_str('action', true); switch ($action) { case '': show_submit_form($user); break; case 'prepare':
function get_cached_apps() { $apps = unserialize(get_cached_data(3600, "get_cached_apps")); if ($apps == false) { $apps = BoincApp::enum("deprecated=0"); set_cached_data(3600, serialize($apps), "get_cached_apps"); } return $apps; }
function show_form() { echo "\n <h2>Edit applications</h2>\n "; start_table(); table_header("ID", "Name and description<br><p class=\"text-muted\">Click for details</p>", "Created", "weight<br><a href=https://boinc.berkeley.edu/trac/wiki/BackendPrograms#feeder><p class=\"text-muted\">details</p></a>", "shmem items", "HR type<br><a href=https://boinc.berkeley.edu/trac/wiki/HomogeneousRedundancy><p class=\"text-muted\">details</p></a>", "homogeneous app version?<br><a href=https://boinc.berkeley.edu/trac/wiki/HomogeneousAppVersion><p class=\"text-muted\">details</p></a>", "deprecated?", "Non-CPU-intensive?", "Beta?", "Exact fraction done?", ""); $total_weight = BoincApp::sum("weight", "where deprecated=0"); $swi = parse_config(get_config(), "<shmem_work_items>"); if (!$swi) { $swi = 100; } $apps = BoincApp::enum(""); $i = 0; foreach ($apps as $app) { // grey-out deprecated versions $f1 = $f2 = ''; if ($app->deprecated == 1) { $f1 = "<font color='GREY'>"; $f2 = "</font>"; } echo "<tr class=row{$i}><form action=manage_apps.php method=POST>"; $i = 1 - $i; echo "<input type=hidden name=id value={$app->id}>"; echo " <TD align='center'>{$f1} {$app->id} {$f2}</TD>\n"; echo " <TD align='left'>{$f1}<a href=app_details.php?appid={$app->id}>{$app->name}</a><br> {$app->user_friendly_name} {$f2}</TD>\n"; echo " <TD align='center'>{$f1} " . date_str($app->create_time) . "{$f2}</TD>\n"; $v = $app->weight; echo " <TD align='center'>\n <input type='text' size='4' name='weight' value='{$v}'></TD>\n"; if ($app->deprecated || $total_weight == 0) { echo '<td></td>'; } else { echo '<td align="right">' . round($app->weight / $total_weight * $swi) . '</td>'; } $v = $app->homogeneous_redundancy; echo " <TD align='center'>\n <input name='homogeneous_redundancy' value='{$v}'></TD>\n "; $v = ''; if ($app->homogeneous_app_version) { $v = ' CHECKED '; } echo " <TD align='center'>\n <input name='homogeneous_app_version' type='checkbox' {$v}></TD>\n "; $v = ''; if ($app->deprecated) { $v = ' CHECKED '; } echo " <TD align='center'>\n <input name='deprecated' type='checkbox' {$v}></TD>\n "; $v = ''; if ($app->non_cpu_intensive) { $v = ' CHECKED '; } echo " <TD align='center'>\n <input name='non_cpu_intensive' type='checkbox' {$v}></TD>\n "; $v = ''; if ($app->beta) { $v = ' CHECKED '; } echo " <TD align='center'>\n <input name='beta' type='checkbox' {$v}></TD>\n "; $v = ''; if ($app->fraction_done_exact) { $v = ' CHECKED '; } echo " <TD align='center'>\n <input name='fraction_done_exact' type='checkbox' {$v}></TD>\n "; echo "<td><input class=\"btn btn-default\" type=submit name=submit value=Update>"; echo "</tr></form>"; } end_table(); // Entry form to create a new application // echo "<P>\n <h2>Add an application</h2>\n To add an application enter the short name and description\n ('user friendly name') below. You can then edit the\n application when it appears in the table above.\n <p>\n <form action=manage_apps.php method=POST>\n "; start_table("align='center' "); table_header("Name", "Description", " "); echo "<TR>\n <TD> <input type='text' size='12' name='add_name' value=''></TD>\n <TD> <input type='text' size='35' name='add_user_friendly_name' value=''></TD>\n <TD align='center' >\n <input type='submit' name='add_app' value='Add Application'></TD>\n </TR>\n"; end_table(); echo "</form><p>\n"; }
function get_job_status() { $s = unserialize(get_cached_data(STATUS_PAGE_TTL, "job_status")); if ($s) { return $s; } $s = new StdClass(); $apps = BoincApp::enum("deprecated=0"); foreach ($apps as $app) { $info = BoincDB::get()->lookup_fields("result", "stdClass", "ceil(avg(elapsed_time)/3600*100)/100 as avg,\n ceil(min(elapsed_time)/3600*100)/100 as min,\n ceil(max(elapsed_time)/3600*100)/100 as max,\n count(distinct userid) as users", "appid = {$app->id}\n AND validate_state=1\n AND received_time > (unix_timestamp()-86400)\n "); $app->info = $info; $app->unsent = BoincResult::count("appid={$app->id} and server_state=2"); $app->in_progress = BoincResult::count("appid={$app->id} and server_state=4"); } $s->apps = $apps; $s->results_ready_to_send = BoincResult::count("server_state=2"); $s->results_in_progress = BoincResult::count("server_state=4"); $s->results_need_file_delete = BoincResult::count("file_delete_state=1"); $s->wus_need_validate = BoincWorkunit::count("need_validate=1"); $s->wus_need_assimilate = BoincWorkunit::count("assimilate_state=1"); $s->wus_need_file_delete = BoincWorkunit::count("file_delete_state=1"); $x = BoincDB::get()->lookup_fields("workunit", "stdClass", "MIN(transition_time) as min", "TRUE"); $gap = (time() - $x->min) / 3600; if ($gap < 0 || $x->min == 0) { $gap = 0; } $s->transitioner_backlog = $gap; $s->users_with_recent_credit = BoincUser::count("expavg_credit>1"); $s->users_with_credit = BoincUser::count("total_credit>1"); $s->users_past_24_hours = BoincUser::count("create_time > (unix_timestamp() - 86400)"); $s->hosts_with_recent_credit = BoincHost::count("expavg_credit>1"); $s->hosts_with_credit = BoincHost::count("total_credit>1"); $s->hosts_past_24_hours = BoincHost::count("create_time > (unix_timestamp() - 86400)"); $s->flops = BoincUser::sum("expavg_credit") / 200; $s->db_revision = null; if (file_exists("../../db_revision")) { $s->db_revision = trim(file_get_contents("../../db_revision")); } $s->cached_time = time(); $e = set_cached_data(STATUS_PAGE_TTL, serialize($s), "job_status"); if ($e) { echo "set_cached_data(): {$e}\n"; } return $s; }
function handle_edit_action() { $user_id = get_int('user_id'); $us = BoincUserSubmit::lookup_userid($user_id); if (!$us) { error_page("user not found"); } BoincUserSubmitApp::delete_user($user_id); $submit_all = get_str('submit_all'); if ($submit_all) { $us->update("submit_all=1"); } else { $us->update("submit_all=0"); $apps = BoincApp::enum("deprecated=0"); foreach ($apps as $app) { $x = "app_{$app->id}"; if (get_str($x, true)) { BoincUserSubmitApp::insert("(user_id, app_id) values ({$user_id}, {$app->id})"); } } } $quota = (double) get_str('quota'); if ($quota != $us->quota) { $us->update("quota={$quota}"); } $mj = (int) get_str('max_jobs_in_progress'); if ($mj != $us->max_jobs_in_progress) { $us->update("max_jobs_in_progress={$mj}"); } header('Location: manage_project.php'); }
// BOINC is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License // as published by the Free Software Foundation, // either version 3 of the License, or (at your option) any later version. // // BOINC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // See the GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see <http://www.gnu.org/licenses/>. // show details of an app require_once '../inc/util_ops.inc'; $appid = get_int("appid"); $app = BoincApp::lookup_id($appid); if (!$app) { admin_error_page("no such app"); } admin_page_head("Details for {$app->name} ({$app->user_friendly_name})"); start_table(); row2("Min average efficiency", $app->min_avg_pfc); echo "\n <p>\n In the list below, 'Credit scale factor' should\n be roughly 1 for CPU versions, 0.1 for GPU versions.\n If values are far outside this range,\n you may have bad FLOPs estimates.\n In this case, you may want to\n <ol>\n <li> <a href=job_times.php?appid={$appid}>Get a better FLOPs estimate</a>\n <li> <a href=app_reset.php?appid={$appid}>reset credit statistics for this application</a>.\n </ol>\n"; end_table(); echo "<h2>App versions</h2>\n"; $avs = BoincAppVersion::enum("appid={$appid}"); $avs = current_versions($avs); foreach ($avs as $av) { $platform = BoincPlatform::lookup_id($av->platformid); start_table(); row2("ID", $av->id);
$color = "#ff0000"; } else { $color = "#ff9900"; } echo "<li><span style=\"color: " . $color . "\">\n There are " . $uotd_candidates . " remaining candidates for User of the Day.\n </span></li>\n "; } echo "</ul>\n"; if (function_exists('admin_index_extra')) { admin_index_extra(); } echo "\n <p>\n <table border=\"0\"><tr valign=\"top\">\n <td><b>Browse database:</b>\n <ul> \n <li><a href=\"db_form.php?table=result&detail=low\">Results</a></li>\n <li><a href=\"db_form.php?table=workunit\">Workunits</a></li>\n <li><a href=\"db_form.php?table=host&detail=low\">Hosts</a></li>\n <li><a href=\"db_form.php?table=user\">Users</a> (<a href=\"list_new_users.php\">recently registered</a>)</li>\n <li><a href=\"db_form.php?table=team\">Teams</a></li>\n <li><a href=\"db_action.php?table=app\">Applications</a></li>\n <li><a href=\"db_form.php?table=app_version\">Application versions</a></li>\n <li><a href=\"db_action.php?table=platform\">Platforms</a></li>\n <li><a href=dbinfo.php>DB row counts and disk usage</a>\n <li><a href=\"show_log.php?f=mysql*.log&l=-20\">Tail MySQL logs</a>\n </ul>\n \n\n </td> \n <td><b>Computing</b>\n <ul>\n <li><a href=\"manage_apps.php\">Manage applications</a></li>\n <li><a href=\"manage_app_versions.php\">Manage application versions</a></li>\n <li> Manage jobs\n <ul>\n <li><a href=\"cancel_wu_form.php\">Cancel jobs by ID</a>\n <li><a href=\"cancel_workunits.php\">Cancel jobs by SQL clause</a>\n <li><a href=transition_all.php>Transition jobs</a>\n <p class=\"text-muted\">(this can 'unstick' old jobs)</p>\n <li><a href=\"revalidate.php\">Re-validate jobs</a>\n <li><a href=assign.php>Assigned jobs</a>\n </ul>\n <li><a href=\"job_times.php\">FLOP count statistics</a>\n <li><a href=\"{$stripchart_cgi_url}/stripchart.cgi\">Stripcharts</a>\n <li><a href=\"show_log.php\">Show/Grep logs</a>\n <li>\n <form method=\"get\" action=\"clear_host.php\">\n <input class=\"btn btn-default\" type=\"submit\" value=\"Clear RPC seqno\">\n host ID: \n <input type=\"text\" size=\"5\" name=\"hostid\">\n </form>\n </ul>\n \n </td> \n <td><b>User management</b>\n <ul>\n <li><a href=" . URL_BASE . "/forum_index.php>Post news item</a></li>\n <li><a href=\"profile_screen_form.php\">Screen user profiles </a></li>\n <li><a href=\"badge_admin.php\">Badges</a></li>\n <li><a href=\"manage_special_users.php\">User privileges</a></li>\n <li><a href=" . URL_BASE . "/manage_project.php>User job submission privileges</a></li>\n <li><a href=\"mass_email.php\">Send mass email to a selected set of users</a></li>\n <li><form action=\"manage_user.php\">\n <input class=\"btn btn-default\" type=\"submit\" value=\"Manage user\">\n ID: <input name=\"userid\">\n </form>\n </li>\n </ul>\n </td>\n </tr>\n </table>\n"; // Result Summaries: $show_deprecated = get_str("show_deprecated", true); $show_only = array("all"); // Add all appids you want to display, or "all" $apps = BoincApp::enum(""); foreach ($apps as $app) { if (in_array($app->id, $show_only) || in_array("all", $show_only) && (!$app->deprecated || $show_deprecated)) { echo "\n <b>Results for <tt>{$app->name}</tt>:</b>\n <ul>\n"; for ($i = 0; $i < 2; $i++) { if ($i) { $secs = 7 * 86400; $period = " 7 days"; } else { $secs = 86400; $period = "24 hours"; } echo "\n <li> Past {$period}:\n <a href=\"result_summary.php?appid={$app->id}&nsecs={$secs}\">\n summary\n </a> |\n <a href=\"pass_percentage_by_platform.php?appid={$app->id}&nsecs={$secs}\">\n summary per app version\n </a> | \n <a href=\"failure_result_summary_by_host.php?appid={$app->id}&nsecs={$secs}\">\n failures broken down by (app version, host)\n </a> |\n <a href=\"failure_result_summary_by_platform.php?appid={$app->id}&nsecs={$secs}\">\n failures broken down by (app version, error)\n </a>\n"; } echo " </ul> "; }