[Bio] / FigKernelScripts / run_peg_job_worker.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/run_peg_job_worker.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download) (as text)

1 : olson 1.1 #
2 : olson 1.4 # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 :     #
19 : olson 1.1 # Worker process.
20 :     #
21 :     # Pulls pegs from the table, works on them with the given script, writes results back.
22 :     #
23 :     # usage: run_peg_job_worker tablename
24 :     #
25 :    
26 :     use FIG;
27 :     use strict;
28 : olson 1.2 use Cluster;
29 : olson 1.1
30 :     my($table) = @ARGV;
31 :    
32 :     if ($table eq "")
33 :     {
34 :     die "Usage: $0 tablename\n";
35 :     }
36 :    
37 :     my $fig = new FIG;
38 : olson 1.2 my $jobmgr = new Cluster::DBJobMgr($fig, $table);
39 : olson 1.1
40 :     my $what = 0;
41 :     my $worker = `hostname`;
42 :     chomp($worker);
43 :     $worker .= ":$$";
44 :    
45 :     while (1)
46 :     {
47 : olson 1.2 my $work = $jobmgr->get_work($worker);
48 : olson 1.3
49 :     if (!$work)
50 :     {
51 :     print "Work done\n";
52 :     last;
53 :     }
54 :     my($id, $input) = @$work;
55 :     print "Got work id=$id\n";
56 :     print $input;
57 : olson 1.1 my $output = "finished $work $what\n";
58 :     $what++;
59 : olson 1.2 $jobmgr->work_done($work, $output);
60 : olson 1.1 }
61 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3