Commit 36b79106 authored by Leo Gordon's avatar Leo Gordon
Browse files

ranked claiming technology: added support for both sqlite and pgsql drivers

parent 279e2e83
......@@ -551,22 +551,33 @@ sub grab_jobs_for_worker {
my $worker_id = $worker->dbID();
my $offset = $how_many_this_batch*$workers_rank;
my $prefix_sql = qq{
my $prefix_sql = ($self->dbc->driver eq 'mysql') ? qq{
UPDATE job j
JOIN (
SELECT job_id
FROM job
WHERE analysis_id='$analysis_id'
AND status='READY'
} : qq{
UPDATE job
SET worker_id='$worker_id', status='CLAIMED'
WHERE job_id in (
SELECT job_id
FROM job
WHERE analysis_id='$analysis_id'
AND status='READY'
};
my $virgin_sql = qq{ AND retry_count=0 };
my $limit_sql = qq{ LIMIT $how_many_this_batch };
my $offset_sql = qq{ OFFSET $offset };
my $suffix_sql = qq{
my $suffix_sql = ($self->dbc->driver eq 'mysql') ? qq{
) as x
USING (job_id)
SET j.worker_id='$worker_id', j.status='CLAIMED'
WHERE j.status='READY'
} : qq{
)
AND status='READY'
};
# we have to be explicitly numeric here because of '0E0' value returned by DBI if "no rows have been affected":
......
Markdown is supported
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