New scheduler starts no job if there is no stop_time

32 views
Skip to first unread message

szimszon

unread,
Jul 3, 2012, 5:47:53 AM7/3/12
to web2py-d...@googlegroups.com
I have some old app where I do not specify any value for scheduler_task.stop_time the new scheduler do not start tasks with scheduler_task.stop_time = None :(

szimszon

unread,
Jul 3, 2012, 6:07:02 AM7/3/12
to web2py-d...@googlegroups.com
At least with postgresql...
Message has been deleted

Niphlod

unread,
Jul 3, 2012, 11:27:18 AM7/3/12
to web2py-d...@googlegroups.com
How much "new" is the scheduler ?

this is from the last version

all_available = db(ts.status.belongs((QUEUED,ASSIGNED)))\
               
((ts.times_run<ts.repeats)|(ts.repeats==0))\
               
(ts.start_time<=now)\
               
((ts.stop_time==None) | (ts.stop_time>now))\
               
(ts.next_run_time<=now)\
               
(ts.enabled==True)

So, it grabs tasks with stop_time = NULL
OR
stop_time > getdate()

 This has been asked to be able to schedule "neverending" tasks, previuosly all scheduled tasks had a "default" stop_time set to 1 day in the future.

BTW, it should not happen what you are experiencing.

szimszon

unread,
Jul 4, 2012, 3:18:47 AM7/4/12
to web2py-d...@googlegroups.com

Version 2.0.0 (2012-06-28 22:49:58) dev


I made a job with

            import simplejson
            db
.scheduler_task.insert(
                                                     task_name
= 'kezzel-downloadfile-%s' % ( auth.user.username ),
                                                     function_name
= 'downloadfile',
                                                     vars
= simplejson.dumps(
                                                                    dict
(
                                                                            username
= auth.user.username,
                                                                            db_id
= db_id,
                                                                            url
= form.vars.url,
                                                                           
)
                                                                   
),
                                                     timeout
= 2600,
                                                     
)


And it does not work.

Here you removed the default=None from stop_time: https://github.com/mdipierro/web2py/commit/a53f689a6d28a810aac436bc4f537ca460f9d1db#gluon/scheduler.py

364   -            Field('stop_time','datetime',default=None),
 
373 +            Field('stop_time','datetime'),

Could it be that if you insert None value into db that is not the same as you specify nothing?

szimszon

unread,
Jul 4, 2012, 3:55:04 AM7/4/12
to web2py-d...@googlegroups.com
That's odd. Can't reproduce :(

Niphlod

unread,
Jul 4, 2012, 4:00:51 AM7/4/12
to web2py-d...@googlegroups.com
uhm, wait..... a Field('something', default=None) should be behaving exactly the same as Field('something'), i.e. no default --> default == None

Task scheduled the way you inserted those should be picked up (and I tried MSSQL, SQLite, PostgresSQL to verify that "it works").

If you find a way to reproduce the issue please let me know

szimszon

unread,
Jul 4, 2012, 4:17:07 AM7/4/12
to web2py-d...@googlegroups.com
The app was compiled with an older version of web2py. Could that be a culprit?

Niphlod

unread,
Jul 4, 2012, 5:16:06 AM7/4/12
to web2py-d...@googlegroups.com
From what I know of compiled apps, they should be "freezed", ok, but the code we're talking about is in gluon/scheduler.py, so I don't think that matters.
Anyhow, are you still having problems or we're talking just about the initial issue of yours that you can't reproduce ?

szimszon

unread,
Jul 4, 2012, 5:49:00 AM7/4/12
to web2py-d...@googlegroups.com
It was a one time issue. After I upgraded web2py to Version 2.0.0 (2012-06-28 22:49:58) dev one of my apps scheduler jobs got queued but not assigned (apache2 wsgi and scheduler was restarted after upgrade). After that I changed all my code to set stop_time explicitly to now+1 day. Upgraded my apps (compiled again the new web2py). Now I have a working scheduler. In my test system (apps are not compiled) I reverted the insert to do not set stop_time but the jobs get assigned to the worker now.

So we can close that for now. :-o
Reply all
Reply to author
Forward
0 new messages