Here is a quick patch need testing:

--- scheduler.py.old    2012-06-02 14:44:26.000000000 +0200
+++ scheduler.py        2012-06-04 10:46:35.557913663 +0200
@@ -417,13 +417,13 @@
             return None
         grabbed = db(ts.assigned_worker_name==self.worker_name)\
             (ts.status==ASSIGNED)
-        task_id = grabbed._select(ts.id, limitby=(0,1), 
orderby=ts.next_run_time)
-        updated = db(
-            ts.id.belongs(task_id)
-            ).update(status=RUNNING,last_run_time=now) #reduces collisions?
-        #noone will touch my task!
-        db.commit()
-        if updated:
+        task_row = grabbed.select(ts.id, limitby=(0,1), 
orderby=ts.next_run_time).first()
+        if task_row:
+            updated = db(
+                ts.id.belongs(task_row.id)
+                ).update(status=RUNNING,last_run_time=now) #reduces collisions?
+            #noone will touch my task!
+            db.commit()
             logging.debug('   work to do %s' % updated)
             task = db(ts.assigned_worker_name==self.worker_name)\
                     (ts.status==RUNNING).select().first()






2012. június 4., hétfő 9:47:29 UTC+2 időpontban szimszon a következőt írta:
>
> http://code.google.com/p/web2py/issues/detail?id=833
>
> After upgrading to Version 2.0.0 (2012-06-02 16:44:25) dev I got this if I 
> start scheduler:
>
> Currently running 1 scheduler processes
> Processes started
> 2012-06-04 09:40:47,874 - root - DEBUG - defining tables (migrate=True)
> 2012-06-04 09:40:47,880 - root - DEBUG - thread building own DAL object
> 2012-06-04 09:40:47,880 - root - DEBUG - looping...
> 2012-06-04 09:40:47,883 - root - DEBUG - defining tables (migrate=False)
> 2012-06-04 09:40:47,886 - root - DEBUG - ........recording heartbeat
> 2012-06-04 09:40:47,887 - root - DEBUG -     freeing workers that have not 
> sent heartbeat
> 2012-06-04 09:40:47,889 - root - INFO - TICKER: I'm a ticker 
> (info-szimszon#709cdf44-805a-41a5-b197-8aa124acf311)
> Traceback (most recent call last):
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/shell.py", 
> line 219, in run
>     exec(python_code, _env)
>   File "<string>", line 1, in <module>
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/scheduler.py", 
> line 398, in loop
>     MetaScheduler.loop(self)
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/scheduler.py", 
> line 279, in loop
>     task = self.pop_task()
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/scheduler.py", 
> line 423, in pop_task
>     ).update(status=RUNNING,last_run_time=now) #reduces collisions?
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
> 8147, in update
>     if any(f(self,update_fields) for f in table._before_update): return 0
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
> 8147, in <genexpr>
>     if any(f(self,update_fields) for f in table._before_update): return 0
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
> 7051, in <lambda>
>     archive_record(qset,fs,at,cn))
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
> 7450, in archive_record
>     for row in qset.select():
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
> 8130, in select
>     return adapter.select(self.query,fields,attributes)
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
> 1400, in select
>     rows = response(sql)
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
> 1390, in response
>     self.execute(sql)
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
> 1479, in execute
>     return self.log_execute(*a, **b)
>   File "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/dal.py", line 
> 1473, in log_execute
>     ret = self.cursor.execute(*a, **b)
>   File 
> "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/contrib/pymysql/cursors.py",
>  line 108, in execute
>     self.errorhandler(self, exc, value)
>   File 
> "/home/PRIMERATE.LAN/gyszabolcs/fejlesztes/web2py/gluon/contrib/pymysql/connections.py",
>  line 184, in defaulterrorhandler
>     raise errorclass, errorvalue
> NotSupportedError: (1235, u"This version of MySQL doesn't yet support 'LIMIT 
> & IN/ALL/ANY/SOME subquery'")
>
>
>

Reply via email to