line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::Schema::TestrunDB::ResultSet::Testrun; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
3
|
|
|
|
|
|
|
$Tapper::Schema::TestrunDB::ResultSet::Testrun::VERSION = '5.0.11'; |
4
|
7
|
|
|
7
|
|
29795
|
use strict; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
184
|
|
5
|
7
|
|
|
7
|
|
31
|
use warnings; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
168
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
32
|
use parent 'DBIx::Class::ResultSet'; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
35
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub queued_testruns |
11
|
|
|
|
|
|
|
{ |
12
|
|
|
|
|
|
|
shift->search({ |
13
|
1
|
|
|
1
|
1
|
441
|
starttime_testrun => undef, |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub running_testruns |
20
|
|
|
|
|
|
|
{ |
21
|
|
|
|
|
|
|
shift->search({ |
22
|
1
|
|
|
1
|
1
|
460
|
starttime_testrun => { '!=' => undef }, |
23
|
|
|
|
|
|
|
endtime_test_program => undef, |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub finished_testruns |
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
shift->search({ |
32
|
0
|
|
|
0
|
1
|
0
|
endtime_test_program => { '!=' => undef }, |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub due_testruns |
39
|
|
|
|
|
|
|
{ |
40
|
1
|
|
|
1
|
1
|
341
|
my ($self) = @_; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
8
|
require DateTime; |
43
|
1
|
|
|
|
|
6
|
my $now = $self->result_source->storage->datetime_parser->format_datetime(DateTime->now); |
44
|
1
|
|
|
|
|
548
|
return $self->search( |
45
|
|
|
|
|
|
|
{ |
46
|
|
|
|
|
|
|
starttime_earliest => { '<', $now}, |
47
|
|
|
|
|
|
|
starttime_testrun => undef, |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
{ |
50
|
|
|
|
|
|
|
order_by => [qw/starttime_earliest/] |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub all_testruns { |
57
|
1
|
|
|
1
|
1
|
504
|
shift->search({}); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub status { |
62
|
1
|
|
|
1
|
1
|
338
|
shift->search({'testrun_scheduling.status' => $_[0]}, {join => 'testrun_scheduling'}); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub add { |
67
|
1
|
|
|
1
|
1
|
24124
|
my ($self, $args) = @_; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $testrun = $self->new |
70
|
|
|
|
|
|
|
({ |
71
|
|
|
|
|
|
|
testplan_id => $args->{testplan_id}, |
72
|
|
|
|
|
|
|
notes => $args->{notes}, |
73
|
|
|
|
|
|
|
shortname => $args->{shortname}, |
74
|
|
|
|
|
|
|
topic_name => $args->{topic_name}, |
75
|
|
|
|
|
|
|
starttime_earliest => $args->{earliest}, |
76
|
|
|
|
|
|
|
owner_id => $args->{owner_id}, |
77
|
|
|
|
|
|
|
rerun_on_error => $args->{rerun_on_error}, |
78
|
|
|
|
|
|
|
wait_after_tests => $args->{wait_after_tests}, |
79
|
1
|
|
|
|
|
10
|
}); |
80
|
|
|
|
|
|
|
|
81
|
1
|
|
|
|
|
252
|
$testrun->insert; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $testrunscheduling = $self->result_source->schema->resultset('TestrunScheduling')->new |
85
|
|
|
|
|
|
|
({ |
86
|
|
|
|
|
|
|
testrun_id => $testrun->id, |
87
|
|
|
|
|
|
|
queue_id => $args->{queue_id}, |
88
|
|
|
|
|
|
|
host_id => $args->{host_id}, |
89
|
|
|
|
|
|
|
status => $args->{status} || "schedule", |
90
|
1
|
|
50
|
|
|
35812
|
auto_rerun => $args->{auto_rerun} || 0, |
|
|
|
50
|
|
|
|
|
91
|
|
|
|
|
|
|
}); |
92
|
1
|
50
|
|
|
|
1147
|
if ($args->{priority}) { |
93
|
0
|
|
|
|
|
0
|
$testrunscheduling->prioqueue_seq($self->result_source->schema->resultset('TestrunScheduling')->max_priority_seq()+1); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
23
|
$testrunscheduling->insert; |
97
|
|
|
|
|
|
|
|
98
|
1
|
50
|
|
|
|
36453
|
if ($args->{scenario_id}) { |
99
|
|
|
|
|
|
|
my $scenario_element = $self->result_source->schema->resultset('ScenarioElement')->new |
100
|
|
|
|
|
|
|
({ |
101
|
|
|
|
|
|
|
scenario_id => $args->{scenario_id}, |
102
|
1
|
|
|
|
|
50
|
testrun_id => $testrun->id, |
103
|
|
|
|
|
|
|
}); |
104
|
1
|
|
|
|
|
672
|
$scenario_element->insert; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
1
|
|
|
|
|
12682
|
foreach my $host_id(@{$args->{requested_host_ids}}) { |
|
1
|
|
|
|
|
6
|
|
108
|
3
|
|
|
|
|
39641
|
my $requested_host = $self->result_source->schema->resultset('TestrunRequestedHost')->new |
109
|
|
|
|
|
|
|
({ |
110
|
|
|
|
|
|
|
host_id => $host_id, |
111
|
|
|
|
|
|
|
testrun_id => $testrun->id, |
112
|
|
|
|
|
|
|
}); |
113
|
3
|
|
|
|
|
2402
|
$requested_host->insert; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
1
|
|
|
|
|
22020
|
return $testrun->id; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
__END__ |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=pod |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=encoding UTF-8 |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 NAME |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Tapper::Schema::TestrunDB::ResultSet::Testrun |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 queued_testruns |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Search for queued testruns. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 running_testruns |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Search for running testruns. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 finished_testruns |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Search for finished testruns. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 due_testruns |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Search for due testruns. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 all_testruns |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Search for all testruns. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 status |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Search for testrun with given status. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 add |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Insert (add) a new testrun into DB, assign it with other typical also |
158
|
|
|
|
|
|
|
inserted db rows, and return it. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 AUTHORS |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=over 4 |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=back |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Advanced Micro Devices, Inc.. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
This is free software, licensed under: |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=cut |