X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fstemmaweb%2FController%2FStemweb.pm;h=6962879679faa91c33f56e40d1e8bc938fb23392;hb=8f6a090156b798530c69d925664637557ea7342f;hp=42126ece00d38315f6166cf1100ce8dfa90ad015;hpb=509e94bc8086be4f2e2029d6c707c7dc541a762a;p=scpubgit%2Fstemmaweb.git diff --git a/lib/stemmaweb/Controller/Stemweb.pm b/lib/stemmaweb/Controller/Stemweb.pm index 42126ec..6962879 100644 --- a/lib/stemmaweb/Controller/Stemweb.pm +++ b/lib/stemmaweb/Controller/Stemweb.pm @@ -25,11 +25,6 @@ has pars_path => ( isa => 'Str', ); -has pars_pk => ( - is => 'rw', - isa => 'Int', - ); - =head1 NAME stemmaweb::Controller::Stemweb - Client listener for Stemweb results @@ -111,13 +106,10 @@ sub available :Local :Args(0) { } # otherwise we have no available algorithms. ## Temporary HACK: run Pars too if( $self->_has_pars ) { - # Use the highest passed primary key + 1 - my $parspk = max( map { $_->{pk} } - grep { $_->{model} eq 'algorithms.algorithm' } @$parameters ) + 1; + # Use 100 as the special pars key # Add Pars as an algorithm - $self->pars_pk( $parspk ); push( @$parameters, { - pk => $parspk, + pk => 100, model => 'algorithms.algorithm', fields => { args => [], @@ -214,7 +206,8 @@ sub _process_stemweb_result { } $c->stash->{'result'} = { status => 'notfound' }; } - } elsif( $answer->{status} == 1 ) { + } elsif( $answer->{status} == 1 || $answer->{status} == -1 ) { + # 1 means running, -1 means waiting to run. Either way, 'not ready'. $c->stash->{'result'} = { 'status' => 'running' }; } else { # Failure. Clear the job ID so that the user can try again. @@ -251,7 +244,7 @@ sub request :Local :Args(0) { my $algorithm = delete $reqparams->{algorithm}; my $mergetypes = delete $reqparams->{merge_reltypes}; - if( $self->_has_pars && $algorithm == $self->pars_pk ) { + if( $self->_has_pars && $algorithm == 100 ) { my $start_time = scalar( gmtime( time() ) ); $t->set_stemweb_jobid( 'local' ); my $cdata = character_input( $t, { collapse => $mergetypes } ); @@ -276,7 +269,7 @@ sub request :Local :Args(0) { } else { # Form the request for Stemweb. my $return_uri = URI->new( $c->uri_for( '/stemweb/result' ) ); - my $tsv_options = { noac => 1 }; + my $tsv_options = { noac => 1, ascii => 1 }; if( $mergetypes && @$mergetypes ) { $tsv_options->{mergetypes} = $mergetypes; }