| 1 | package HPCD::uni::Stage; | ||
| 2 | |||
| 3 | ### INCLUDES ################################################################## | ||
| 4 | |||
| 5 | # safe Perl | ||
| 6 | use warnings; | ||
| 7 | use strict; | ||
| 8 | use Carp; | ||
| 9 | use Data::Dumper; | ||
| 10 | use DateTime; | ||
| 11 | |||
| 12 | use Moose; | ||
| 13 | use Moose::Util::TypeConstraints; | ||
| 14 | |||
| 15 | use HPCD::uni::Run; | ||
| 16 | |||
| 17 | with qw(HPCI::Stage), HPCI::get_extra_roles('uni', 'stage'); | ||
| 18 | |||
| 19 | sub _build_cluster_specific_valid_resources { | ||
| 20 | return ( | ||
| 21 | h_time => undef, | ||
| 22 | s_time => undef, | ||
| 23 | ) | ||
| 24 | } | ||
| 25 | |||
| 26 | =head1 NAME | ||
| 27 | |||
| 28 | HPCD::uni::Stage | ||
| 29 | |||
| 30 | =head1 SYNOPSIS | ||
| 31 | |||
| 32 | This is a HPCD internal module, loaded by HPCD::uni::Group to | ||
| 33 | provide stage objects for uni clusters. | ||
| 34 | |||
| 35 | It consumes the HPCI::Stage role. | ||
| 36 | |||
| 37 | =cut | ||
| 38 | |||
| 39 | has '+runs' => ( | ||
| 40 | isa => 'ArrayRef[HPCD::uni::Run]', | ||
| 41 | ); | ||
| 42 | |||
| 43 | has '_run_class' => ( | ||
| 44 | is => 'ro', | ||
| 45 | isa => 'Str', | ||
| 46 | init_arg => undef, | ||
| 47 | default => "HPCD::uni::Run", | ||
| 48 | ); | ||
| 49 | |||
| 50 | =head1 METHODS | ||
| 51 | |||
| 52 | =head2 _analyse_completion_state | ||
| 53 | |||
| 54 | Checks the completion info from when execution of this stage has | ||
| 55 | finished, and determine whether it: | ||
| 56 | |||
| 57 | - succeeded | ||
| 58 | - failed but can be retried (never for this driver) | ||
| 59 | - failed irrevocably | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | sub _analyse_completion_state { | ||
| 64 | my $self = shift; | ||
| 65 | my $run = shift; | ||
| 66 | my $stats = $run->stats; | ||
| 67 | $self->debug( "Stats from finished stage(" . $self->name . "): " . Dumper($stats) ); | ||
| 68 | my $new_state = | ||
| 69 | 0 == $stats->{exit_status} | ||
| 70 | ? 'pass' | ||
| 71 | : 'fail'; | ||
| 72 | $self->_set_state($new_state); | ||
| 73 | } | ||
| 74 | |||
| 75 | sub _get_submit_timeouts { | ||
| 76 | my $self = shift; | ||
| 77 | my $res = $self->_use_resources_required; | ||
| 78 | return | ||
| 79 | $self->_time_to_secs( $res->{s_time} // 0 ), | ||
| 80 | $self->_time_to_secs( $res->{h_time} // 0 ); | ||
| 81 | } | ||
| 82 | |||
| 83 | =head1 AUTHOR | ||
| 84 | |||
| 85 | John Macdonald - Boutros Lab | ||
| 86 | |||
| 87 | =head1 ACKNOWLEDGEMENTS | ||
| 88 | |||
| 89 | Paul Boutros, Phd, PI - Boutros Lab | ||
| 90 | |||
| 91 | The Ontario Institute for Cancer Research | ||
| 92 | |||
| 93 | =cut | ||
| 94 | |||
| 95 | 1; | ||
| 96 |