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

Annotation of /FigWebServices/local_sim_compute.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (view) (download)

1 : olson 1.1 #
2 :     # CGI that display the status of any local sim computations, including information about the
3 :     # queue of pegs awaiting computation, queued computations, and any running computations.
4 :     #
5 :     # It might also include information about the current size of the set of dynamic sims.
6 :     #
7 :    
8 :     use FIG;
9 :     use FIG_Config;
10 :     use FIG_CGI;
11 :     use HTML;
12 :    
13 :     my $html = [];
14 :    
15 :     my $sim_q = "$FIG_Config::global/queued_similarities";
16 :    
17 :     my($fig, $cgi, $user) = FIG_CGI::init(debug_save => 0,
18 :     debug_load => 0,
19 :     print_params => 0);
20 :    
21 :     push @$html,
22 :     $cgi->title("Similarity queue manager"),
23 :     $cgi->h1("Similarity queue manager"),
24 :     ;
25 :    
26 :    
27 :     #
28 : olson 1.3 # Actions.
29 :     #
30 :    
31 :     if ($cgi->param('start'))
32 :     {
33 :     start_computation();
34 :     }
35 :    
36 :    
37 :     #
38 : olson 1.1 # Gather information.
39 :     #
40 :    
41 : olson 1.3 push @$html, $cgi->start_form(-name => 'control_form');
42 :    
43 :    
44 : olson 1.1 my $sim_q_size = -s $sim_q;
45 :     my $sim_q_count;
46 :    
47 :     if ($sim_q_size and $sim_q_size < 100000)
48 :     {
49 :     $sim_q_count = 0;
50 :     open(S, "<$sim_q");
51 :     while (<S>)
52 :     {
53 :     $sim_queue_count++;
54 :     }
55 :     close(S);
56 :     }
57 :    
58 :     push @$html, "Similarity queue: $sim_q_size bytes ";
59 :     push @$html, "$sim_queue_count pegs" if $sim_queue_count;
60 :     push @$html, $cgi->p, "\n";
61 :    
62 :     my $db = $fig->db_handle();
63 :    
64 :     if ($db->table_exists("sim_queue"))
65 :     {
66 :     my $res = $db->SQL("select qid, finished, count(chunk_id), sum(len) from sim_queue group by qid, finished order by qid, finished");
67 : olson 1.2
68 :     if (@$res > 0)
69 :     {
70 :     push @$html, HTML::make_table(["Queue ID", "Is finished", "Number of chunks", "Size in bytes"],
71 :     $res);
72 :     }
73 : olson 1.1 }
74 :    
75 : olson 1.3 #
76 :     # Controls.
77 :     #
78 :    
79 :     if ($sim_q_size)
80 :     {
81 :     push @$html, $cgi->submit(-value => "Start sim computation",
82 :     -name => "start");
83 :     }
84 :    
85 : olson 1.1 HTML::show_page($cgi, $html);
86 : olson 1.3
87 :     #
88 :     # Start up the queued sims. This means creating a sim askfor pool.
89 :     #
90 :     sub start_computation
91 :     {
92 :     my $pool_id = $fig->create_sim_askfor_pool();
93 :    
94 :     push(@$html, "Created new sim pool $pool_id<p>\n");
95 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3