1 use CatalystX
::GlobalContext
qw( $c );
8 use CXGN::Scrap::AjaxPage;
10 use CXGN::Tools::List qw/str_in/;
12 use CXGN::ITAG::Pipeline;
14 our $itag_feature = $c->enabled_feature('itag')
15 or do { print "\n\nITAG feature not enabled.\n"; exit };
18 $ENV{CXGNITAGPIPELINEANALYSISTESTING} = 1 unless $c->get_conf('production_server');
20 my $page = CXGN::Scrap::AjaxPage->new("text/plain");
21 $page->send_http_header;
23 my ( $op ) = $page->get_encoded_arguments('op');
24 $op or die "must specify an operation when calling status web service\n";
27 my %ops = ( astat => sub { analysis_status($page) },
28 lbs => sub { my ($p,$b) = get_pipe_and_batch($page); $b->seqlist},
29 lb => sub { get_pipe($page)->list_batches },
30 la => sub { get_pipe($page)->list_analyses },
31 lp => sub { map {sprintf("%03d",$_)} $itag_feature->list_pipelines },
34 $ops{$op} or die "unknown operation. valid operations are: ".join(',',sort keys %ops)."\n";
36 print map "$_\n",$ops{$op}->(); #call the operation and print its results
39 print "\n\nERROR: $EVAL_ERROR\nWeb service documentation can be found at: http://www.ab.wur.nl/TomatoWiki/PipelineStatusWebService\n";
45 ############ OPERATION SUBS ##############################
49 my ($pipe,$batch) = get_pipe_and_batch($page);
50 my ($atag) = $page->get_encoded_arguments('atag');
51 my $a = $pipe->analysis($atag)
52 or die "no analysis found with that tag name\n";
53 return $a->status($batch);
56 ######### UTIL SUBS ######################################
58 sub get_pipe_and_batch {
60 my $pipe = get_pipe($page);
61 my ($bnum) = $page->get_encoded_arguments('batch');
63 my $batch = $pipe->batch($bnum)
64 or die "batch number $bnum does not exist";
65 return ($pipe,$batch);
70 my ( $ver ) = $page->get_encoded_arguments('pipe');
71 my @args = defined $ver ? (version => $ver+0) : ();
72 my $pipe = $itag_feature->pipeline( @args )
73 or die 'pipeline version $ver not found';