mirror of https://github.com/BOINC/boinc.git
- added optional code for user-submitted jobs (from M.F. Somers)
- added some scripts in ops/ for managing HR, and for blocking hosts. (from M.F. Somers; these should be documented in the WIki and perhaps added to ops/index.php) svn path=/trunk/boinc/; revision=14229
This commit is contained in:
parent
89cedeb94e
commit
25288d5ca6
|
@ -11092,3 +11092,16 @@ Charlie 16 Nov 2007
|
|||
boinc.xcodeproj/
|
||||
project.pbxproj
|
||||
BuildMacBOINC.sh
|
||||
|
||||
David 16 Nov 2007
|
||||
- added optional code for user-submitted jobs (from M.F. Somers)
|
||||
- added some scripts in ops/ for managing HR, and for blocking hosts.
|
||||
(from M.F. Somers; these should be documented in the WIki
|
||||
and perhaps added to ops/index.php)
|
||||
|
||||
html/
|
||||
ops/
|
||||
hrclass_summary.php
|
||||
reset_hrclass.php
|
||||
block_host.php
|
||||
queue/*
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
// limit a given host to 1 job per day
|
||||
|
||||
// TODO: document; use new DB interface
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/db_ops.inc" );
|
||||
include_once( "../inc/util_ops.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
|
||||
db_init();
|
||||
|
||||
if (get_int('hostid')) {
|
||||
$hostid = get_int( 'hostid' );
|
||||
} else {
|
||||
error_page("no hostid");
|
||||
}
|
||||
|
||||
$timestr = time_str(time(0));
|
||||
$title = "host ".$hostid." max_results_day set to 1 at ".$timestr;
|
||||
|
||||
admin_page_head( $title );
|
||||
|
||||
if($hostid > 0) {
|
||||
$result = mysql_query("UPDATE host SET max_results_day=1 WHERE id=".$hostid);
|
||||
}
|
||||
|
||||
echo $title;
|
||||
|
||||
admin_page_tail();
|
||||
|
||||
?>
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
// Show how many unsent results are committed to each HR class
|
||||
|
||||
// TODO: convert to use new DB interface
|
||||
// TODO: document in the wiki
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/db_ops.inc" );
|
||||
include_once( "../inc/util_ops.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
|
||||
$system_string[ 128 ] = "No OS";
|
||||
$system_string[ 256 ] = "Linux";
|
||||
$system_string[ 384 ] = "Windows";
|
||||
$system_string[ 512 ] = "Darwin";
|
||||
$system_string[ 640 ] = "FreeBSD";
|
||||
|
||||
$cpu_string[ 0 ] = "Unspecified";
|
||||
$cpu_string[ 1 ] = "No cpu";
|
||||
$cpu_string[ 2 ] = "Intel";
|
||||
$cpu_string[ 3 ] = "AMD";
|
||||
$cpu_string[ 4 ] = "Macintosh";
|
||||
$cpu_string[ 5 ] = "AMD Athlon";
|
||||
$cpu_string[ 6 ] = "AMD Duron";
|
||||
$cpu_string[ 7 ] = "AMD Sempron";
|
||||
$cpu_string[ 8 ] = "AMD Opteron";
|
||||
$cpu_string[ 9 ] = "AMD Athlon 64";
|
||||
$cpu_string[ 10 ] = "AMD Athlon XP";
|
||||
$cpu_string[ 11 ] = "Intel Xeon";
|
||||
$cpu_string[ 12 ] = "Intel Celeron";
|
||||
$cpu_string[ 13 ] = "Intel Pentium";
|
||||
$cpu_string[ 14 ] = "Intel Pentium II";
|
||||
$cpu_string[ 15 ] = "Intel Pentium III";
|
||||
$cpu_string[ 16 ] = "Intel Pentium 4";
|
||||
$cpu_string[ 17 ] = "Intel Pentium D";
|
||||
$cpu_string[ 18 ] = "Intel Pentium M";
|
||||
$cpu_string[ 19 ] = "AMD Athlon MP";
|
||||
$cpu_string[ 20 ] = "AMD Turion";
|
||||
$cpu_string[ 21 ] = "Intel Core2";
|
||||
|
||||
$query = "SELECT COUNT(workunit.id) AS count FROM workunit LEFT JOIN result ON workunit.id=result.workunitid WHERE result.server_state=2 AND workunit.hr_class=";
|
||||
|
||||
function get_mysql_count( $hr_class ) {
|
||||
$result = mysql_query("select count(id) as count from workunit where hr_class=" . $hr_class);
|
||||
$count = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
return $count->count;
|
||||
}
|
||||
|
||||
function make_reset_url( $hr_class ) {
|
||||
return ("<a href=ops_reset_hrclass.php?hr_class=".$hr_class.">".$hr_class."</a>");
|
||||
}
|
||||
|
||||
db_init();
|
||||
|
||||
$timestr = time_str(time(0));
|
||||
$title = "hr_class summary list at ".$timestr;
|
||||
|
||||
admin_page_head( $title );
|
||||
|
||||
start_table();
|
||||
|
||||
row4( "<b>hr_class</b>", "<b>System</b>", "<b>CPU</b>", "<b># unsent results</b>" );
|
||||
|
||||
$unsentresults = get_mysql_count( 0 );
|
||||
row4( make_reset_url( 0 ), $system_string[ 128 ], $cpu_string[ 0 ], $unsentresults );
|
||||
|
||||
for( $system = 2; $system < 6; ++$system ) {
|
||||
for( $cpu = 1; $cpu < 22; ++$cpu ) {
|
||||
$hr_class=128*$system+$cpu;
|
||||
|
||||
$unsentresults = get_mysql_count( $hr_class );
|
||||
|
||||
row4( make_reset_url( $hr_class ), $system_string[ $system * 128 ], $cpu_string[ $cpu ], $unsentresults );
|
||||
}
|
||||
}
|
||||
|
||||
end_table();
|
||||
|
||||
admin_page_tail();
|
||||
|
||||
?>
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
// change all WUs committed to a given HR class back to uncommitted
|
||||
//
|
||||
// TODO: document - when/why would you want to do this?
|
||||
// TODO: use new DB interface
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/db_ops.inc" );
|
||||
include_once( "../inc/util_ops.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
|
||||
db_init();
|
||||
|
||||
if (get_int('hr_class')) {
|
||||
$hr_class = get_int('hr_class');
|
||||
} else {
|
||||
$hr_class = 0;
|
||||
}
|
||||
|
||||
$timestr = time_str(time(0));
|
||||
$title = "hr_class ".$hr_class." reset at ".$timestr;
|
||||
|
||||
admin_page_head($title);
|
||||
|
||||
if ($hr_class != 0) {
|
||||
$result = mysql_query("UPDATE workunit SET hr_class=0 WHERE hr_class=".$hr_class);
|
||||
}
|
||||
|
||||
echo $title;
|
||||
|
||||
admin_page_tail();
|
||||
|
||||
?>
|
|
@ -0,0 +1,8 @@
|
|||
// This directory contains a system that allows
|
||||
// users to submit jobs to a BOINC project.
|
||||
//
|
||||
// Major revisions may be required to make this work
|
||||
// (and to make it secure) on your project.
|
||||
// Please read and understand all the code before using it.
|
||||
//
|
||||
// Contributed by Dr. M.F. Somers, Leiden University
|
|
@ -0,0 +1,20 @@
|
|||
CREATE TABLE q_list (
|
||||
id integer NOT NULL auto_increment,
|
||||
user integer NOT NULL default '0',
|
||||
workunit integer NOT NULL default '0',
|
||||
PRIMARY KEY (id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE q_restricted_apps (
|
||||
id integer NOT NULL auto_increment,
|
||||
appid integer NOT NULL default '0',
|
||||
PRIMARY KEY (id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE q_users (
|
||||
id integer NOT NULL auto_increment,
|
||||
user integer NOT NULL default '0',
|
||||
app integer NOT NULL default '0',
|
||||
qmax integer NOT NULL default '0',
|
||||
PRIMARY KEY (id)
|
||||
) TYPE=MyISAM;
|
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
|
||||
require_once("../inc/db.inc");
|
||||
require_once("../inc/util.inc");
|
||||
require_once("../inc/prefs.inc");
|
||||
|
||||
function all_jobs_of_user( $user )
|
||||
{
|
||||
$alljobs = mysql_query( "SELECT * FROM q_list WHERE user=".$user -> id );
|
||||
return $alljobs;
|
||||
}
|
||||
|
||||
function nr_of_jobs_of_user( $user )
|
||||
{
|
||||
$njobs = mysql_num_rows( all_jobs_of_user( $user ) );
|
||||
return $njobs;
|
||||
}
|
||||
|
||||
function workunit_name( $workunit )
|
||||
{
|
||||
if( ( $pos = strpos( $workunit -> name, "_queue" ) ) === false )
|
||||
$workunitname = $workunit -> name;
|
||||
else
|
||||
$workunitname = substr( $workunit -> name, 0, $pos );
|
||||
return $workunitname;
|
||||
}
|
||||
|
||||
function workunit_status_string( $workunit )
|
||||
{
|
||||
$status = "UNKNOWN";
|
||||
if( $workunit -> canonical_resultid )
|
||||
$status = "finished";
|
||||
else
|
||||
{
|
||||
if( $workunit -> hr_class )
|
||||
$status = "running";
|
||||
else
|
||||
$status = "queued";
|
||||
}
|
||||
if( $workunit -> error_mask )
|
||||
{
|
||||
$status = "ERROR";
|
||||
if( $workunit -> error_mask & 16 )
|
||||
$status = "CANCELED";
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
function max_nr_of_jobs_of_user( $user )
|
||||
{
|
||||
$allapps = mysql_query( "SELECT * FROM q_users WHERE user=".$user -> id );
|
||||
$napps = mysql_num_rows( $allapps );
|
||||
|
||||
if( $napps > 0 )
|
||||
for( $count = $index = 0; $index < $napps; ++$index )
|
||||
{
|
||||
$row = mysql_fetch_object( $allapps );
|
||||
if( $row )
|
||||
$count += $row -> qmax;
|
||||
}
|
||||
else
|
||||
$count = 5;
|
||||
|
||||
mysql_free_result( $allapps );
|
||||
return $count;
|
||||
}
|
||||
|
||||
function nr_of_jobs_for_user_for_app( $user, $app )
|
||||
{
|
||||
$qmaxresult = mysql_query( "SELECT qmax FROM q_users WHERE user=".$user -> id." AND app=".$app -> id );
|
||||
if( mysql_num_rows( $qmaxresult ) < 1 )
|
||||
{
|
||||
$qrestrictedapps = mysql_query( "SELECT * FROM q_restricted_apps WHERE appid=".$app -> id );
|
||||
if( mysql_num_rows( $qrestrictedapps ) < 1 )
|
||||
$nr = 5;
|
||||
else
|
||||
$nr = 0;
|
||||
mysql_free_result( $qrestrictedapps );
|
||||
}
|
||||
else
|
||||
{
|
||||
$object = mysql_fetch_object( $qmaxresult );
|
||||
$nr = $object -> qmax;
|
||||
}
|
||||
mysql_free_result( $qmaxresult );
|
||||
return $nr;
|
||||
}
|
||||
|
||||
function nr_of_submitted_jobs_for_user_for_app( $user, $app )
|
||||
{
|
||||
$alljobs = mysql_query( "SELECT * FROM q_list WHERE user=".$user -> id );
|
||||
$nrofjobs = mysql_num_rows( $alljobs );
|
||||
|
||||
for( $nr = $index = 0; $index < $nrofjobs; ++$index )
|
||||
{
|
||||
$job = mysql_fetch_object( $alljobs );
|
||||
$workunit = mysql_fetch_object( mysql_query( "SELECT * FROM workunit WHERE id=".$job -> workunit ) );
|
||||
|
||||
if( $workunit -> appid == $app -> id )
|
||||
$nr = $nr + 1;
|
||||
}
|
||||
|
||||
mysql_free_result( $alljobs );
|
||||
return $nr;
|
||||
}
|
||||
|
||||
function exit_with_text( $text )
|
||||
{
|
||||
start_table();
|
||||
row1( "<font color='red'><b>".$text."</b></font>" );
|
||||
row1( "Commands" );
|
||||
row2( "", '<a href="queue_show_queue.php">Go back to your queue</a>' );
|
||||
row2( "", '<a href="logout.php">Log out</a>' );
|
||||
end_table();
|
||||
page_tail();
|
||||
exit;
|
||||
}
|
||||
|
||||
function fan_out_dir( $filename, $fanoutnr )
|
||||
{
|
||||
$dir = dechex( hexdec( substr( md5( $filename ), 1, 7 ) ) % $fanoutnr );
|
||||
return $dir;
|
||||
}
|
||||
|
||||
function row5($xx, $xy, $yx, $yy, $zz ) {
|
||||
echo "<tr><td width=20% valign=top>$xx</td><td width=20%>$xy</td>"
|
||||
. "<td width=20% >$yx</td><td width=%20>$yy</td><td width=20%>$zz</td></tr>
|
||||
";
|
||||
}
|
||||
|
||||
function row6($xx, $xy, $yx, $yy, $zz, $xz ) {
|
||||
echo "<tr><td width=15% valign=top>$xx</td><td width=15%>$xy</td>"
|
||||
. "<td width=15% >$yx</td><td width=%15>$yy</td><td width=15%>$zz</td>"
|
||||
. "<td width=15%>$xz</td></tr>";
|
||||
}
|
||||
|
||||
function remove_tags( $xml, $tag )
|
||||
{
|
||||
$newxml = $xml;
|
||||
while( ( $pos = strpos( $newxml, $tag ) ) !== false )
|
||||
$newxml = substr( $newxml, 0, $pos ).substr( $newxml, $pos + strlen( $tag ) );
|
||||
return $newxml;
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,364 @@
|
|||
<?php
|
||||
|
||||
require_once("../inc/credit.inc");
|
||||
require_once("../inc/email.inc");
|
||||
require_once("../inc/util.inc");
|
||||
|
||||
function parse_project($f) {
|
||||
$p->total_credit = 0.0;
|
||||
$p->expavg_credit = 0.0;
|
||||
while (!feof($f)) {
|
||||
$buf = fgets($f);
|
||||
if (strstr($buf, "</project>")) break;
|
||||
if ($x = parse_element($buf, "<name>")) {
|
||||
$p->name = $x;
|
||||
}
|
||||
if ($x = parse_element($buf, "<name>")) {
|
||||
$p->name = $x;
|
||||
}
|
||||
if ($x = parse_element($buf, "<url>")) {
|
||||
$p->url = $x;
|
||||
}
|
||||
if ($x = parse_element($buf, "<total_credit>")) {
|
||||
$p->total_credit = $x;
|
||||
}
|
||||
if ($x = parse_element($buf, "<expavg_credit>")) {
|
||||
$p->expavg_credit = $x;
|
||||
}
|
||||
if ($x = parse_element($buf, "<id>")) {
|
||||
$p->id = $x;
|
||||
}
|
||||
if ($x = parse_element($buf, "<country>")) {
|
||||
$p->country = $x;
|
||||
}
|
||||
if ($x = parse_element($buf, "<team_id>")) {
|
||||
$p->team_id = $x;
|
||||
}
|
||||
if ($x = parse_element($buf, "<team_name>")) {
|
||||
$p->team_name = $x;
|
||||
}
|
||||
if ($x = parse_element($buf, "<create_time>")) {
|
||||
$p->create_time = $x;
|
||||
}
|
||||
}
|
||||
return $p;
|
||||
}
|
||||
|
||||
function parse_user($f, $user) {
|
||||
$user->projects = array();
|
||||
while (!feof($f)) {
|
||||
$buf = fgets($f);
|
||||
if (strstr($buf, "</user>")) break;
|
||||
if (strstr($buf, "<project>")) {
|
||||
$user->projects[] = parse_project($f);
|
||||
}
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
|
||||
function get_other_projects($user) {
|
||||
$cpid = md5($user->cross_project_id . $user->email_addr);
|
||||
$url = "http://boinc.netsoft-online.com/get_user.php?cpid=$cpid";
|
||||
$f = fopen($url, "r");
|
||||
if (!$f) {
|
||||
return $user;
|
||||
}
|
||||
$u = parse_user($f, $user);
|
||||
fclose($f);
|
||||
return $u;
|
||||
}
|
||||
|
||||
function show_project($project) {
|
||||
if ($project->url == "http://www.worldcommunitygrid.org/") {
|
||||
$x = $project->name;
|
||||
} else {
|
||||
$x = "<a href=\"$project->url"."show_user.php?userid=$project->id\">$project->name</a>";
|
||||
}
|
||||
echo "<tr>
|
||||
<td>$x</td>
|
||||
<td align=right>".number_format($project->total_credit, 0)."</td>
|
||||
<td align=right>".number_format($project->expavg_credit, 0)."</td>
|
||||
<td align=right>".date_str($project->create_time)."</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
function cmp($a, $b) {
|
||||
if ($a->expavg_credit == $b->expavg_credit) return 0;
|
||||
return ($a->expavg_credit < $b->expavg_credit)? 1 : -1;
|
||||
}
|
||||
|
||||
function show_other_projects($user, $personal) {
|
||||
if (count($user->projects) > 1) {
|
||||
usort($user->projects, "cmp");
|
||||
if ($personal) {
|
||||
echo "<h3>Projects in which you are participating</h3>";
|
||||
} else {
|
||||
echo "<h3>Projects in which $user->name is participating</h3>";
|
||||
}
|
||||
start_table();
|
||||
row_heading_array(array(
|
||||
"Project<br><span class=note>Click for user page</span>", "Total credit", "Average credit", "Since"
|
||||
));
|
||||
foreach($user->projects as $project) {
|
||||
show_project($project);
|
||||
}
|
||||
end_table();
|
||||
}
|
||||
}
|
||||
|
||||
function pending_credit($user) {
|
||||
$result = mysql_query("select sum(claimed_credit) as total from result where userid=$user->id and (validate_state=0 or validate_state=4)");
|
||||
$foobar = mysql_fetch_object($result);
|
||||
if (!$foobar) return 0;
|
||||
mysql_free_result($result);
|
||||
return $foobar->total;
|
||||
}
|
||||
|
||||
function total_posts($user) {
|
||||
$result = mysql_query(
|
||||
"select count(id) as total from post where user=$user->id"
|
||||
);
|
||||
if (!$result) return 0;
|
||||
$foobar = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
return $foobar->total;
|
||||
}
|
||||
|
||||
function show_credit($user) {
|
||||
row2(tr(TOTAL_CREDIT), format_credit($user->total_credit));
|
||||
row2(tr(EXPAVG_CREDIT), format_credit($user->expavg_credit));
|
||||
project_user_credit($user);
|
||||
}
|
||||
|
||||
require_once("../inc/stats_sites.inc");
|
||||
// show dynamic user info (private)
|
||||
//
|
||||
function show_user_stats_private($user) {
|
||||
global $cpid_stats_sites;
|
||||
row1("Work done");
|
||||
row2(PROJECT." member since", date_str($user->create_time));
|
||||
show_credit($user);
|
||||
$config = get_config();
|
||||
if (parse_bool($config, "show_results")) {
|
||||
row2("Pending credit", "<a href=pending.php>View</a>");
|
||||
}
|
||||
row2("Computers on this account",
|
||||
"<a href=hosts_user.php>View</a>"
|
||||
);
|
||||
row2("Results", "<a href=results.php?userid=$user->id>View</a>");
|
||||
$cpid = md5($user->cross_project_id . $user->email_addr);
|
||||
$x = "";
|
||||
shuffle($cpid_stats_sites);
|
||||
foreach ($cpid_stats_sites as $site) {
|
||||
$name = $site[0];
|
||||
$y = sprintf($site[1], $cpid);
|
||||
$x .= "<a href=$y>$name</a><br>";
|
||||
}
|
||||
$x .= "<br><font size=-2>Cross-project ID: $cpid</font>\n";
|
||||
row2("Cross-project statistics", $x);
|
||||
row2("Stats on your cell phone", URL_BASE."userw.php?id=$user->id");
|
||||
row2("Account number<br><font size=-2>Used in URLs</font>", $user->id);
|
||||
}
|
||||
|
||||
// show static user info (private)
|
||||
//
|
||||
function show_user_info_private($user) {
|
||||
if (is_valid_email_addr($user->email_addr)) {
|
||||
$email_text = $user->email_addr;
|
||||
} else {
|
||||
$email_text = "Verification pending";
|
||||
}
|
||||
|
||||
row1("Account information");
|
||||
row2("Email address<br>", $email_text);
|
||||
row2("Name", $user->name);
|
||||
if (strlen($user->url)) {
|
||||
$x = "http://$user->url";
|
||||
} else {
|
||||
$x = "none";
|
||||
}
|
||||
row2("URL", $x);
|
||||
row2("Country", $user->country);
|
||||
row2("Postal code", $user->postal_code);
|
||||
row2("Change", "<a href=edit_email_form.php>email address</a> | <a href=edit_passwd_form.php>password</a> | <a href=edit_user_info_form.php>other account info</a>");
|
||||
row2("", "<a href=queue_show_queue.php>Show private queue</a>");
|
||||
row2("", "<a href=logout.php?".url_tokens($user->authenticator).">Log out</a>");
|
||||
|
||||
row1("Community");
|
||||
|
||||
$sql = "SELECT * FROM profile WHERE userid = ".$user->id;
|
||||
$result = mysql_query($sql);
|
||||
if (mysql_num_rows($result) != 0) {
|
||||
$x = "<a href=view_profile.php?userid=$user->id>View or edit</a> | <a href=delete_profile.php>Delete</a>";
|
||||
} else {
|
||||
$x = "<a href=create_profile.php>Create</a>";
|
||||
}
|
||||
row2("Profile", $x);
|
||||
$tot = total_posts($user);
|
||||
if ($tot) {
|
||||
row2("Message boards", "<a href=".URL_BASE."forum_user_posts.php?userid=$user->id>$tot posts</a>");
|
||||
}
|
||||
|
||||
row2("Private messages", pm_notification($user));
|
||||
|
||||
row1("Teams");
|
||||
if ($user->teamid) {
|
||||
$team = lookup_team($user->teamid);
|
||||
$x = "<a href=team_display.php?teamid=$team->id>$team->name</a>
|
||||
| <a href=team_quit_form.php>Quit team</a>";
|
||||
if ($team->userid == $user->id) {
|
||||
$x .= " | <a href=team_manage.php>management functions</a>";
|
||||
}
|
||||
row2("Team", $x);
|
||||
} else {
|
||||
row2("Team", "None (<a href=team.php>find a team</a>)");
|
||||
}
|
||||
|
||||
$team_founder = lookup_team_founder($user->id);
|
||||
if ($team_founder) {
|
||||
while ($res = mysql_fetch_object($team_founder)) {
|
||||
if ($res->id != $user->teamid) {
|
||||
row2("founder of", "<a href=team_display.php?teamid=$res->id>$res->name</a> | <a href=\"team_change_founder_form.php?teamid=".$res->id."\">Change team founder</a>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
row1("<a name=prefs>Preferences");
|
||||
row2(
|
||||
"General preferences<br><font size=-2>specify when and how BOINC uses your computer</font>",
|
||||
"<a href=prefs.php?subset=global>View or edit</a>"
|
||||
);
|
||||
row2(PROJECT." preferences<br><font size=-2>control resource share and customize graphics</font>",
|
||||
"<a href=prefs.php?subset=project>View or edit</a>"
|
||||
);
|
||||
row2("Message board preferences<br><font size=-2>configure features and appearance of message boards</font>",
|
||||
"<a href=\"edit_forum_preferences_form.php\">View or edit</a>"
|
||||
);
|
||||
}
|
||||
|
||||
// show summary of dynamic and static info (public)
|
||||
//
|
||||
function show_user_summary_public($user) {
|
||||
row2(PROJECT." member since", date_str($user->create_time));
|
||||
row2("Country", $user->country);
|
||||
if (strlen($user->url)) {
|
||||
row2("URL", "<a href=\"http://$user->url\">http://$user->url</a>");
|
||||
}
|
||||
show_credit($user);
|
||||
|
||||
if ($user->teamid && ($team = lookup_team($user->teamid))) {
|
||||
row2("Team", "<a href=\"".URL_BASE."team_display.php?teamid=$team->id\">$team->name</a>");
|
||||
} else {
|
||||
row2("Team", "None");
|
||||
}
|
||||
if ($user->show_hosts) {
|
||||
row2("Computers", "<a href=\"".URL_BASE."hosts_user.php?userid=$user->id\">View</a>");
|
||||
} else {
|
||||
row2("Computers", "hidden");
|
||||
}
|
||||
$tot = total_posts($user);
|
||||
if ($tot) {
|
||||
row2("Message boards", "<a href=\"".URL_BASE."forum_user_posts.php?userid=$user->id\">$tot posts</a>");
|
||||
}
|
||||
|
||||
if ($user->donated == 1) {
|
||||
if (file_exists("../project/donations.inc")) {
|
||||
require_once("../project/donations.inc");
|
||||
$x .= DONATION_LINK;
|
||||
row2("Donor",$x);
|
||||
}
|
||||
}
|
||||
|
||||
row2("Contact", "<a href=\"forum_pm.php?action=new&userid=".$user->id."\">Send private message</a>");
|
||||
}
|
||||
|
||||
function show_profile_link($user) {
|
||||
if ($user->has_profile) {
|
||||
row2("Profile", "<a href=\"view_profile.php?userid=$user->id\">View</a>");
|
||||
}
|
||||
}
|
||||
|
||||
// show a summary of the user.
|
||||
// NOTE: This is intended to be shown only to that user.
|
||||
// it has info that other users aren't supposed to see
|
||||
|
||||
function show_user_page_private($user) {
|
||||
$config = get_config();
|
||||
start_table("width=100%");
|
||||
show_user_info_private($user);
|
||||
show_user_stats_private($user);
|
||||
|
||||
// Does this project accept donations? Then put in a project specific
|
||||
// function to show user donation information in ../project/donations.inc
|
||||
//
|
||||
if (parse_bool($config, "donations_accepted")) {
|
||||
if (file_exists("../project/donations.inc")) {
|
||||
require_once("../project/donations.inc");
|
||||
show_user_donations_private($user);
|
||||
}
|
||||
}
|
||||
end_table();
|
||||
}
|
||||
|
||||
function user_table_start($sort_by) {
|
||||
start_table();
|
||||
echo "
|
||||
<tr>
|
||||
<th>".tr(USER_TABLE_RANK)."</th>
|
||||
<th>".tr(USER_TABLE_NAME)."</th>
|
||||
";
|
||||
if ($sort_by == "total_credit") {
|
||||
echo "
|
||||
<th><a href=top_users.php?sort_by=expavg_credit>".tr(EXPAVG_CREDIT)."</a></th>
|
||||
<th>".tr(TOTAL_CREDIT)."</th>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<th>".tr(EXPAVG_CREDIT)."</th>
|
||||
<th><a href=top_users.php?sort_by=total_credit>".tr(TOTAL_CREDIT)."</a></th>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<th>".tr(USER_TABLE_COUNTRY)."</th>
|
||||
<th>".tr(USER_TABLE_PTIME)."</th>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
function show_user_row($user, $i) {
|
||||
echo "
|
||||
<tr class=row1>
|
||||
<td>$i</td>
|
||||
<td>", user_links($user), "</td>
|
||||
<td>", format_credit($user->expavg_credit), "</td>
|
||||
<td>", format_credit($user->total_credit), "</td>
|
||||
<td>", $user->country, "</td>
|
||||
<td>", time_str($user->create_time),"</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
// decay a user's average credit
|
||||
//
|
||||
function user_decay_credit($user) {
|
||||
$avg = $user->expavg_credit;
|
||||
$avg_time = $user->expavg_time;
|
||||
$now = time(0);
|
||||
update_average($now, 0, 0, $avg, $avg_time);
|
||||
mysql_query("update user set expavg_credit=$avg, expavg_time=$now where id=$user->id");
|
||||
|
||||
}
|
||||
// if the user hasn't received new credit for ndays,
|
||||
// decay its average and return true
|
||||
//
|
||||
function user_inactive_ndays($user, $ndays) {
|
||||
$diff = time() - $user->expavg_time;
|
||||
if ($diff > $ndays*86400) {
|
||||
user_decay_credit($user);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/db_ops.inc" );
|
||||
include_once( "../inc/util_ops.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
include_once( "../inc/queue.inc" );
|
||||
|
||||
$timestr = time_str(time(0));
|
||||
|
||||
db_init();
|
||||
|
||||
$workunitid = get_int( 'workunitid' );
|
||||
|
||||
$workunit = mysql_fetch_object( mysql_query( "SELECT * FROM workunit WHERE id=".$workunitid ) );
|
||||
$job = mysql_fetch_object( mysql_query( "SELECT * FROM q_list WHERE workunit=".$workunit->id ) );
|
||||
$user = mysql_fetch_object( mysql_query( "SELECT * FROM user WHERE id=".$job -> user ) );
|
||||
$title = "Deleting job '".workunit_name( $workunit )."' (".$workunitid.") of ".$user -> name." at ".$timestr;
|
||||
|
||||
$jobname = workunit_name( $workunit );
|
||||
|
||||
$config = get_config();
|
||||
|
||||
$jobstatusstring = workunit_status_string( $workunit );
|
||||
$jobsubmittime = time_str( $workunit -> create_time );
|
||||
|
||||
admin_page_head( $title );
|
||||
start_table();
|
||||
row1( "Job speciffics" );
|
||||
row2( "Job submit time: ", $jobsubmittime );
|
||||
row2( "Job name: ", $jobname );
|
||||
row2( "Old job status: ", $jobstatusstring );
|
||||
|
||||
$allresults = mysql_query( "SELECT * FROM result WHERE workunitid=".$workunitid );
|
||||
$nrofresults = mysql_num_rows( $allresults );
|
||||
|
||||
for( $resultindex = 0; $resultindex < $nrofresults; ++$resultindex )
|
||||
{
|
||||
$result = mysql_fetch_object( $allresults );
|
||||
$result -> xml_doc_in = remove_tags( $result -> xml_doc_in, "<queue_tag/>" );
|
||||
$query = "UPDATE result SET xml_doc_in='".$result -> xml_doc_in."' WHERE id=".$result -> id;
|
||||
mysql_query( $query );
|
||||
}
|
||||
|
||||
$query = "UPDATE result SET server_state=5,outcome=5 WHERE server_state=2 AND workunitid=".$workunit -> id;
|
||||
mysql_query( $query );
|
||||
|
||||
$workunit -> xml_doc = remove_tags( $workunit -> xml_doc, "<queue_tag/>" );
|
||||
$query = "UPDATE workunit SET xml_doc='".$workunit -> xml_doc."' WHERE id=".$workunit -> id;
|
||||
mysql_query( $query );
|
||||
|
||||
$query = "UPDATE workunit SET error_mask=error_mask|16,transition_time=".time(0)." WHERE id=".$workunit -> id;
|
||||
mysql_query( $query );
|
||||
|
||||
$query = "DELETE FROM q_list WHERE id=".$job -> id;
|
||||
mysql_query( $query );
|
||||
|
||||
row2( "New job status: ", "deleted" );
|
||||
|
||||
row1( "Commands" );
|
||||
row2( "", '<a href="queue_show_queue.php">Go back to queue</a>' );
|
||||
|
||||
end_table();
|
||||
admin_page_tail();
|
||||
|
||||
?>
|
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/db_ops.inc" );
|
||||
include_once( "../inc/util_ops.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
include_once( "../inc/queue.inc" );
|
||||
|
||||
$timestr = time_str(time(0));
|
||||
|
||||
db_init();
|
||||
|
||||
$workunitid = get_int( 'workunitid' );
|
||||
|
||||
$workunit = mysql_fetch_object( mysql_query( "SELECT * FROM workunit WHERE id=".$workunitid ) );
|
||||
$job = mysql_fetch_object( mysql_query( "SELECT * FROM q_list WHERE workunit=".$workunit->id ) );
|
||||
$user = mysql_fetch_object( mysql_query( "SELECT * FROM user WHERE id=".$job -> user ) );
|
||||
$title = "Job '".workunit_name( $workunit )."' (".$workunitid.") of ".$user -> name." at ".$timestr;
|
||||
|
||||
$jobname = workunit_name( $workunit );
|
||||
|
||||
$config = get_config();
|
||||
|
||||
$jobapplication = mysql_fetch_object( mysql_query( "SELECT * FROM app WHERE id=".$workunit -> appid ) );
|
||||
$jobapplicationname = $jobapplication -> name;
|
||||
$jobapplicationfriendlyname = $jobapplication -> user_friendly_name;
|
||||
$jobfops = $workunit -> rsc_fpops_est;
|
||||
$jobmem = $workunit -> rsc_memory_bound;
|
||||
$jobdisk = $workunit -> rsc_disk_bound;
|
||||
$jobstatusstring = workunit_status_string( $workunit );
|
||||
|
||||
$coloredjobstatusstring = $jobstatusstring;
|
||||
if( $jobstatusstring == "running" ) $coloredjobstatusstring = "<font color='green'><b>".$jobstatusstring."</b></font>";
|
||||
if( $jobstatusstring == "queued" ) $coloredjobstatusstring = "<font color='blue'><b>".$jobstatusstring."</b></font>";
|
||||
if( $jobstatusstring == "ERROR" ) $coloredjobstatusstring = "<font color='red'><b>".$jobstatusstring."</b></font>";
|
||||
|
||||
$jobsubmittime = time_str( $workunit -> create_time );
|
||||
|
||||
$workunitidstring = "<a href=db_action.php?table=workunit&id=".$job -> workunit.">".$job -> workunit."</a>";
|
||||
|
||||
$jobinputurl = parse_element( $workunit -> xml_doc, "<file_info>" );
|
||||
$jobinputurl = parse_element( $jobinputurl, "<url>" );
|
||||
$jobinput = parse_element( $workunit -> xml_doc, "<file_info>" );
|
||||
$jobinput = parse_element( $jobinput, "<name>" );
|
||||
|
||||
admin_page_head( $title );
|
||||
start_table();
|
||||
|
||||
row1( "Job speciffics" );
|
||||
row2( "Job status: ", $coloredjobstatusstring );
|
||||
row2( "Job application: ", $jobapplicationfriendlyname );
|
||||
row2( "Job submit time: ", $jobsubmittime );
|
||||
row2( "Job name: ", $jobname );
|
||||
row2( "Job id: ", $workunitidstring );
|
||||
row2( "Job estimated time to complete: ", floor((float)($jobfops)/92254963740)." min. " );
|
||||
row2( "Job estimated memory usage: ", floor((float)($jobmem)/1048576)." Mb. " );
|
||||
row2( "Job estimated disk usage: ", floor((float)($jobdisk)/1048576)." Mb. " );
|
||||
row2( "Job input file:", '<a href="'.$jobinputurl.'"> '.$jobinput.'</a>' );
|
||||
|
||||
if( ( $jobstatusstring == "finished" ) || ( $jobstatusstring == "ERROR" ) )
|
||||
{
|
||||
if( $jobstatusstring != "finished" )
|
||||
{
|
||||
$resultunitquery = mysql_query( "SELECT * FROM result WHERE workunitid=".$workunit -> id );
|
||||
$nrofresults = mysql_num_rows( $resultunitquery );
|
||||
|
||||
for( $index = 0; $index < $nrofresults; ++$index )
|
||||
{
|
||||
$resultunit = mysql_fetch_object( $resultunitquery );
|
||||
|
||||
$jobstderr = parse_element( $resultunit -> stderr_out, "<stderr_txt>" );
|
||||
|
||||
if( $jobstderr )
|
||||
{
|
||||
row1( "Error output of this job" );
|
||||
row2( "", $jobstderr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultunit = mysql_fetch_object( mysql_query( "SELECT * FROM result WHERE id=".$workunit -> canonical_resultid ) );
|
||||
|
||||
$xmldoc = $resultunit -> xml_doc_out;
|
||||
|
||||
$nroffiles = 0;
|
||||
$cursor = 0;
|
||||
while( $tempfileinfo = parse_next_element( $xmldoc, "<file_info>", &$cursor ) )
|
||||
$outputfiles[ $nroffiles++ ] = parse_element( $tempfileinfo, "<name>" );
|
||||
|
||||
if( $nroffiles >= 1 )
|
||||
{
|
||||
$fanoutnr = parse_config( $config, "<uldl_dir_fanout>" );
|
||||
row1( "Output of this job" );
|
||||
row2( "Number of output files of job: ", $nroffiles );
|
||||
for( $index = 0; $index < $nroffiles; ++$index )
|
||||
{
|
||||
$filename = $outputfiles[ $index ];
|
||||
$url = "upload/".fan_out_dir( $filename, $fanoutnr )."/".$filename;
|
||||
$outputfilelink = '<a href="'.$url.'">'.$filename.'</a>';
|
||||
row2( "Output file ".($index+1).": ", $outputfilelink );
|
||||
}
|
||||
}
|
||||
|
||||
$jobstderr = parse_element( $resultunit -> stderr_out, "<stderr_txt>" );
|
||||
|
||||
if( $jobstderr )
|
||||
{
|
||||
row1( "Error output of this job" );
|
||||
row2( "", $jobstderr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$max_jobs = max_nr_of_jobs_of_user( $user );
|
||||
$njobs = nr_of_jobs_of_user( $user );
|
||||
|
||||
row1( "Commands" );
|
||||
row2( "", '<a href="queue_remove_job.php?workunitid='.$workunit -> id.'">Kill or Remove this job</a>' );
|
||||
row2( "", '<a href="queue_show_queue.php">Go back to queue</a>' );
|
||||
|
||||
end_table();
|
||||
|
||||
admin_page_tail();
|
||||
?>
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/db_ops.inc" );
|
||||
include_once( "../inc/util_ops.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
include_once( "../inc/queue.inc" );
|
||||
|
||||
db_init();
|
||||
|
||||
$timestr = time_str(time(0));
|
||||
$title = "Job list at ".$timestr;
|
||||
|
||||
admin_page_head( $title );
|
||||
|
||||
$alljobs = mysql_query( "SELECT * FROM workunit WHERE name LIKE '%queue%'" );
|
||||
$njobs = mysql_num_rows( $alljobs );
|
||||
|
||||
start_table();
|
||||
|
||||
if( $njobs )
|
||||
{
|
||||
if( $njobs > 1 )
|
||||
row1( "There are ".$njobs." jobs listed !<br>" );
|
||||
else
|
||||
row1( "There is only one job listed !<br>" );
|
||||
|
||||
end_table();
|
||||
start_table();
|
||||
|
||||
row6( "<b>Job #</b>", "<b>User</b>", "<b>Job submit time</b>", "<b>Job status</b>", "<b>Job name</b>", "<b>Job ID</b>" );
|
||||
|
||||
for( $jobindex = 0; $jobindex < $njobs; ++$jobindex )
|
||||
{
|
||||
$workunit = mysql_fetch_object( $alljobs );
|
||||
|
||||
$prefix = '<a href="queue_show_job.php?workunitid='.$workunit -> id.'">';
|
||||
$workunitname = $prefix.workunit_name( $workunit ).'</a>';
|
||||
$workunitidstr = "<a href='db_action.php?table=workunit&id=".$workunit -> id."'>".$workunit -> id."</a>";
|
||||
$status = workunit_status_string( $workunit );
|
||||
$jobsubmittime = time_str( $workunit -> create_time );
|
||||
|
||||
if( $status != "CANCELED" )
|
||||
{
|
||||
if( $status == "running" ) $status = "<font color='green'><b>".$status."</b></font>";
|
||||
if( $status == "queued" ) $status = "<font color='blue'><b>".$status."</b></font>";
|
||||
|
||||
$job = mysql_fetch_object( mysql_query( "SELECT * FROM q_list WHERE workunit=".$workunit->id ) );
|
||||
$user = mysql_fetch_object( mysql_query( "SELECT * FROM user WHERE id=".$job -> user ) );
|
||||
$jobusername = "<a href='db_action.php?table=user&id=".$user -> id."'>".$user -> name."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$jobusername = "<font color='red'><b>UNKNOWN</b></font>";
|
||||
$status = "<font color='red'><b>CANCELED</b></font>";
|
||||
$workunitname = workunit_name( $workunit );
|
||||
}
|
||||
|
||||
row6( $jobindex+1, $jobusername, $jobsubmittime, $status, $workunitname, $workunitidstr );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
row1("There are NO jobs listed !<br>");
|
||||
|
||||
end_table();
|
||||
|
||||
admin_page_tail();
|
||||
|
||||
?>
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
include_once( "../inc/queue.inc" );
|
||||
|
||||
db_init();
|
||||
|
||||
$user = get_logged_in_user();
|
||||
$timestr = time_str(time(0));
|
||||
$title = "New job for ".$user -> name." at ".$timestr;
|
||||
|
||||
page_head( $title );
|
||||
|
||||
$appresult = mysql_query( "SELECT * FROM app" );
|
||||
$nrofapps = mysql_num_rows( $appresult );
|
||||
|
||||
if( $nrofapps )
|
||||
{
|
||||
|
||||
$selection = "";
|
||||
for( $appindex = 0; $appindex < $nrofapps; ++$appindex )
|
||||
{
|
||||
$app = mysql_fetch_object( $appresult );
|
||||
|
||||
$appqmax = nr_of_jobs_for_user_for_app( $user, $app );
|
||||
$appsubmitted = nr_of_submitted_jobs_for_user_for_app( $user, $app );
|
||||
|
||||
if( $appqmax > $appsubmitted )
|
||||
$selection = $selection.'<option value="'.$app -> id.'">'.$app -> user_friendly_name.'</option>';
|
||||
}
|
||||
|
||||
if( $selection != "" )
|
||||
{
|
||||
|
||||
echo '<form action="queue_new_job_form_action.php" method="POST">';
|
||||
start_table();
|
||||
|
||||
row1( "New job speciffics" );
|
||||
$selection = "<select name=\"application\">".$selection."</select>";
|
||||
row2( "Application: ", $selection );
|
||||
row2( "Name of job (no spaces, quotes or slashes): ", '<input type="text" size="65" name="name" value="" maxlength="128" >' );
|
||||
row2( "Input: ", '<textarea wrap="off" rows="20" cols="74" name="input"></textarea>' );
|
||||
|
||||
$selection = '<option value="461274818700"> 5 min. </option>';
|
||||
$selection .= '<option value="1383824456100"> 15 min. </option>';
|
||||
$selection .= '<option value="2767648912200"> 30 min. </option>';
|
||||
$selection .= '<option value="5535297824400"> 1 h. </option>';
|
||||
$selection .= '<option value="16605893473200"> 3 h. </option>';
|
||||
$selection .= '<option value="33211786946400"> 6 h. </option>';
|
||||
$selection = "<select name=\"fops\">".$selection."</select>";
|
||||
row2( "Estimated time to completion: ", $selection );
|
||||
|
||||
$selection = '<option value="2097152"> 2 Mb. </option>';
|
||||
$selection .= '<option value="4194304"> 4 Mb. </option>';
|
||||
$selection .= '<option value="16777216"> 16 Mb. </option>';
|
||||
$selection .= '<option value="67108864"> 64 Mb. </option>';
|
||||
$selection .= '<option value="134217728"> 128 Mb. </option>';
|
||||
$selection = "<select name=\"mem\">".$selection."</select>";
|
||||
row2( "Estimated memory usage: ", $selection );
|
||||
|
||||
$selection = '<option value="2097152"> 2 Mb. </option>';
|
||||
$selection .= '<option value="4194304"> 4 Mb. </option>';
|
||||
$selection .= '<option value="16777216"> 16 Mb. </option>';
|
||||
$selection .= '<option value="67108864"> 64 Mb. </option>';
|
||||
$selection .= '<option value="134217728"> 128 Mb. </option>';
|
||||
$selection .= '<option value="536870912"> 512 Mb. </option>';
|
||||
$selection = "<select name=\"disk\">".$selection."</select>";
|
||||
row2( "Estimated disk usage: ", $selection );
|
||||
|
||||
row2( "", '<input type="submit" value=" Submit Job ">' );
|
||||
|
||||
row1( "Commands" );
|
||||
row2( "", '<a href="download/DownLoads/ClassicalBuilder/webstart_ClassicalBuilder.jnlp">Run Classical-Builder</a>' );
|
||||
row2( "", '<a href="queue_show_queue.php">Go back to your queue</a>' );
|
||||
row2( "", '<a href="logout.php">Log out</a>' );
|
||||
|
||||
end_table();
|
||||
echo '</form>';
|
||||
|
||||
}
|
||||
else
|
||||
exit_with_text( "You are not allowed to submit any jobs !" );
|
||||
|
||||
}
|
||||
|
||||
page_tail();
|
||||
|
||||
?>
|
|
@ -0,0 +1,154 @@
|
|||
<?php
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
include_once( "../inc/queue.inc" );
|
||||
|
||||
db_init();
|
||||
|
||||
$timestr = time_str(time(0));
|
||||
|
||||
$jobapplication = post_int( 'application' );
|
||||
$jobname = escapeshellcmd( $_POST[ 'name' ] );
|
||||
$jobinput = post_str( 'input' );
|
||||
$jobfops = post_int( 'fops' );
|
||||
$jobdisk = post_int( 'disk' );
|
||||
$jobmem = post_int( 'mem' );
|
||||
|
||||
if( get_magic_quotes_gpc() )
|
||||
$jobinput = stripslashes( $jobinput );
|
||||
|
||||
$config = get_config();
|
||||
$name = parse_config( $config, "<long_name>" );
|
||||
$user = get_logged_in_user();
|
||||
|
||||
$jobapplicationname = mysql_fetch_object( mysql_query( "SELECT * FROM app WHERE id=".$jobapplication ) );
|
||||
$app = $jobapplicationname;
|
||||
$jobapplicationfriendlyname = $jobapplicationname -> user_friendly_name;
|
||||
$jobapplicationname = $jobapplicationname -> name;
|
||||
|
||||
$title = "New job for '".$jobname."' ".$user -> name." at ".$timestr;
|
||||
page_head( $title );
|
||||
|
||||
start_table();
|
||||
row1( "Job speciffics" );
|
||||
row2( "Job application: ", $jobapplicationfriendlyname );
|
||||
row2( "Job name: ", $jobname );
|
||||
row2( "Job estimated time to complete: ", floor( ( float )( $jobfops ) / 92254963740 )." min. " );
|
||||
row2( "Job estimated memory usage: ", floor( ( float )( $jobmem ) / 1048576 )." Mb. " );
|
||||
row2( "Job estimated disk usage: ", floor( ( float )( $jobdisk ) / 1048576 )." Mb. " );
|
||||
row2( "Job input:", '<textarea wrap="off" rows="20" cols="74">'.$jobinput.'</textarea>' );
|
||||
end_table();
|
||||
|
||||
if( ( $jobname == "" ) || strpos( $jobname, "queue" ) || strpos( $jobname, " " ) ||
|
||||
strpos( $jobname, '"' ) || strpos( $jobname, "'" ) || strpos( $jobname, "`" ) ||
|
||||
strpos( $jobname, "\\" ) )
|
||||
exit_with_text( "The job name is invalid !" );
|
||||
|
||||
if( $jobinput == "" )
|
||||
exit_with_text( "There was no input !" );
|
||||
|
||||
$appqmax = nr_of_jobs_for_user_for_app( $user, $app );
|
||||
$appsubmitted = nr_of_submitted_jobs_for_user_for_app( $user, $app );
|
||||
if( $appqmax <= $appsubmitted )
|
||||
exit_with_text( "Job limit would be exceeded!" );
|
||||
|
||||
$bin_dir = parse_config( $config, "<bin_dir>" );
|
||||
$download_dir = parse_config( $config, "<download_dir>" );
|
||||
$upload_dir = parse_config( $config, "<upload_dir>" );
|
||||
$template_dir = parse_config( $config, "<template_dir>" );
|
||||
$config_dir = parse_config( $config, "<project_dir>" );
|
||||
$createworkprogram = parse_config( $config, "<create_work_program>" );
|
||||
|
||||
$extendedjobname = $jobname."_queue_".$jobapplication."_".time(0)."_".random_string();
|
||||
$extendedjobname = escapeshellcmd( $extendedjobname );
|
||||
|
||||
$wu_template = $template_dir."/queue_".$jobapplicationname."_work_unit_template";
|
||||
$result_template = $template_dir."/queue_".$jobapplicationname."_result_unit_template";
|
||||
$temporaryinputfile = $extendedjobname;
|
||||
|
||||
$command_to_submit = $bin_dir."/".$createworkprogram;
|
||||
$command_to_submit .= " -config_dir ".$config_dir;
|
||||
$command_to_submit .= " -appname ".$jobapplicationname;
|
||||
$command_to_submit .= " -wu_name ".$extendedjobname;
|
||||
$command_to_submit .= " -wu_template ".$wu_template;
|
||||
$command_to_submit .= " -result_template ".$result_template;
|
||||
$command_to_submit .= " -rsc_fpops_est ".floor( ( float )( $jobfops ) );
|
||||
$command_to_submit .= " -rsc_fpops_bound ".floor( 3.0 * ( float )( $jobfops ) );
|
||||
$command_to_submit .= " -rsc_memory_bound ".floor( ( float )( $jobmem ) );
|
||||
$command_to_submit .= " -rsc_disk_bound ".floor( ( float )( $jobdisk ) );
|
||||
$command_to_submit .= " -priority 10 -batch ".$user -> id;
|
||||
$command_to_submit .= " ".$temporaryinputfile;
|
||||
$command_to_submit = escapeshellcmd( $command_to_submit );
|
||||
$command_to_submit = "cd ".$config_dir."; ".$command_to_submit;
|
||||
|
||||
$temporaryinputfile = $download_dir."/".$temporaryinputfile;
|
||||
|
||||
$filehandle = fopen( $temporaryinputfile, "w" );
|
||||
if( !$filehandle )
|
||||
exit_with_text( "Cannot create the temporary input file !" );
|
||||
|
||||
if( !fwrite( $filehandle, $jobinput ) )
|
||||
{
|
||||
fclose( $filehandle );
|
||||
exit_with_text( "Cannot write to the temporary input file !" );
|
||||
}
|
||||
|
||||
fclose( $filehandle );
|
||||
|
||||
if( strpos( $jobapplicationname, "classical" ) !== false )
|
||||
{
|
||||
$testinputcommand = $bin_dir."/verify_classical_input ".$temporaryinputfile." /dev/null /dev/stdout /dev/stdout";
|
||||
$testinputcommand = escapeshellcmd( $testinputcommand );
|
||||
$testinputcommand = "cd ".$config_dir."; ".$testinputcommand;
|
||||
$errorline = 0;
|
||||
exec( $testinputcommand, &$outputoftest, &$errorline );
|
||||
if( $errorline != 0 )
|
||||
{
|
||||
$errorstring = "Your input had an error on line ".$errorline." ! The job was not submitted !";
|
||||
unlink( $temporaryinputfile );
|
||||
exit_with_text( $errorstring );
|
||||
}
|
||||
}
|
||||
|
||||
system( $command_to_submit );
|
||||
|
||||
unlink( $temporaryinputfile );
|
||||
|
||||
$workunit = mysql_fetch_object( mysql_query( "SELECT * FROM workunit WHERE name='".$extendedjobname."'" ) );
|
||||
|
||||
if( !$workunit )
|
||||
exit_with_text( "Error during submition of the workunit associated with your job !" );
|
||||
|
||||
$qlistentry = mysql_query( "INSERT INTO q_list VALUES('','".$user->id."','".$workunit->id."')" );
|
||||
|
||||
if( !$qlistentry )
|
||||
exit_with_text( "Error during submition of your job !" );
|
||||
|
||||
$jobidlink = '<a href="queue_show_job.php?workunitid='.$workunit -> id.'">'.$jobname.' ('.$workunit -> id.')</a>';
|
||||
|
||||
start_table();
|
||||
row1( "Your job has been submitted !" );
|
||||
row2( "Job status: ", workunit_status_string( $workunit ) );
|
||||
row2( "Job id: ", $jobidlink );
|
||||
|
||||
row1( "Commands" );
|
||||
row2( "Status of this job: ", '<a href="queue_show_job.php?workunitid='.$workunit -> id.'">Show job status</a>' );
|
||||
$max_jobs = max_nr_of_jobs_of_user( $user );
|
||||
$njobs = nr_of_jobs_of_user( $user );
|
||||
if( $njobs < $max_jobs )
|
||||
{
|
||||
if( $max_jobs - $njobs > 1 )
|
||||
$line = "You can submit ".($max_jobs-$njobs)." more jobs: ";
|
||||
else
|
||||
$line = "You can submit one more job: ";
|
||||
row2( $line, '<a href="queue_new_job_form.php">Submit another job</a>' );
|
||||
}
|
||||
row2( "", '<a href="queue_show_queue.php">Go back to your queue</a>' );
|
||||
row2( "", '<a href="logout.php">Log out</a>' );
|
||||
|
||||
end_table();
|
||||
page_tail();
|
||||
|
||||
?>
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
include_once( "../inc/queue.inc" );
|
||||
|
||||
$timestr = time_str(time(0));
|
||||
|
||||
db_init();
|
||||
|
||||
$user = get_logged_in_user();
|
||||
$workunitid = get_int( 'workunitid' );
|
||||
$workunit = mysql_fetch_object( mysql_query( "SELECT * FROM workunit WHERE id=".$workunitid ) );
|
||||
$job = mysql_fetch_object( mysql_query( "SELECT * FROM q_list WHERE workunit=".$workunitid ) );
|
||||
$title = "Deleting job '".workunit_name( $workunit )."' (".$workunitid.") of ".$user -> name." at ".$timestr;
|
||||
|
||||
$jobname = workunit_name( $workunit );
|
||||
|
||||
if( $user -> id != $job -> user )
|
||||
{
|
||||
$title = "Job '".$jobname."' (".$workunitid.")";
|
||||
page_head( $title );
|
||||
exit_with_text( "You are not the owner of this job !" );
|
||||
}
|
||||
|
||||
$config = get_config();
|
||||
|
||||
$jobstatusstring = workunit_status_string( $workunit );
|
||||
$jobsubmittime = time_str( $workunit -> create_time );
|
||||
|
||||
page_head( $title );
|
||||
start_table();
|
||||
row1( "Job speciffics" );
|
||||
row2( "Job submit time: ", $jobsubmittime );
|
||||
row2( "Job name: ", $jobname );
|
||||
row2( "Old job status: ", $jobstatusstring );
|
||||
|
||||
$allresults = mysql_query( "SELECT * FROM result WHERE workunitid=".$workunitid );
|
||||
$nrofresults = mysql_num_rows( $allresults );
|
||||
|
||||
for( $resultindex = 0; $resultindex < $nrofresults; ++$resultindex )
|
||||
{
|
||||
$result = mysql_fetch_object( $allresults );
|
||||
$result -> xml_doc_in = remove_tags( $result -> xml_doc_in, "<queue_tag/>" );
|
||||
$query = "UPDATE result SET xml_doc_in='".$result -> xml_doc_in."' WHERE id=".$result -> id;
|
||||
mysql_query( $query );
|
||||
}
|
||||
|
||||
$query = "UPDATE result SET server_state=5,outcome=5 WHERE server_state=2 AND workunitid=".$workunit -> id;
|
||||
mysql_query( $query );
|
||||
|
||||
$workunit -> xml_doc = remove_tags( $workunit -> xml_doc, "<queue_tag/>" );
|
||||
$query = "UPDATE workunit SET xml_doc='".$workunit -> xml_doc."' WHERE id=".$workunit -> id;
|
||||
mysql_query( $query );
|
||||
|
||||
$query = "UPDATE workunit SET error_mask=error_mask|16,transition_time=".time(0)." WHERE id=".$workunit -> id;
|
||||
mysql_query( $query );
|
||||
|
||||
$query = "DELETE FROM q_list WHERE id=".$job -> id;
|
||||
mysql_query( $query );
|
||||
|
||||
row2( "New job status: ", "deleted" );
|
||||
|
||||
$max_jobs = max_nr_of_jobs_of_user( $user );
|
||||
$njobs = nr_of_jobs_of_user( $user );
|
||||
|
||||
row1( "Commands" );
|
||||
if( $njobs < $max_jobs )
|
||||
{
|
||||
if( $max_jobs - $njobs > 1 )
|
||||
$line = "You can submit ".($max_jobs-$njobs)." more jobs: ";
|
||||
else
|
||||
$line = "You can submit one more job: ";
|
||||
row2( $line, '<a href="queue_new_job_form.php">Submit a job</a>' );
|
||||
}
|
||||
row2( "", '<a href="queue_show_queue.php">Go back to your queue</a>' );
|
||||
row2( "", '<a href="logout.php">Log out</a>' );
|
||||
|
||||
end_table();
|
||||
|
||||
?>
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
include_once( "../inc/queue.inc" );
|
||||
|
||||
$timestr = time_str(time(0));
|
||||
|
||||
db_init();
|
||||
|
||||
$user = get_logged_in_user();
|
||||
$workunitid = get_int( 'workunitid' );
|
||||
$workunit = mysql_fetch_object( mysql_query( "SELECT * FROM workunit WHERE id=".$workunitid ) );
|
||||
$job = mysql_fetch_object( mysql_query( "SELECT * FROM q_list WHERE workunit=".$workunitid ) );
|
||||
$title = "Job '".workunit_name( $workunit )."' (".$workunitid.") of ".$user -> name." at ".$timestr;
|
||||
|
||||
$jobname = workunit_name( $workunit );
|
||||
|
||||
if( $user -> id != $job -> user )
|
||||
{
|
||||
$title = "Job '".$jobname."' (".$workunitid.")";
|
||||
page_head( $title );
|
||||
exit_with_text( "You are not the owner of this job !" );
|
||||
}
|
||||
|
||||
$config = get_config();
|
||||
|
||||
$jobapplication = mysql_fetch_object( mysql_query( "SELECT * FROM app WHERE id=".$workunit -> appid ) );
|
||||
$jobapplicationname = $jobapplication -> name;
|
||||
$jobapplicationfriendlyname = $jobapplication -> user_friendly_name;
|
||||
$jobfops = $workunit -> rsc_fpops_est;
|
||||
$jobmem = $workunit -> rsc_memory_bound;
|
||||
$jobdisk = $workunit -> rsc_disk_bound;
|
||||
$jobstatusstring = workunit_status_string( $workunit );
|
||||
|
||||
$coloredjobstatusstring = $jobstatusstring;
|
||||
if( $jobstatusstring == "running" ) $coloredjobstatusstring = "<font color='green'><b>".$jobstatusstring."</b></font>";
|
||||
if( $jobstatusstring == "queued" ) $coloredjobstatusstring = "<font color='blue'><b>".$jobstatusstring."</b></font>";
|
||||
if( $jobstatusstring == "ERROR" ) $coloredjobstatusstring = "<font color='red'><b>".$jobstatusstring."</b></font>";
|
||||
|
||||
$jobsubmittime = time_str( $workunit -> create_time );
|
||||
|
||||
$workunitidstring = "<a href=workunit.php?wuid=".$job -> workunit.">".$job -> workunit."</a>";
|
||||
|
||||
$jobinputurl = parse_element( $workunit -> xml_doc, "<file_info>" );
|
||||
$jobinputurl = parse_element( $jobinputurl, "<url>" );
|
||||
$jobinput = parse_element( $workunit -> xml_doc, "<file_info>" );
|
||||
$jobinput = parse_element( $jobinput, "<name>" );
|
||||
|
||||
page_head( $title );
|
||||
start_table();
|
||||
|
||||
row1( "Job speciffics" );
|
||||
row2( "Job status: ", $coloredjobstatusstring );
|
||||
row2( "Job application: ", $jobapplicationfriendlyname );
|
||||
row2( "Job submit time: ", $jobsubmittime );
|
||||
row2( "Job name: ", $jobname );
|
||||
row2( "Job id: ", $workunitidstring );
|
||||
row2( "Job estimated time to complete: ", floor((float)($jobfops)/92254963740)." min. " );
|
||||
row2( "Job estimated memory usage: ", floor((float)($jobmem)/1048576)." Mb. " );
|
||||
row2( "Job estimated disk usage: ", floor((float)($jobdisk)/1048576)." Mb. " );
|
||||
row2( "Job input file:", '<a href="'.$jobinputurl.'"> '.$jobinput.'</a>' );
|
||||
|
||||
if( ( $jobstatusstring == "finished" ) || ( $jobstatusstring == "ERROR" ) )
|
||||
{
|
||||
if( $jobstatusstring != "finished" )
|
||||
{
|
||||
$resultunitquery = mysql_query( "SELECT * FROM result WHERE workunitid=".$workunit -> id );
|
||||
$nrofresults = mysql_num_rows( $resultunitquery );
|
||||
|
||||
for( $index = 0; $index < $nrofresults; ++$index )
|
||||
{
|
||||
$resultunit = mysql_fetch_object( $resultunitquery );
|
||||
|
||||
$jobstderr = parse_element( $resultunit -> stderr_out, "<stderr_txt>" );
|
||||
|
||||
if( $jobstderr )
|
||||
{
|
||||
row1( "Error output of this job" );
|
||||
row2( "", $jobstderr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultunit = mysql_fetch_object( mysql_query( "SELECT * FROM result WHERE id=".$workunit -> canonical_resultid ) );
|
||||
|
||||
$xmldoc = $resultunit -> xml_doc_out;
|
||||
$jobstderr = parse_element( $resultunit -> stderr_out, "<stderr_txt>" );
|
||||
|
||||
$nroffiles = 0;
|
||||
$cursor = 0;
|
||||
while( $tempfileinfo = parse_next_element( $xmldoc, "<file_info>", &$cursor ) )
|
||||
$outputfiles[ $nroffiles++ ] = parse_element( $tempfileinfo, "<name>" );
|
||||
|
||||
if( $nroffiles >= 1 )
|
||||
{
|
||||
$fanoutnr = parse_config( $config, "<uldl_dir_fanout>" );
|
||||
row1( "Output of this job" );
|
||||
row2( "Number of output files of job: ", $nroffiles );
|
||||
for( $index = 0; $index < $nroffiles; ++$index )
|
||||
{
|
||||
$filename = $outputfiles[ $index ];
|
||||
$url = "upload/".fan_out_dir( $filename, $fanoutnr )."/".$filename;
|
||||
$outputfilelink = '<a href="'.$url.'">'.$filename.'</a>';
|
||||
row2( "Output file ".($index+1).": ", $outputfilelink );
|
||||
}
|
||||
}
|
||||
|
||||
if( $jobstderr )
|
||||
{
|
||||
row1( "Error output of this job" );
|
||||
row2( "", $jobstderr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$max_jobs = max_nr_of_jobs_of_user( $user );
|
||||
$njobs = nr_of_jobs_of_user( $user );
|
||||
|
||||
row1( "Commands" );
|
||||
if( $njobs < $max_jobs )
|
||||
{
|
||||
if( $max_jobs - $njobs > 1 )
|
||||
$line = "You can submit ".($max_jobs-$njobs)." more jobs: ";
|
||||
else
|
||||
$line = "You can submit one more job: ";
|
||||
row2( $line, '<a href="queue_new_job_form.php">Submit a job</a>' );
|
||||
}
|
||||
row2( "", '<a href="queue_remove_job.php?workunitid='.$workunit -> id.'">Kill or Remove this job</a>' );
|
||||
row2( "", '<a href="queue_show_queue.php">Go back to your queue</a>' );
|
||||
row2( "", '<a href="logout.php">Log out</a>' );
|
||||
|
||||
end_table();
|
||||
|
||||
page_tail();
|
||||
?>
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
include_once( "../inc/db.inc" );
|
||||
include_once( "../inc/util.inc" );
|
||||
include_once( "../inc/prefs.inc" );
|
||||
include_once( "../inc/queue.inc" );
|
||||
|
||||
db_init();
|
||||
|
||||
$user = get_logged_in_user();
|
||||
$timestr = time_str(time(0));
|
||||
$title = "Personal job list of ".$user -> name." at ".$timestr;
|
||||
|
||||
page_head( $title );
|
||||
|
||||
$alljobs = all_jobs_of_user( $user );
|
||||
$njobs = mysql_num_rows( $alljobs );
|
||||
|
||||
start_table();
|
||||
|
||||
if( $njobs )
|
||||
{
|
||||
if( $njobs > 1 )
|
||||
row1( "You have ".$njobs." jobs listed !<br>" );
|
||||
else
|
||||
row1( "You have ".$njobs." job listed !<br>" );
|
||||
|
||||
end_table();
|
||||
start_table();
|
||||
|
||||
row5( "<b>Job #</b>", "<b>Job submit time</b>", "<b>Job status</b>", "<b>Job name</b>", "<b>Job ID</b>" );
|
||||
|
||||
for( $jobindex = 0; $jobindex < $njobs; ++$jobindex )
|
||||
{
|
||||
$job = mysql_fetch_object( $alljobs );
|
||||
|
||||
$workunitquery = mysql_query( "SELECT * FROM workunit WHERE id=".$job -> workunit );
|
||||
if( $workunitquery )
|
||||
{
|
||||
$workunit = mysql_fetch_object( $workunitquery );
|
||||
|
||||
if( $workunit )
|
||||
{
|
||||
$prefix = '<a href="queue_show_job.php?workunitid='.$job -> workunit.'">';
|
||||
$workunitname = $prefix.workunit_name( $workunit ).'</a>';
|
||||
$status = workunit_status_string( $workunit );
|
||||
if( $status == "running" ) $status = "<font color='green'><b>".$status."</b></font>";
|
||||
if( $status == "queued" ) $status = "<font color='blue'><b>".$status."</b></font>";
|
||||
if( $status == "ERROR" ) $status = "<font color='red'><b>".$status."</b></font>";
|
||||
$jobsubmittime = time_str( $workunit -> create_time );
|
||||
}
|
||||
else
|
||||
{
|
||||
$workunitname = "<font color='red'>WORKUNIT NOT FOUND IN DATABASE</font>";
|
||||
$status = "<font color='red'>UNKNOWN</font>";
|
||||
$jobsubmittime = "<font color='red'>UNKNOWN</font>";
|
||||
}
|
||||
|
||||
mysql_free_result( $workunitquery );
|
||||
}
|
||||
|
||||
$workunitstring = "<a href=workunit.php?wuid=".$job -> workunit.">".$job -> workunit."</a>";
|
||||
row5( $jobindex+1, $jobsubmittime, $status, $workunitname, $workunitstring );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
row1("You have NO jobs listed !<br>");
|
||||
|
||||
end_table();
|
||||
|
||||
$max_jobs = max_nr_of_jobs_of_user( $user );
|
||||
|
||||
if( $max_jobs > $njobs )
|
||||
{
|
||||
if( $max_jobs - $njobs > 1 )
|
||||
$line = 'You can submit '.( $max_jobs - $njobs ).' more jobs: ';
|
||||
else
|
||||
$line = 'You can submit one more job: ';
|
||||
|
||||
start_table();
|
||||
row1( "Commands" );
|
||||
row2( $line, '<a href="queue_new_job_form.php">Submit a job</a>' );
|
||||
row2( "", '<a href="home.php">Your account</a>' );
|
||||
row2( "", '<a href="hosts_user.php">Your computers</a>' );
|
||||
row2( "", '<a href="logout.php">Log out</a>' );
|
||||
end_table();
|
||||
}
|
||||
else
|
||||
exit_with_text( "You cannot submit any more jobs, you have reached your limit, clean up first !" );
|
||||
|
||||
page_tail();
|
||||
?>
|
Loading…
Reference in New Issue