Commit cda3d220 authored by Gaël Berthaud-Müller's avatar Gaël Berthaud-Müller
Browse files

add queue batch script

parent 9e146bc9
......@@ -17,8 +17,12 @@ install the following packets (for Ubuntu/Debian):
sudo apt-get install -y libredis-perl libdata-messagepack-perl libnet-ip-xs-perl
```
The redis server location can be configure using the `REDIS_SERVER` environment
variable.
The Redis server location can be configure using the `REDIS_SERVER` environment
variable.
To queue jobs to Redis you can use the `queue_batch.pl` script in this
repository. This script will put all pending jobs in the last batch and put
them in the Redis queue.
[Zonemaster-Github]: https://github.com/zonemaster
[Zonemaster-Engine-ronde]: https://gitlab.rd.nic.fr/zonemaster/zonemaster-engine/-/tree/nightly-ronde
......
#!/usr/bin/env perl
use 5.14.2;
use warnings;
use strict;
use Zonemaster::Backend::DB;
use Zonemaster::Backend::Config;
use Zonemaster::Backend::RedisQueue;
my $config = Zonemaster::Backend::Config->load_config();
my $dbtype = $config->DB_engine;
my $dbclass = Zonemaster::Backend::DB->get_db_class( $dbtype );
my $db = $dbclass->from_config( $config );
my $queue = Zonemaster::Backend::RedisQueue->new( dbh => $db->dbh );
my $batch_id = $db->dbh->selectrow_arrayref(
'SELECT max( id ) FROM batch_jobs'
);
$batch_id = $$batch_id[0];
my $queued_jobs_count = $queue->queue_batch_job($batch_id);
print "Queued $queued_jobs_count jobs";
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment