use parent qw/Exporter/;
our $VERSION = '5999.000_013';
-our @EXPORT = qw/purge user_list user_entry problem_list problem_entry contest_list contest_entry contest_full contest_has_problem job_list job_entry job_full create_job standings update_status/; ## no critic (ProhibitAutomaticExportation)
+our @EXPORT = qw/purge db user_list user_entry problem_list problem_entry contest_list contest_entry contest_full contest_has_problem job_list job_entry job_full create_job standings update_status rerun_job/; ## no critic (ProhibitAutomaticExportation)
use JSON::MaybeXS qw/decode_json/;
use HTTP::Tiny;
job_entry_sth => 'SELECT * FROM job_entry WHERE id = ?',
job_full_sth => 'SELECT * FROM jobs WHERE id = ?',
+
+ rerun_job_sth => 'UPDATE jobs SET daemon=NULL,result=-2,result_text=NULL,results=NULL,errors=NULL WHERE id = ?',
);
our $db;
+sub db () { $db }
sub init {
$db = DBIx::Simple->new(@_);
$db->commit
}
+sub rerun_job {
+ my ($id) = @_;
+ $db->query(rerun_job_sth => $id);
+ purge '/log/';
+ purge "/log/$id";
+}
+
my @PURGE_HOSTS = exists $ENV{PURGE_HOSTS} ? split ' ', $ENV{PURGE_HOSTS} : ();
my $ht = HTTP::Tiny->new;