As a quick workaround, this change in assign_next_task seems to do the
trick:

        subselect = db(query).select(
            db.task_scheduled.id,limitby=(0,1),
            orderby=db.task_scheduled.next_run_time)
        for row in subselect:
            db(db.task_scheduled.id == row.id).update(
                status=RUNNING,
                assigned_worker_name=self.worker_name,
                last_run_time=datetime.now)

On Aug 13, 11:47 am, Massimo Di Pierro <[email protected]>
wrote:
> I have MySQL, it is full of caveats like this. Can somebody check
> postgresql?
> If this is just a mysql issue, we'll deal with it as an exception and
> find a workaround.
>
> On 13 Ago, 04:56, G <[email protected]> wrote:
>
> > Hello,
> > I just tried to use scheduler.py with MySQL instead of SQLite and ran
> > into this error:
>
> > NotSupportedError: (1235, "This version of MySQL doesn't yet support
> > 'LIMIT & IN/ALL/ANY/SOME subquery'")
>
> > The MySQL server version is 5.0.77. Searching on the web, it seems
> > this limitation is common. Is there a way to work around the issue?
> > The offending SQL looks like this:
>
> > UPDATE task_scheduled SET
> > status='running',assigned_worker_name='crabby#237cf3f0-89e7-4db5-
> > b514-56db27a700d5',last_run_time='2011-08-13 09:33:01' WHERE
> > (task_scheduled.id IN (SELECT  task_scheduled.id FROM task_scheduled
> > WHERE (((((task_scheduled.enabled = 'T') AND (task_scheduled.status =
> > 'queued')) AND (task_scheduled.group_name IN ('command','main'))) AND
> > (task_scheduled.next_run_time < '2011-08-13 09:33:01')) AND
> > (((task_scheduled.assigned_worker_name = '') OR
> > (task_scheduled.assigned_worker_name IS NULL)) OR
> > (task_scheduled.assigned_worker_name = 'crabby#237cf3f0-89e7-4db5-
> > b514-56db27a700d5'))) ORDER BY task_scheduled.next_run_time LIMIT 1
> > OFFSET 0));
>
> > I'm pretty sure this is coming from the massively complex query in
> > assign_next_task.
>
> > Thanks,
> > G
>
>

Reply via email to