Gruntmaster::Data - Gruntmaster 6000 Online Judge -- database interface and tools
my $db = Gruntmaster::Data->connect('dbi:Pg:'); my $problem = $db->problem('my_problem'); $problem->update({timeout => 2.5}); # Set time limit to 2.5 seconds $problem->rerun; # And rerun all jobs for this problem # ... my $contest = $db->contests->create({ # Create a new contest id => 'my_contest', name => 'My Awesome Contest', start => time + 100, end => time + 1900, }); $db->contest_problems->create({ # Add a problem to the contest contest => 'my_contest', problem => 'my_problem', }); say 'The contest has not started yet' if $contest->is_pending; # ... my @jobs = $db->jobs->search({contest => 'my_contest', owner => 'MGV'})->all; $_->rerun for @jobs; # Rerun all jobs sent by MGV in my_contest
Gruntmaster::Data is the interface to the Gruntmaster 6000 database. Read the DBIx::Class documentation for usage information.
In addition to the typical DBIx::Class::Schema methods, this module contains several convenience methods:
Equivalent to $schema->resultset('Contest')
$schema->resultset('Contest')
Equivalent to $schema->resultset('ContestProblem')
$schema->resultset('ContestProblem')
Equivalent to $schema->resultset('Job')
$schema->resultset('Job')
Equivalent to $schema->resultset('Problem')
$schema->resultset('Problem')
Equivalent to $schema->resultset('User')
$schema->resultset('User')
Equivalent to $schema->resultset('Contest')->find($id)
$schema->resultset('Contest')->find($id)
Equivalent to $schema->resultset('Job')->find($id)
$schema->resultset('Job')->find($id)
Equivalent to $schema->resultset('Problem')->find($id)
$schema->resultset('Problem')->find($id)
Equivalent to $schema->resultset('User')->find($id)
$schema->resultset('User')->find($id)
Returns a list of users as an arrayref containing hashrefs.
Returns a hashref with information about the user $id.
Returns a list of problems grouped by level. A hashref with levels as keys.
Takes the following arguments:
Only show problems owned by this user
Only show problems in this contest
Returns a hashref with information about the problem $id. If $contest and $user are present, problem open data is updated.
Returns a list of contests grouped by state. A hashref with the following keys:
An arrayref of hashrefs representing pending contests
An arrayref of hashrefs representing running contests
An arrayref of hashrefs representing finished contests
Only show contests owned by this user.
Returns a hashref with information about the contest $id.
Returns a list of jobs as an arrayref containing hashrefs. Takes the following arguments:
Only show jobs submitted by this user.
Only show jobs submitted in this contest.
Only show jobs submitted for this problem.
Show this page of results. Defaults to 1. Pages have 10 entries, and the first page has the most recent jobs.
Returns a hashref with information about the job $id.
Marius Gavrilescu <marius@ieval.ro>
Copyright (C) 2014 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.1 or, at your option, any later version of Perl 5 you may have available.
To install Gruntmaster::Data, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gruntmaster::Data
CPAN shell
perl -MCPAN -e shell install Gruntmaster::Data
For more information on module installation, please visit the detailed CPAN module installation guide.