$pvers = $row['parent_vers'];
        $exptidx = $row['exptidx'];
        $desc = $row['description'];
        $started = $row['start_time'];
        $stopped = $row['stop_time'];
        $onmouseover = MakeMouseOver($desc);
        if (strlen($desc) > 30) {
            $desc = substr($desc, 0, 30) . " <b>... </b>";
        }
        $template_link = MakeLink("template", "guid={$guid}&version={$pvers}", "{$pvers}");
        $instance_link = MakeLink("instance", "instance={$exptidx}", "{$exptidx}");
        echo "<tr>" . "<td>{$instance_link}</td>" . "<td>{$template_link}</td>" . "<td>{$started}</td>" . "<td>{$stopped}</td>" . "<td {$onmouseover}>{$desc}</td>";
    }
    echo "</table>\n";
} else {
    AddSortedTable("mytable");
    echo "<table align=center id='mytable'\n\t\t border=1 cellpadding=5 cellspacing=2>\n";
    echo "<thead class='sort'>\n";
    echo "<tr>\n            <th>Run</th>\n            <th>Instance</th>\n            <th>Template</th>\n            <th>ID</th>\n            <th>Started</th>\n            <th>Stopped</th>\n            <th>Description</th>\n          </tr>\n";
    echo "</thead>\n";
    while ($row = mysql_fetch_array($query_result)) {
        $pvers = $row['parent_vers'];
        $runidx = $row['runidx'];
        $runid = $row['runid'];
        $exptidx = $row['exptidx'];
        $desc = $row['description'];
        $started = $row['start_time'];
        $stopped = $row['stop_time'];
        $onmouseover = MakeMouseOver($desc);
        if (strlen($desc) > 30) {
            $desc = substr($desc, 0, 30) . " <b>... </b>";
Esempio n. 2
0
        echo "<td><a href='{$url}'>{$node_id}</a></td>\n";
    } else {
        echo "<td>{$node_id}</td>\n";
    }
    echo "<td><a href='shownodetype.php3?node_type={$type}'>{$type}</a></td>\n";
    echo "<td>{$rsrvtime}</td>\n";
    $url = CreateURL("showosinfo", URLARG_OSID, $osid);
    echo "<td><a href='{$url}'>{$osname}</a></td>\n";
    echo "<td>{$vcount}</td>\n";
    echo "<td>{$status}</td>\n";
    echo "<td>{$loadavg1}/{$loadavg5}</td>\n";
    echo "</tr>\n";
}
echo "</table>\n";
# Sort initialized later when page fully loaded.
AddSortedTable('pooltable');
#
#
#
if ($isadmin) {
    $table = array('#id' => "Containers", '#title' => "Containers", '#sortable' => 1, '#headings' => array("node_id" => "node_id", "PID" => "PID", "EID" => "EID", "Status" => "Status"));
    $rows = array();
    foreach ($nodes as $node_id) {
        $node = Node::Lookup($node_id);
        if (!$node) {
            continue;
        }
        $status = $node->RealNodeStatus();
        $experiment = $node->Reservation();
        $pid = $experiment->pid();
        $eid = $experiment->eid();
function ShowExperimentList_internal($templates_only, $type, $this_user, $object, $tabledefs = null)
{
    global $TB_EXPTSTATE_SWAPPED, $TB_EXPTSTATE_SWAPPING;
    $from_idx = $this_user->uid_idx();
    $nopid = 0;
    $parens = 0;
    $id = "explist";
    $class = "explist";
    $wanthtml = 0;
    $notitle = FALSE;
    $html = null;
    if ($tabledefs) {
        $id = isset($tabledefs['#id']) ? $tabledefs['#id'] : $id;
        $class = isset($tabledefs['#class']) ? $tabledefs['#class'] : $class;
        $wanthtml = isset($tabledefs['#html']) ? $tabledefs['#html'] : $html;
        $notitle = isset($tabledefs['#notitle']) ? $tabledefs['#notitle'] : $notitle;
    }
    if ($type == "USER") {
        $uid = $object->uid();
        $where = "expt_head_uid='{$uid}'";
        $title = "Current";
    } elseif ($type == "PROJ") {
        $pid = $object->pid();
        $where = "e.pid='{$pid}'";
        $title = "Project";
        $nopid = 1;
    } elseif ($type == "GROUP") {
        $pid = $object->pid();
        $gid = $object->gid();
        $where = "e.pid='{$pid}' and e.gid='{$gid}'";
        $title = "Group";
        $nopid = 1;
    } else {
        TBERROR("ShowExperimentList: Invalid arguments", 1);
    }
    $template_clause = "";
    if ($templates_only) {
        $template_clause = " and i.idx is not null ";
    }
    if (ISADMIN()) {
        $query_result = DBQueryFatal("select e.*,count(r.node_id) as nodes, " . "round(e.minimum_nodes+.1,0) as min_nodes " . "from experiments as e " . "left join experiment_templates as t on " . "     t.pid=e.pid and t.eid=e.eid " . "left join experiment_template_instances as i on " . "     i.exptidx=e.idx " . "left join reserved as r on e.pid=r.pid and " . "     e.eid=r.eid " . "where ({$where}) and t.guid is null {$template_clause} " . "group by e.pid,e.eid order by e.state,e.eid");
    } else {
        $query_result = DBQueryFatal("select e.*,count(r.node_id) as nodes, " . "round(e.minimum_nodes+.1,0) as min_nodes " . "from experiments as e " . "left join experiment_templates as t on " . "     t.pid=e.pid and t.eid=e.eid " . "left join experiment_template_instances as i on " . "     i.exptidx=e.idx " . "left join reserved as r on e.pid=r.pid and " . "     e.eid=r.eid " . "left join group_membership as g on g.pid=e.pid and " . "     g.gid=e.gid and g.uid_idx='{$from_idx}' " . "where g.uid is not null and ({$where}) " . "      and t.guid is null {$template_clause} " . "group by e.pid,e.eid order by e.state,e.eid");
    }
    if (mysql_num_rows($query_result)) {
        if ($wanthtml) {
            ob_start();
        }
        echo "<center>\n               <h3>{$title} " . ($templates_only ? "Template Instances" : "Experiments") . "</h3>\n              </center>\n              <table align=center border=1 class={$class} id={$id}>\n";
        if ($nopid) {
            $pidrow = "";
        } else {
            $pidrow = "\n<th>PID</th>";
        }
        echo "<thead class='sort'>";
        echo "<tr>{$pidrow}\n              <th class='sorttable_alpha'>EID</th>\n              <th>State</th>\n              <th align=center>Nodes [1]</th>\n              <th align=center>Hours Idle [2]</th>\n              <th class='sorttable_alpha'>Description</th>\n          </tr></thead>\n";
        $idlemark = "<b>*</b>";
        $stalemark = "<b>?</b>";
        while ($row = mysql_fetch_array($query_result)) {
            $pid = $row["pid"];
            $eid = $row["eid"];
            $state = $row["state"];
            $nodes = $row["nodes"];
            $minnodes = $row["min_nodes"];
            $ignore = $row["idle_ignore"];
            $name = $row["expt_name"];
            if (!($experiment = Experiment::LookupByPidEid($pid, $eid))) {
                TBERROR("Could not map {$pid}/{$eid} to its object", 1);
            }
            $idlehours = $experiment->IdleTime();
            $stale = $experiment->IdleStale();
            if ($nodes == 0) {
                $nodes = "<font color=green>{$minnodes}</font>";
            } elseif ($row["swap_requests"] > 0) {
                $nodes .= $idlemark;
            }
            if ($nopid) {
                $pidrow = "";
            } else {
                $pidrow = "\n<td>" . "<a href='showproject.php3?pid={$pid}'>{$pid}</a></td>";
            }
            $idlestr = $idlehours;
            $skey = 0;
            if ($idlehours > 0) {
                $skey = $idlehours;
                if ($stale) {
                    $idlestr .= $stalemark;
                }
                if ($ignore) {
                    $idlestr = "({$idlestr})";
                    $parens = 1;
                }
            } elseif ($idlehours == -1) {
                $idlestr = "&nbsp;";
            }
            echo "<tr>{$pidrow}\n                 <td><a href='showexp.php3?pid={$pid}&eid={$eid}'>{$eid}</a></td>\n\t\t <td>{$state}</td>\n                 <td align=center>{$nodes}</td>\n                 <td align=center sorttable_customkey='{$skey}'>{$idlestr}</td>\n                 <td>{$name}</td>\n             </tr>\n";
        }
        echo "</table>\n";
        echo "<table align=center cellpadding=0 class=stealth><tr>\n" . "<td class=stealth align=left><font size=-1><ol>\n" . "<li>Node counts in <font color=green><b>green</b></font>\n" . "show a rough estimate of the minimum number of \n" . "nodes required to swap in.\n" . "They account for delay nodes, but not for node types, etc.\n" . "<li>A {$stalemark} indicates that the data is stale, and " . "at least one node in the experiment has not reported " . "on its proper schedule.\n";
        if ($parens) {
            # do not show this unless we did it... most users should not ever
            # need to know that some expts have their idleness ignored
            echo "Values are in parenthesis for idle-ignore experiments.\n";
        }
        echo "</ol></font></td></tr></table>\n";
        # Sort initialized later when page fully loaded.
        AddSortedTable($id);
        if ($wanthtml) {
            $html = ob_get_contents();
            ob_end_clean();
        }
    }
    return $html;
}
Esempio n. 4
0
 function ShowRun($runidx)
 {
     $runidx = addslashes($runidx);
     $exptidx = $this->exptidx();
     $guid = $this->guid();
     $vers = $this->vers();
     $template = $this->template();
     $query_result = DBQueryFatal("select r.* from experiment_runs as r " . "left join experiment_template_instances as i on " . "     i.exptidx=r.exptidx " . "where r.exptidx='{$exptidx}' and r.idx='{$runidx}'");
     if (!mysql_num_rows($query_result)) {
         return;
     }
     $row = mysql_fetch_array($query_result);
     $start = $row['start_time'];
     $stop = $row['stop_time'];
     $runid = $row['runid'];
     $start_tag = $row['starting_archive_tag'];
     $end_tag = $row['ending_archive_tag'];
     $description = $row['description'];
     $hidden = $row['hidden'];
     # Run descriptions are metatdata that can be changed.
     # But use a naming convention.
     $desc_metaname = "__run_description_{$exptidx}_{$runidx}";
     $desc_metadata = $template->LookupMetadataByName($desc_metaname);
     if (!isset($stop)) {
         $stop = "&nbsp";
     }
     SUBPAGESTART();
     SUBMENUSTART("Run Options");
     WRITESUBMENUBUTTON("Export Record", CreateURL("template_export", $this, "runidx", $runidx));
     WRITESUBMENUBUTTON("Revise Record", CreateURL("record_revise", $this, "runidx", $runidx));
     if ($hidden) {
         WRITESUBMENUBUTTON("UnHide Record", CreateURL("toggle", $this, "runidx", $runidx, "type", "hiderun", "value", 0));
     } else {
         WRITESUBMENUBUTTON("Hide Record", CreateURL("toggle", $this, "runidx", $runidx, "type", "hiderun", "value", 1));
     }
     if (isset($end_tag) && $end_tag != "") {
         WRITESUBMENUBUTTON("View Archive", CreateURL("archive_view", $this, "tag", $end_tag));
     }
     SUBMENUEND();
     echo "<center>\n";
     echo "<table border=0 bgcolor=#000 color=#000 class=stealth " . " cellpadding=0 cellspacing=0>\n";
     echo "<tr valign=top>";
     echo "<td class=stealth align=center>\n";
     echo "<center>\n               <h3>Run Details</h3>\n             </center>\n";
     echo "<table align=center cellpadding=2 cellspacing=2 border=1>\n";
     ShowItem("Template", MakeLink("template", "guid={$guid}&version={$vers}", "{$guid}/{$vers}"));
     ShowItem("Instance", MakeLink("instance", "instance={$exptidx}", "{$exptidx}"));
     ShowItem("ID", $runidx);
     if ($hidden) {
         ShowItem("Hidden", "<font color=red>Yes</font>");
     }
     if ($description && $description != "") {
         $onmouseover = MakeMouseOver($description);
         if (strlen($description) > 40) {
             $description = substr($description, 0, 40) . " <b>... </b>";
         }
     } else {
         $onmouseover = "";
         $description = "Click to Add";
     }
     # If no metadata, assume its for an instance prior to modifiable
     # instance descriptions.
     if ($desc_metadata) {
         $desc_anchor = MakeAnchor(CreateURL("template_metadata", $template, $desc_metadata) . "&action=modify", $description, $onmouseover);
     } else {
         $desc_anchor = MakeAnchor(CreateURL("template_metadata", $template) . "&action=add" . "&metadata_type=run_description" . "&formfields[name]={$desc_metaname}", $description, $onmouseover);
     }
     ShowItem("Description", $desc_anchor);
     ShowItem("Started", $start);
     ShowItem("Stopped", $stop);
     ShowItem("Start Tag", $start_tag);
     ShowItem("End Tag", $end_tag);
     echo "</table>\n";
     echo "</td>\n";
     $query_result = DBQueryFatal("select * from experiment_run_bindings " . "where exptidx='{$exptidx}' and runidx='{$runidx}'");
     if (mysql_num_rows($query_result)) {
         $id = "{$exptidx}_{$runidx}_bindings";
         echo "<td align=center class=stealth> &nbsp &nbsp &nbsp </td>\n";
         echo "<td align=center class=stealth>\n";
         AddSortedTable($id);
         echo "<center>\n                   <h3>Run Bindings</h3>\n                  </center> \n                  <table id='{$id}'\n                         align=center border=1 cellpadding=5 cellspacing=2>\n";
         echo "<thead class='sort'>\n";
         echo "<tr>\n                    <th>Name</th>\n                    <th>Value</th>\n                  </tr>\n";
         echo "</thead>\n";
         while ($row = mysql_fetch_array($query_result)) {
             $name = $row['name'];
             $value = $row['value'];
             if (!isset($value)) {
                 $value = "&nbsp";
             }
             echo "<tr>\n                       <td>{$name}</td>\n                       <td>{$value}</td>\n                      </tr>\n";
         }
         echo "</table>\n";
         echo "</td>\n";
     }
     echo "</tr>\n";
     echo "</table>\n";
     $this->ShowRunAnnotation($runidx);
     echo "</center>\n";
     SUBPAGEEND();
 }