[Bio] / FigKernelPackages / ClusterWorker.pm Repository:
ViewVC logotype

Annotation of /FigKernelPackages/ClusterWorker.pm

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.2 #
2 :     # 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 : olson 1.1 package Cluster::Worker;
19 :    
20 :     use strict;
21 :     use SOAP::Lite;
22 :     use Cluster;
23 :     use Data::Dumper;
24 :     use Time::HiRes 'time';
25 :    
26 :     my $ns = $Cluster::Broker::ns;
27 :    
28 :     =head1 Cluster::Worker
29 :    
30 :     Worker-side interface to the cluster work broker.
31 :    
32 :     =cut
33 :    
34 :     BEGIN {
35 :     #
36 :     # Dynamically create the methods here.
37 :     #
38 :    
39 :     my $start = time;
40 :     my %methods = (register_worker => 6,
41 :     register_cluster => 2,
42 :     get_work => 1,
43 :     work_done => 4,
44 :     work_failed => 4,
45 :     get_upload_handles => 4,
46 :     worker_alive => 1,
47 :     );
48 :    
49 :     no strict 'refs';
50 :     while (my($method_name, $arg_count) = each(%methods))
51 :     {
52 :     *$method_name = sub {
53 :     my($self, @args) = @_;
54 :     @args == $arg_count or die "Incorrect number of arguments to $method_name";
55 :    
56 :     my $response = $self->{proxy}->call($method_name, @args);
57 :    
58 :     if ($response->fault)
59 :     {
60 :     die $response->faultstring;
61 :     }
62 :     else
63 :     {
64 :     return $response->result;
65 :     }
66 :     }
67 :     }
68 :     my $end = time;
69 :     my $elap = ($end - $start) * 1000;
70 :     }
71 :    
72 :    
73 :     sub new
74 :     {
75 :     my($class, $url) = @_;
76 :    
77 :     my $proxy = SOAP::Lite->uri($ns)->proxy($url, timeout => 3600);
78 :    
79 :     my $self = {
80 :     proxy => $proxy,
81 :     };
82 :     return bless $self, $class;
83 :     }
84 :    
85 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3