| Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Tapper/Schema/TestrunDB/ResultSet/Testrun.pm |
| Statements | Executed 16 statements in 585µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 12.2ms | 91.0ms | Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 |
| 1 | 1 | 1 | 12µs | 66µs | Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@15 |
| 1 | 1 | 1 | 10µs | 10µs | Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@2 |
| 1 | 1 | 1 | 9µs | 11µs | Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@9 |
| 1 | 1 | 1 | 7µs | 17µs | Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@10 |
| 0 | 0 | 0 | 0s | 0s | Tapper::Schema::TestrunDB::ResultSet::Testrun::add |
| 0 | 0 | 0 | 0s | 0s | Tapper::Schema::TestrunDB::ResultSet::Testrun::all_testruns |
| 0 | 0 | 0 | 0s | 0s | Tapper::Schema::TestrunDB::ResultSet::Testrun::due_testruns |
| 0 | 0 | 0 | 0s | 0s | Tapper::Schema::TestrunDB::ResultSet::Testrun::finished_testruns |
| 0 | 0 | 0 | 0s | 0s | Tapper::Schema::TestrunDB::ResultSet::Testrun::queued_testruns |
| 0 | 0 | 0 | 0s | 0s | Tapper::Schema::TestrunDB::ResultSet::Testrun::running_testruns |
| 0 | 0 | 0 | 0s | 0s | Tapper::Schema::TestrunDB::ResultSet::Testrun::status |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Tapper::Schema::TestrunDB::ResultSet::Testrun; | ||||
| 2 | # spent 10µs within Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@2 which was called:
# once (10µs+0s) by Class::C3::Componentised::ensure_class_loaded at line 4 | ||||
| 3 | 1 | 5µs | $Tapper::Schema::TestrunDB::ResultSet::Testrun::AUTHORITY = 'cpan:AMD'; | ||
| 4 | 1 | 22µs | 1 | 10µs | } # spent 10µs making 1 call to Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@2 |
| 5 | { | ||||
| 6 | 2 | 1µs | $Tapper::Schema::TestrunDB::ResultSet::Testrun::VERSION = '0.001'; | ||
| 7 | } | ||||
| 8 | |||||
| 9 | 3 | 18µs | 2 | 13µs | # spent 11µs (9+2) within Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@9 which was called:
# once (9µs+2µs) by Class::C3::Componentised::ensure_class_loaded at line 9 # spent 11µs making 1 call to Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@9
# spent 2µs making 1 call to strict::import |
| 10 | 3 | 21µs | 2 | 26µs | # spent 17µs (7+9) within Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@10 which was called:
# once (7µs+9µs) by Class::C3::Componentised::ensure_class_loaded at line 10 # spent 17µs making 1 call to Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@10
# spent 9µs making 1 call to warnings::import |
| 11 | |||||
| 12 | 3 | 115µs | 1 | 91.0ms | # spent 91.0ms (12.2+78.8) within Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 which was called:
# once (12.2ms+78.8ms) by Class::C3::Componentised::ensure_class_loaded at line 12 # spent 91.0ms making 1 call to Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 |
| 13 | |||||
| 14 | |||||
| 15 | 3 | 400µs | 2 | 120µs | # spent 66µs (12+54) within Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@15 which was called:
# once (12µs+54µs) by Class::C3::Componentised::ensure_class_loaded at line 15 # spent 66µs making 1 call to Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@15
# spent 54µs making 1 call to parent::import |
| 16 | |||||
| 17 | |||||
| 18 | sub queued_testruns | ||||
| 19 | { | ||||
| 20 | shift->search({ | ||||
| 21 | starttime_testrun => undef, | ||||
| 22 | } | ||||
| 23 | ); | ||||
| 24 | } | ||||
| 25 | |||||
| 26 | |||||
| 27 | sub running_testruns | ||||
| 28 | { | ||||
| 29 | shift->search({ | ||||
| 30 | starttime_testrun => { '!=' => undef }, | ||||
| 31 | endtime_test_program => undef, | ||||
| 32 | } | ||||
| 33 | ); | ||||
| 34 | } | ||||
| 35 | |||||
| 36 | |||||
| 37 | sub finished_testruns | ||||
| 38 | { | ||||
| 39 | shift->search({ | ||||
| 40 | endtime_test_program => { '!=' => undef }, | ||||
| 41 | } | ||||
| 42 | ); | ||||
| 43 | } | ||||
| 44 | |||||
| 45 | |||||
| 46 | sub due_testruns | ||||
| 47 | { | ||||
| 48 | my ($self) = @_; | ||||
| 49 | |||||
| 50 | my $now = $self->result_source->storage->datetime_parser->format_datetime(DateTime->now); | ||||
| 51 | return $self->search( | ||||
| 52 | { | ||||
| 53 | starttime_earliest => { '<', $now}, | ||||
| 54 | starttime_testrun => undef, | ||||
| 55 | }, | ||||
| 56 | { | ||||
| 57 | order_by => [qw/starttime_earliest/] | ||||
| 58 | } | ||||
| 59 | ); | ||||
| 60 | } | ||||
| 61 | |||||
| 62 | |||||
| 63 | sub all_testruns { | ||||
| 64 | shift->search({}); | ||||
| 65 | } | ||||
| 66 | |||||
| 67 | |||||
| 68 | sub status { | ||||
| 69 | shift->search({'testrun_scheduling.status' => $_[0]}, {join => 'testrun_scheduling'}); | ||||
| 70 | } | ||||
| 71 | |||||
| 72 | |||||
| 73 | sub add { | ||||
| 74 | my ($self, $args) = @_; | ||||
| 75 | |||||
| 76 | my $testrun = $self->new | ||||
| 77 | ({ | ||||
| 78 | testplan_id => $args->{testplan_id}, | ||||
| 79 | notes => $args->{notes}, | ||||
| 80 | shortname => $args->{shortname}, | ||||
| 81 | topic_name => $args->{topic_name}, | ||||
| 82 | starttime_earliest => $args->{earliest}, | ||||
| 83 | owner_user_id => $args->{owner_user_id}, | ||||
| 84 | rerun_on_error => $args->{rerun_on_error}, | ||||
| 85 | }); | ||||
| 86 | |||||
| 87 | $testrun->insert; | ||||
| 88 | |||||
| 89 | |||||
| 90 | my $testrunscheduling = $self->result_source->schema->resultset('TestrunScheduling')->new | ||||
| 91 | ({ | ||||
| 92 | testrun_id => $testrun->id, | ||||
| 93 | queue_id => $args->{queue_id}, | ||||
| 94 | host_id => $args->{host_id}, | ||||
| 95 | status => "schedule", | ||||
| 96 | auto_rerun => $args->{auto_rerun} || 0, | ||||
| 97 | }); | ||||
| 98 | if ($args->{priority}) { | ||||
| 99 | $testrunscheduling->prioqueue_seq($self->result_source->schema->resultset('TestrunScheduling')->max_priority_seq()+1); | ||||
| 100 | } | ||||
| 101 | |||||
| 102 | $testrunscheduling->insert; | ||||
| 103 | |||||
| 104 | if ($args->{scenario_id}) { | ||||
| 105 | my $scenario_element = $self->result_source->schema->resultset('ScenarioElement')->new | ||||
| 106 | ({ | ||||
| 107 | scenario_id => $args->{scenario_id}, | ||||
| 108 | testrun_id => $testrun->id, | ||||
| 109 | }); | ||||
| 110 | $scenario_element->insert; | ||||
| 111 | } | ||||
| 112 | |||||
| 113 | foreach my $host_id(@{$args->{requested_host_ids}}) { | ||||
| 114 | my $requested_host = $self->result_source->schema->resultset('TestrunRequestedHost')->new | ||||
| 115 | ({ | ||||
| 116 | host_id => $host_id, | ||||
| 117 | testrun_id => $testrun->id, | ||||
| 118 | }); | ||||
| 119 | $requested_host->insert; | ||||
| 120 | } | ||||
| 121 | |||||
| 122 | return $testrun->id; | ||||
| 123 | } | ||||
| 124 | |||||
| 125 | 1 | 3µs | 1; | ||
| 126 | |||||
| 127 | __END__ |