]> iEval git - gruntmaster-data.git/blame - lib/Gruntmaster/Data/Result/Job.pm
Add "reference" column to jobs
[gruntmaster-data.git] / lib / Gruntmaster / Data / Result / Job.pm
CommitLineData
4ed3f8e7
MG
1use utf8;
2package Gruntmaster::Data::Result::Job;
3
4# Created by DBIx::Class::Schema::Loader
5# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7=head1 NAME
8
be2f7678 9Gruntmaster::Data::Result::Job - List of jobs
4ed3f8e7
MG
10
11=cut
12
13use strict;
14use warnings;
15
16use base 'DBIx::Class::Core';
17
18=head1 TABLE: C<jobs>
19
20=cut
21
22__PACKAGE__->table("jobs");
23
24=head1 ACCESSORS
25
26=head2 id
27
28 data_type: 'integer'
29 is_auto_increment: 1
30 is_nullable: 0
31 sequence: 'jobs_id_seq'
32
33=head2 contest
34
35 data_type: 'text'
36 is_foreign_key: 1
b2725d9d 37 is_nullable: 1
4ed3f8e7
MG
38
39=head2 daemon
40
41 data_type: 'text'
42 is_nullable: 1
43
be2f7678
MG
44hostname:PID of daemon that last executed this job. NULL if never executed
45
4ed3f8e7
MG
46=head2 date
47
48 data_type: 'bigint'
49 is_nullable: 0
50
be2f7678
MG
51Unix time when job was submitted
52
4ed3f8e7
MG
53=head2 errors
54
55 data_type: 'text'
56 is_nullable: 1
57
be2f7678
MG
58Compiler errors
59
4ed3f8e7
MG
60=head2 extension
61
62 data_type: 'text'
63 is_nullable: 0
64
be2f7678
MG
65File extension of submitted program, without a leading dot
66
4ed3f8e7
MG
67=head2 format
68
69 data_type: 'text'
70 is_nullable: 0
71
be2f7678
MG
72Format (programming language) of submitted program
73
4ed3f8e7
MG
74=head2 private
75
76 data_type: 'boolean'
77 default_value: false
78 is_nullable: 0
79
80=head2 problem
81
82 data_type: 'text'
83 is_foreign_key: 1
84 is_nullable: 0
85
987ee14e
MG
86=head2 reference
87
88 data_type: 'integer'
89 is_nullable: 1
90
91If not null, this is a reference solution that should get this result. For example, set reference=0 on jobs that should be accepted, reference=3 on jobs that should get TLE, etc
92
4ed3f8e7
MG
93=head2 result
94
95 data_type: 'integer'
96 is_nullable: 1
97
be2f7678
MG
98Job result (integer constant from Gruntmaster::Daemon::Constants)
99
4ed3f8e7
MG
100=head2 result_text
101
102 data_type: 'text'
103 is_nullable: 1
104
be2f7678
MG
105Job result (human-readable text)
106
4ed3f8e7
MG
107=head2 results
108
85d3f015 109 data_type: 'text'
4ed3f8e7
MG
110 is_nullable: 1
111
be2f7678
MG
112Per-test results (JSON array of hashes with keys id (test number, counting from 1), result (integer constant from Gruntmaster::Daemon::Constants), result_text (human-readable text), time (execution time in decimal seconds))
113
4ed3f8e7
MG
114=head2 source
115
116 data_type: 'text'
117 is_nullable: 0
118
119=head2 owner
120
121 data_type: 'text'
122 is_foreign_key: 1
123 is_nullable: 0
124
125=cut
126
127__PACKAGE__->add_columns(
128 "id",
129 {
130 data_type => "integer",
131 is_auto_increment => 1,
132 is_nullable => 0,
133 sequence => "jobs_id_seq",
134 },
135 "contest",
b2725d9d 136 { data_type => "text", is_foreign_key => 1, is_nullable => 1 },
4ed3f8e7
MG
137 "daemon",
138 { data_type => "text", is_nullable => 1 },
139 "date",
140 { data_type => "bigint", is_nullable => 0 },
141 "errors",
142 { data_type => "text", is_nullable => 1 },
143 "extension",
144 { data_type => "text", is_nullable => 0 },
145 "format",
146 { data_type => "text", is_nullable => 0 },
147 "private",
148 { data_type => "boolean", default_value => \"false", is_nullable => 0 },
149 "problem",
150 { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
987ee14e
MG
151 "reference",
152 { data_type => "integer", is_nullable => 1 },
4ed3f8e7
MG
153 "result",
154 { data_type => "integer", is_nullable => 1 },
155 "result_text",
156 { data_type => "text", is_nullable => 1 },
157 "results",
85d3f015 158 { data_type => "text", is_nullable => 1 },
4ed3f8e7
MG
159 "source",
160 { data_type => "text", is_nullable => 0 },
161 "owner",
162 { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
163);
164
165=head1 PRIMARY KEY
166
167=over 4
168
169=item * L</id>
170
171=back
172
173=cut
174
175__PACKAGE__->set_primary_key("id");
176
177=head1 RELATIONS
178
179=head2 contest
180
181Type: belongs_to
182
183Related object: L<Gruntmaster::Data::Result::Contest>
184
185=cut
186
187__PACKAGE__->belongs_to(
188 "contest",
189 "Gruntmaster::Data::Result::Contest",
190 { id => "contest" },
b2725d9d
MG
191 {
192 is_deferrable => 0,
193 join_type => "LEFT",
9bb39921 194 on_delete => "CASCADE",
b2725d9d
MG
195 on_update => "NO ACTION",
196 },
4ed3f8e7
MG
197);
198
199=head2 owner
200
201Type: belongs_to
202
203Related object: L<Gruntmaster::Data::Result::User>
204
205=cut
206
207__PACKAGE__->belongs_to(
208 "owner",
209 "Gruntmaster::Data::Result::User",
210 { id => "owner" },
9bb39921 211 { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
4ed3f8e7
MG
212);
213
214=head2 problem
215
216Type: belongs_to
217
218Related object: L<Gruntmaster::Data::Result::Problem>
219
220=cut
221
222__PACKAGE__->belongs_to(
223 "problem",
224 "Gruntmaster::Data::Result::Problem",
225 { id => "problem" },
9bb39921 226 { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
4ed3f8e7
MG
227);
228
adb42d4d 229=head2 problem_statuses
4ed3f8e7 230
adb42d4d
MG
231Type: has_many
232
233Related object: L<Gruntmaster::Data::Result::ProblemStatus>
234
235=cut
236
237__PACKAGE__->has_many(
238 "problem_statuses",
239 "Gruntmaster::Data::Result::ProblemStatus",
240 { "foreign.job" => "self.id" },
241 { cascade_copy => 0, cascade_delete => 0 },
242);
243
244
987ee14e
MG
245# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-03-16 15:40:48
246# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aaVaCgk198pT0kBGMefkkA
4ed3f8e7 247
de7226ca
MG
248use Class::Method::Modifiers qw/after/;
249
a2aa46e6
MG
250sub rawcontest { shift->get_column('contest') }
251sub rawowner { shift->get_column('owner') }
252sub rawproblem { shift->get_column('problem') }
253
4a8747ef
MG
254sub rerun {
255 shift->update({daemon => undef, result => -2, result_text => undef});
256}
4ed3f8e7 257
de7226ca
MG
258after qw/insert update delete/ => sub {
259 my ($self) = @_;
260 Gruntmaster::Data::purge '/us/';
261 Gruntmaster::Data::purge '/us/' . $self->rawowner;
262 Gruntmaster::Data::purge '/st/' . $self->rawcontest if $self->rawcontest;
263 Gruntmaster::Data::purge '/log/';
264 Gruntmaster::Data::purge '/log/' . $self->id;
265};
266
4ed3f8e7 2671;
4a8747ef
MG
268
269__END__
270
271=head1 METHODS
272
273=head2 rerun
274
275Reruns this job.
276
277=head1 AUTHOR
278
279Marius Gavrilescu E<lt>marius@ieval.roE<gt>
280
281=head1 COPYRIGHT AND LICENSE
282
283Copyright (C) 2014 by Marius Gavrilescu
284
285This library is free software; you can redistribute it and/or modify
286it under the same terms as Perl itself, either Perl version 5.18.1 or,
287at your option, any later version of Perl 5 you may have available.
288
289
290=cut
This page took 0.054666 seconds and 4 git commands to generate.