X-Git-Url: http://git.ieval.ro/?p=gruntmaster-daemon.git;a=blobdiff_plain;f=lib%2FGruntmaster%2FDaemon.pm;h=b6d3a522f5935d6585dc612901b1d51634724648;hp=cc4a1290c27caa25fe618f04281ff3c4a292bded;hb=8473542d42779eebcd7b0dd45dcf5183d112252c;hpb=6101c7ad498081e435b1fa006c58b44b3c2400f1 diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index cc4a129..b6d3a52 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -4,7 +4,7 @@ use 5.014000; use strict; use warnings; -our $VERSION = '5999.000_004'; +our $VERSION = '5999.000_005'; use Gruntmaster::Daemon::Constants qw/ERR/; use Gruntmaster::Daemon::Format qw/prepare_files stopvms/; @@ -18,18 +18,22 @@ use Try::Tiny; use Log::Log4perl qw/get_logger/; use constant FORMAT_EXTENSION => { + BRAINFUCK => 'bf', C => 'c', CPP => 'cpp', GCCGO => 'go', GOLANG => 'go', GOLFSCRIPT => 'gs', HASKELL => 'hs', - MONO => 'cs', JAVA => 'java', + JULIA => 'jl', + MONO => 'cs', PASCAL => 'pas', PERL => 'pl', + PHP => 'php', PYTHON => 'py', RUBY => 'rb', + RUST => 'rs', SBCL => 'l', }; @@ -105,7 +109,7 @@ sub process{ sub process_job { my ($job) = @_; - my $pb = problem_full($job->{problem}); + my $pb = db()->select('problems', '*', {id => $job->{problem}})->hash; my $meta = { problem => $job->{problem}, files => { @@ -121,7 +125,7 @@ sub process_job { $meta->{timeout} = $timeout_override if defined $timeout_override; $meta->{tests} = decode_json $pb->{tests} if $meta->{runner} eq 'File'; $job->{contest} &&= contest_entry($job->{contest}); - delete $meta->{precnt} unless $job->{contest} && $job->{contest}{started} && !$job->{contest}{finished}; + delete $meta->{precnt} unless $job->{contest} && $job->{contest}{started} && !$job->{contest}{finished}; ## no critic (ProhibitNegativeExpressionsInUnlessAndUntilConditions) $meta->{testcnt} = $meta->{precnt} if $meta->{precnt}; $meta->{files}{ver} = { @@ -153,7 +157,7 @@ my $daemon = hostname . ":$$"; sub run{ require Gruntmaster::Data; Gruntmaster::Data->import; - Gruntmaster::Data::init($ENV{GRUNTMASTER_DSN} // 'dbi:Pg:'); + dbinit($ENV{GRUNTMASTER_DSN} // 'dbi:Pg:'); Log::Log4perl->init('/etc/gruntmasterd/gruntmasterd-log.conf'); get_logger->info("gruntmasterd $VERSION started ($daemon)"); my $dir = tempdir 'gruntmasterd.XXXX', CLEANUP => 1, TMPDIR => 1;