예제 #1
0
$event_id = $query_string['event_id'];
$region_id = $query_string['region_id'];
$sample_id = $query_string['sample_id'];
$experiment_id = $query_string['experiment_id'];
$show_errors = $query_string['show_errors'];
$start_time = $query_string['start_time'];
$limit = $query_string['limit'];
if ($_POST['jump_to_time'] != '') {
    $query = "SELECT  UNIX_TIMESTAMP('" . $_POST['jump_year'] . "-" . $_POST['jump_month'] . "-" . $_POST['jump_day'] . " 23:59:59Ab')";
    $sql->get_row($query, $res);
    $start_time = $res[0][0];
    header("Location: view_hosts_log.php?host_id={$host_id}&start_time=" . $start_time . "&limit=" . $limit . "\n\n");
    die("");
}
if ($start_time == 0) {
    $start_time = ns_current_time();
}
ns_expand_unix_timestamp($start_time, $cur_min, $cur_hour, $cur_day, $cur_month, $cur_year);
if ($query_string['delete_before'] != '' && $query_string['delete_before'] != 0) {
    $query = "DELETE FROM host_event_log WHERE host_id='{$host_id}' AND time <= " . $query_string['delete_before'];
    $sql->send_query($query);
}
$samples = array();
if ($experiment_id != '') {
    $query = "SELECT id FROM capture_samples WHERE experiment_id = {$experiment_id}";
    $sql->get_row($query, $res);
    for ($i = 0; $i < sizeof($res); $i++) {
        array_push($samples, $res[$i][0]);
    }
}
if ($sample_id != '' && $sample_id != "all") {
<input name="device_name" type="hidden" value="all">
</form>
<form action="view_hosts_and_devices.php" method="post">
<table bgcolor="#555555" cellspacing='0' cellpadding='1'><tr><td>
<table cellspacing='0' cellpadding='3' >
<tr <?php 
echo $table_header_color;
?>
><td>Host Name</td>
<td>Version</td>
<td>IP Address</td>
<td>Last Ping</td>
<td>Comments</td>
<td>&nbsp;</td></tr>
<?php 
$cur_time = ns_current_time();
$k = 0;
foreach ($base_hosts as $base_host_name => $host) {
    for ($i = 0; $i < sizeof($host); $i++) {
        $clrs = $table_colors[$k % 2];
        $edit_host = $host_id == $host[$i][0];
        echo "<tr><td bgcolor=\"{$clrs['0']}\">";
        $current = $cur_time - $host[$i][3] < $current_device_cutoff;
        if ($current) {
            echo "<b>";
        }
        if ($highlight_host_id == $host[$i][0]) {
            echo "<i>";
        }
        echo $host[$i][1];
        if ($host[$i][10] == "1") {
예제 #3
0
         $query .= 'problem=0';
     } else {
         if ($sample_action == 'clear_busy') {
             $query .= 'currently_being_processed=0';
         } else {
             throw new ns_exception("Unknown sample action: {$sample_action}");
         }
     }
     $query .= " WHERE sample_id={$sample_id}";
     //die($query);
     $sql->send_query($query);
     $sample_id = 0;
     $refresh_page = TRUE;
 }
 if ($sample_id != 0 && $_POST['cancel_pending_scans'] != '') {
     $query = "DELETE FROM capture_schedule WHERE sample_id = {$sample_id} AND time_at_start='0' AND missed='0' AND time_at_start='0' AND scheduled_time > " . ns_current_time();
     $sql->send_query($query);
     header("Location: manage_samples.php?experiment_id={$experiment_id}&{$region_job_query_string}#{$sample_id}\n\n");
     die("");
 }
 if ($sample_id != 0 && $_POST['censor_sample'] != '') {
     $query = "UPDATE capture_samples SET censored=1 WHERE id=" . $sample_id;
     $sql->send_query($query);
     header("Location: manage_samples.php?experiment_id={$experiment_id}&{$region_job_query_string}#{$sample_id}\n\n");
     die("");
 }
 if ($sample_id != 0 && $_POST['uncensor_sample'] != '') {
     $query = "UPDATE capture_samples SET censored=0 WHERE id=" . $sample_id;
     $sql->send_query($query);
     header("Location: manage_samples.php?experiment_id={$experiment_id}&{$region_job_query_string}#{$sample_id}\n\n");
     die("");
예제 #4
0
 if (!$live_dangerously) {
     throw new ns_exception("I can't let you do that Dave!  (Enable dangerous operations to continue)");
 }
 for ($i = 0; $i < sizeof($samples_to_process); $i++) {
     $query = "SELECT id FROM sample_region_image_info WHERE sample_id = " . $samples_to_process[$i];
     //echo $query . "<BR>";
     $sql->get_row($query, $sample_regions[$i]);
 }
 $sql->send_query($lock_jobs_query, TRUE);
 for ($i = 0; $i < sizeof($samples_to_process); $i++) {
     if ($delete_files_from_disk) {
         //make a processing job for the sample--this will allow us to delete all temprary data later on.
         $job = new ns_processing_job();
         $job->id = 0;
         $job->maintenance_task = $ns_maintenance_tasks['ns_maintenance_delete_files_from_disk_request'];
         $job->time_submited = ns_current_time();
         for ($d = 0; $d < sizeof($file_deletion_job->operations); $d++) {
             $job->operations[$d] = 0;
         }
         if ($delete_sample_images != '') {
             $job->sample_id = $samples_to_process[$i];
             $job->save_to_db($sql);
             //  ns_delete_sample_from_database($samples_to_process[$i],$sql);
         } else {
             if ($clear_region != '') {
                 for ($b = 0; $b < sizeof($sample_regions[$i]); $b++) {
                     $file_deletion_job = clone $job;
                     $file_deletion_job->region_id = $sample_regions[$i][$b][0];
                     $file_deletion_job->save_to_db($sql);
                     ns_delete_region_from_database($sample_regions[$i][$b][0], $sql);
                 }
<?php

class ns_stat
{
    public $mean, $var, $count;
}
require_once "worm_environment.php";
require_once "ns_processing_job.php";
display_worm_page_header("Cluster Throughput Statistics");
$query = "SELECT id, name, last_ping,software_version_major,software_version_minor,software_version_compile FROM hosts WHERE last_ping > " . ns_current_time() . " - 600 ORDER BY name";
$sql->get_row($query, $hosts);
$stats = array();
for ($i = 0; $i < sizeof($hosts); $i++) {
    $query = "SELECT operation,mean,variance,count FROM performance_statistics WHERE host_id = " . $hosts[$i][0] . " ORDER BY operation";
    $sql->get_row($query, $stats[$i]);
}
$host_stats = array();
$host_total_stats = array();
for ($i = 0; $i < sizeof($hosts); $i++) {
    $host_stats[$i] = array();
    for ($j = 0; $j < sizeof($stats[$i]); $j++) {
        $host_stats[$i][(int) $stats[$i][$j][0]] = new ns_stat();
        $host_stats[$i][(int) $stats[$i][$j][0]]->mean = $stats[$i][$j][1];
        $host_stats[$i][(int) $stats[$i][$j][0]]->var = $stats[$i][$j][2];
        $host_stats[$i][(int) $stats[$i][$j][0]]->count = $stats[$i][$j][3];
    }
}
//var_dump($host_stats[0]);
$operations_specified = array();
foreach ($stats as $s) {
    foreach ($s as $sa) {
    $device_index[$devices[$i][0]] = $i;
    $schedule_future[$i] = array();
    $schedule_past[$i] = array();
}
$number_past = @(int) $query_string['number_past'];
if (!isset($query_string['number_past'])) {
    $number_past = 5;
}
$number_future = @(int) $query_string['number_future'];
if (!isset($query_string['number_future'])) {
    $number_future = 5;
}
$query = "SELECT c.scheduled_time, c.time_at_start, c.time_at_finish, s.experiment_id, c.sample_id, s.name, c.problem, c.captured_image_id, s.device_name, c.missed,c.transferred_to_long_term_storage FROM capture_schedule as c, capture_samples as s WHERE c.sample_id = s.id";
$query .= " AND (c.time_at_start != 0 || c.censored=0)";
$query_future = $query . " AND c.scheduled_time >= " . ns_current_time() . " ORDER BY c.scheduled_time ASC LIMIT " . sizeof($devices) * $number_future;
$query_past = $query . " AND c.scheduled_time <= " . ns_current_time() . " ORDER BY c.scheduled_time DESC LIMIT " . sizeof($devices) * $number_past;
// echo $query_past . "<br>";
// flush();
//  ob_flush();
$sql->get_row($query_future, $fut);
$sql->get_row($query_past, $past);
foreach ($fut as &$f) {
    $schedule_future[$device_index[$f[8]]] = array();
}
foreach ($past as &$f) {
    $schedule_past[$device_index[$f[8]]] = array();
}
foreach ($fut as &$f) {
    array_push($schedule_future[$device_index[$f[8]]], $f);
}
foreach ($past as &$f) {
예제 #7
0
function ns_delete_images_from_database($experiment_id, $sample_id, $region_id, $image_id, $sql)
{
    global $ns_maintenance_tasks;
    global $ns_maintenance_flags;
    $job = new ns_processing_job();
    $job->maintenance_task = $ns_maintenance_tasks['ns_maintenance_delete_images_from_database'];
    $job->experiment_id = $experiment_id;
    $job->sample_id = $sample_id;
    $job->region_id = $region_id;
    $job->image_id = $image_id;
    $job->urgent = 2;
    $job->time_submitted = ns_current_time();
    if ($experiment_id == 0 && $sample_id == 0 && $region_id != 0 && $image_id == 0) {
        //	die("WHOOP!");
        $job->maintenance_flag = $ns_maintenance_flags['ns_delete_entire_sample_region'];
    }
    $job->save_to_db($sql);
    ns_update_job_queue($sql);
}
        }
        ?>
</font></center></td>
   <td bgcolor="<?php 
        echo $table_colors[$c][1];
        ?>
"><center><font size="-1">
<?php 
        if ($images[$i][7] == '1') {
            echo $images[$i][9] . 'x' . $images[$i][8];
        }
        ?>
</font></center></td>
     </tr>  
     <?php 
    }
    ?>
     </table>
	 </table>
 <?php 
    $offset = $stop_time - $start_time;
    $forward = $stop_time + $offset;
    echo "<a href=\"ns_view_sample_images.php?experiment_id=" . (int) $experiment_id . "&all_running_experiments=" . (int) $all_running_experiments . "&sample_id=" . (int) $sample_id . "&start_time=" . (int) ($start_time - $offset) . "&stop_time=" . (int) ($stop_time - $offset) . "\">[Earlier Time Points]</a>";
    echo "<a href=\"ns_view_sample_images.php?experiment_id=" . (int) $experiment_id . "&all_running_experiments=" . (int) $all_running_experiments . "&sample_id=" . (int) $sample_id . "&start_time=" . (int) (ns_current_time() - 365 * 24 * 60 * 60) . "&stop_time=\">[View All Time Points]</a>";
}
?>
	 
	 <?php 
display_worm_page_footer();
?>