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

Annotation of /FigWebServices/cluster_service.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download)

1 : olson 1.4 #
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 use strict;
19 :     use Data::Dumper;
20 :     use SOAP::Lite;
21 :    
22 :     use Cluster;
23 :     use FIG;
24 :     use P2P;
25 :    
26 :     use SOAP::Transport::HTTP;
27 :    
28 :    
29 :    
30 :     my $ns = $Cluster::Broker::ns;
31 :    
32 :     my $fig= new FIG;
33 :    
34 :     #
35 :     # Hand-construct the service object, since I don't want the
36 :     # constructor being exported via SOAP.
37 :     #
38 :     my $broker = new Cluster::Broker($fig);
39 :     my $service = {
40 :     fig => $fig,
41 :     broker => $broker
42 :     };
43 :     bless $service, 'ClusterService';
44 :    
45 :     #
46 :     # Dynamically create wrappers for the methods.
47 :     #
48 :    
49 :     my %methods = (register_worker => 6,
50 :     register_cluster => 2,
51 : olson 1.2 get_work => 1,
52 :     work_done => 4,
53 : olson 1.3 work_failed => 4,
54 : olson 1.2 get_upload_handles => 4,
55 : olson 1.3 worker_alive => 1,
56 : olson 1.2 );
57 : olson 1.1
58 :     {
59 :     no strict 'refs';
60 :     while (my($method_name, $arg_count) = each(%methods))
61 :     {
62 :     my $full_name = "ClusterService::$method_name";
63 :    
64 :     *$full_name = sub {
65 :     my($self, @args) = @_;
66 :     @args == $arg_count or die "Incorrect number of arguments to $method_name";
67 :     return $self->{broker}->$method_name(@args);
68 :     }
69 :     }
70 :     }
71 :    
72 :     if ($ENV{REQUEST_URI})
73 :     {
74 :     #
75 :     # CGI.
76 :     #
77 :    
78 :     my $serv = new SOAP::Transport::HTTP::CGI;
79 :     $serv->dispatch_with({ $ns => $service });
80 :     $serv->handle();
81 :     }
82 :     else
83 :     {
84 :     #
85 :     # Standalone.
86 :     #
87 :    
88 :     print "Starting standalone daemon\n";
89 : olson 1.2 my $daemon = SOAP::Transport::HTTP::Daemon->new(LocalPort => 10001,
90 :     ReuseAddr => 1);
91 : olson 1.1 $daemon-> dispatch_with({ $ns => $service });
92 :     $daemon->handle();
93 :     }
94 :    
95 :     # package ClusterService;
96 :    
97 :     # sub register_worker
98 :     # {
99 :     # my($self, $host, $user, $pid, $exe, $cluster_id, $work_types) = @_;
100 :    
101 :     # return $self->{broker}->register_worker($host, $user, $pid, $exe, $cluster_id, $work_types);
102 :     # }
103 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3