Cron: Disabled because no file locking (on Windows)

233 views
Skip to first unread message

Iceberg

unread,
Apr 7, 2010, 2:21:45 AM4/7/10
to web2py-users
Hi pals,

Havn't used cron feature for quite some while, and knowing it has been
under refactoring in recent several major versions of web2py. Today I
try to pick it up, but then notice a warning message keeps showing up
on console.

C:>web2py -a1
WARNING:root:no file locking
Starting hardcron...
WARNING:root:WEB2PY CRON: Disabled because no file locking
WARNING:root:WEB2PY CRON: Disabled because no file locking

And none of my cron jobs is fired. This is not like the old days. Oh,
I miss them.

I am using web2py source version, latest trunk, by python 2.5, on a
Windows XP.


Then I digged into the code a little, and found that is because I do
not install python win32 extention, so gluon/portalockr.py defines
portalocker.LOCK_EX==None, and for some reason since 1Mar2010 (http://
code.google.com/p/web2py/source/detail?
r=5dd1e2b9c893ae04cba5af1d9b67dd79c2efed44&path=/gluon/contrib/
cron.py), cron.py requires a portalocker.LOCK_EX to work.

So question 1: Is LOCK_EX necessary for cron to work? What is the
downside if no lock is used? If the downside is acceptable (at least
during development phase on Windows platform), can we have a command
line option to simply turn off the lock check?
Before that, the workaround is to use the windows binary package of
web2py, which comes with the win32 extention inside.

Question 2: If LOCK_EX is somehow necessary, can we design another
lock mechanism to fully cross-platform? For example, use
threading.Lock instead. I know this can not cross-process, but perhaps
it serves as just a fallback option better than none.

Regards,
Iceberg

mdipierro

unread,
Apr 7, 2010, 2:30:53 AM4/7/10
to web2py-users
You need to install the win32 extensions. web2py without sessions may
cause data loss if you store data in sessions.
Reply all
Reply to author
Forward
0 new messages