[Bio] / FigWebServices / local_sim_compute.cgi Repository:
ViewVC logotype

View of /FigWebServices/local_sim_compute.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (annotate)
Fri Jan 13 17:36:56 2006 UTC (14 years, 4 months ago) by olson
Branch: MAIN
Changes since 1.1: +6 -1 lines
add more stuff.

#
# CGI that display the status of any local sim computations, including information about the 
# queue of pegs awaiting computation, queued computations, and any running computations.
#
# It might also include information about the current size of the set of dynamic sims.
#

use FIG;
use FIG_Config;
use FIG_CGI;
use HTML;

my $html = [];

my $sim_q = "$FIG_Config::global/queued_similarities";

my($fig, $cgi, $user) = FIG_CGI::init(debug_save => 0,
				      debug_load => 0,
				      print_params => 0);

push @$html,
    $cgi->title("Similarity queue manager"),
    $cgi->h1("Similarity queue manager"),
    ;


#
# Gather information.
#

my $sim_q_size = -s $sim_q;
my $sim_q_count;

if ($sim_q_size and $sim_q_size < 100000)
{
    $sim_q_count = 0;
    open(S, "<$sim_q");
    while (<S>)
    {
	$sim_queue_count++;
    }
    close(S);
}

push @$html, "Similarity queue: $sim_q_size bytes ";
push @$html, "$sim_queue_count pegs" if $sim_queue_count;
push @$html, $cgi->p, "\n";

my $db = $fig->db_handle();

if ($db->table_exists("sim_queue"))
{
    my $res = $db->SQL("select qid, finished, count(chunk_id), sum(len) from sim_queue group by qid, finished order by qid, finished");

    if (@$res > 0)
    {
	push @$html, HTML::make_table(["Queue ID", "Is finished", "Number of chunks", "Size in bytes"],
				      $res);
    }
}

HTML::show_page($cgi, $html);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3