]> iEval git - gruntmaster-data.git/blob - lib/Gruntmaster/Data/Result/Job.pm
Add non-DBIC versions of all methods and a benchmark script
[gruntmaster-data.git] / lib / Gruntmaster / Data / Result / Job.pm
1 use utf8;
2 package 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
9 Gruntmaster::Data::Result::Job - List of jobs
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use 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
37 is_nullable: 1
38
39 =head2 daemon
40
41 data_type: 'text'
42 is_nullable: 1
43
44 hostname:PID of daemon that last executed this job. NULL if never executed
45
46 =head2 date
47
48 data_type: 'bigint'
49 is_nullable: 0
50
51 Unix time when job was submitted
52
53 =head2 errors
54
55 data_type: 'text'
56 is_nullable: 1
57
58 Compiler errors
59
60 =head2 extension
61
62 data_type: 'text'
63 is_nullable: 0
64
65 File extension of submitted program, without a leading dot
66
67 =head2 format
68
69 data_type: 'text'
70 is_nullable: 0
71
72 Format (programming language) of submitted program
73
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
86 =head2 reference
87
88 data_type: 'integer'
89 is_nullable: 1
90
91 If 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
93 =head2 result
94
95 data_type: 'integer'
96 is_nullable: 1
97
98 Job result (integer constant from Gruntmaster::Daemon::Constants)
99
100 =head2 result_text
101
102 data_type: 'text'
103 is_nullable: 1
104
105 Job result (human-readable text)
106
107 =head2 results
108
109 data_type: 'text'
110 is_nullable: 1
111
112 Per-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
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",
136 { data_type => "text", is_foreign_key => 1, is_nullable => 1 },
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 },
151 "reference",
152 { data_type => "integer", is_nullable => 1 },
153 "result",
154 { data_type => "integer", is_nullable => 1 },
155 "result_text",
156 { data_type => "text", is_nullable => 1 },
157 "results",
158 { data_type => "text", is_nullable => 1 },
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
181 Type: belongs_to
182
183 Related object: L<Gruntmaster::Data::Result::Contest>
184
185 =cut
186
187 __PACKAGE__->belongs_to(
188 "contest",
189 "Gruntmaster::Data::Result::Contest",
190 { id => "contest" },
191 {
192 is_deferrable => 0,
193 join_type => "LEFT",
194 on_delete => "CASCADE",
195 on_update => "NO ACTION",
196 },
197 );
198
199 =head2 owner
200
201 Type: belongs_to
202
203 Related object: L<Gruntmaster::Data::Result::User>
204
205 =cut
206
207 __PACKAGE__->belongs_to(
208 "owner",
209 "Gruntmaster::Data::Result::User",
210 { id => "owner" },
211 { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
212 );
213
214 =head2 problem
215
216 Type: belongs_to
217
218 Related object: L<Gruntmaster::Data::Result::Problem>
219
220 =cut
221
222 __PACKAGE__->belongs_to(
223 "problem",
224 "Gruntmaster::Data::Result::Problem",
225 { id => "problem" },
226 { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
227 );
228
229 =head2 problem_statuses
230
231 Type: has_many
232
233 Related 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
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
247
248 use Class::Method::Modifiers qw/after/;
249
250 sub rawcontest { shift->get_column('contest') }
251 sub rawowner { shift->get_column('owner') }
252 sub rawproblem { shift->get_column('problem') }
253
254 sub rerun {
255 shift->update({daemon => undef, result => -2, result_text => undef});
256 }
257
258 after 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
267 1;
268
269 __END__
270
271 =head1 METHODS
272
273 =head2 rerun
274
275 Reruns this job.
276
277 =head1 AUTHOR
278
279 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
280
281 =head1 COPYRIGHT AND LICENSE
282
283 Copyright (C) 2014 by Marius Gavrilescu
284
285 This library is free software; you can redistribute it and/or modify
286 it under the same terms as Perl itself, either Perl version 5.18.1 or,
287 at your option, any later version of Perl 5 you may have available.
288
289
290 =cut
This page took 0.049519 seconds and 4 git commands to generate.