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

View of /FigKernelPackages/ClusterWorker.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Sun Feb 27 04:24:21 2005 UTC (15 years, 3 months ago) by olson
Branch: MAIN
CVS Tags: merge-trunktag-bobdev_news-2, Root-bobdev_news, merge-bobdev_news-1, caBIG-dataload-0, merge-trunktag-bobdev_news-1, merge-bodev_news-3, caBIG-00-00-00, merge-bobdev_news-2, merge-trunktag-bodev_news-3
Branch point for: Branch-bobdev_news
Split the Cluster::Worker package out to its own file so it can be used
on hosts that don't have a full SEED installed.

package Cluster::Worker;

use strict;
use SOAP::Lite;
use Cluster;
use Data::Dumper;
use Time::HiRes 'time';

my $ns = $Cluster::Broker::ns;

=head1 Cluster::Worker

Worker-side interface to the cluster work broker.

=cut

BEGIN {
    #
    # Dynamically create the methods here.
    #

    my $start = time;
    my %methods = (register_worker => 6,
		   register_cluster => 2,
		   get_work => 1,
		   work_done => 4,
		   work_failed => 4,
		   get_upload_handles => 4,
		   worker_alive => 1,
		  );
    
    no strict 'refs';
    while (my($method_name, $arg_count) = each(%methods))
    {
	*$method_name = sub {
	    my($self, @args) = @_;
	    @args == $arg_count or die "Incorrect number of arguments to $method_name";

	    my $response = $self->{proxy}->call($method_name, @args);

	    if ($response->fault)
	    {
		die $response->faultstring;
	    }
	    else
	    {
		return $response->result;
	    }
	}
    }
    my $end = time;
    my $elap = ($end - $start) * 1000;
}


sub new
{
    my($class, $url) = @_;

    my $proxy = SOAP::Lite->uri($ns)->proxy($url, timeout => 3600);

    my $self = {
	proxy => $proxy,
    };
    return bless $self, $class;
}

1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3