[web2py] Re: web2py book and softcron

2010-04-14 Thread AchipA
Yeah, fairly easy. One question though about the placement of the scripts. Most *nixes do this by placing the split files in a separate cron.d directory... Should we commandeer the cron directory for this, or rename it to cron.d (while keeping backward compatibility), put a cron.d inside cron

[web2py] Re: web2py book and softcron

2010-04-14 Thread mdipierro
I would just use the current cron folder if not objections On Apr 14, 3:16 am, AchipA attila.cs...@gmail.com wrote: Yeah, fairly easy. One question though about the placement of the scripts. Most *nixes do this by placing the split files in a separate cron.d directory... Should we commandeer

[web2py] Re: web2py book and softcron

2010-04-13 Thread AchipA
Hey, I don't have a problem with that, just saying the lock-and-read mechanism can increase the overhead/latency significantly in certain setups. If a two-file approach is a problem, would you consider avoiding the cPickle read if I can find a way to do it via setting ctime/mtime (we set a mtime

[web2py] Re: web2py book and softcron

2010-04-13 Thread mdipierro
I do not like very much the idea of setting ctime/mtime but I do not like the current mechanism either. It is not just the pickle overhead. There seem to be precision issues that make it difficult to skip exactly one minute. For example right now newcron contains: if startup or self.now - start

[web2py] Re: web2py book and softcron

2010-04-13 Thread AchipA
Technically, we don't need to nor are we required to skip *exactly* one minute. The real question is not 'has 60 seconds passed', but 'have we checked cron in this minute'. I would thus check not for a 60 sec offset, but rather if the minute of cron start matches. Also in line 51: s.enter(60 -

Re: [web2py] Re: web2py book and softcron

2010-04-13 Thread Thadeus Burgess
If we are working on cron can I inject a feature request? Support for multiple crontab files in applications/myapp/cron crontab, or plugin_hi.crontab can be read. Alpha order ? -- Thadeus On Tue, Apr 13, 2010 at 10:47 AM, AchipA attila.cs...@gmail.com wrote: Technically, we don't need to

[web2py] Re: web2py book and softcron

2010-04-13 Thread mdipierro
This an easier one. @Achipa, want to do this? On Apr 13, 10:49 am, Thadeus Burgess thade...@thadeusb.com wrote: If we are working on cron can I inject a feature request? Support for multiple crontab files in applications/myapp/cron crontab, or plugin_hi.crontab can be read. Alpha order ?

[web2py] Re: web2py book and softcron

2010-04-12 Thread AchipA
To correct myself, it seems the cron in web2py no longer uses the filesystem timestamps, but cPickles timestamps from/to the lock file. I'm not sure why Massimo changed it, but this *is* a bigger overhead than it was previously (as it needs to do file locking and cPickle.load() on every single

[web2py] Re: web2py book and softcron

2010-04-12 Thread mdipierro
Because they os timestamp only can only tell you when a task has started (or stopped, depending on when it was created) it does not contain enough information to give you a time range (time and stop). Cron needs to know when the previous crondance started and whether is was completed or not. The

[web2py] Re: web2py book and softcron

2010-04-12 Thread AchipA
Why do we need the time range ? If the tasks are overlapping it's their responsibility to handle that (I know this is arguable, but that's how 'standard' cron works). Also, we can easily store two timestamps (slightly hackish, but mtime and ctime can be set separately), would have to check whether

[web2py] Re: web2py book and softcron

2010-04-12 Thread mdipierro
On Apr 12, 1:19 pm, AchipA attila.cs...@gmail.com wrote: Why do we need the time range ? If the tasks are overlapping it's their responsibility to handle that (I know this is arguable, but that's how 'standard' cron works). This is also as it works in newcron. The problem is that if for any

[web2py] Re: web2py book and softcron

2010-04-02 Thread AchipA
There was talk about this a few months back, and I even have a dev branch that does exactly this. There *are* some concerns, that's why I have not yet submitted that to Massimo until I resolve GIL/locking/etc issues. On Apr 2, 12:07 am, Jonathan Lundell jlund...@pobox.com wrote: On Apr 1, 2010,

Re: [web2py] Re: web2py book and softcron

2010-04-02 Thread Jonathan Lundell
On Apr 2, 2010, at 12:25 PM, AchipA wrote: There was talk about this a few months back, and I even have a dev branch that does exactly this. There *are* some concerns, that's why I have not yet submitted that to Massimo until I resolve GIL/locking/etc issues. It also occurs to me that I can

[web2py] Re: web2py book and softcron

2010-04-02 Thread mdipierro
the process that checks for the crontab runs but it does not spawns additional processes if nothing to do. On Apr 2, 4:14 pm, Jonathan Lundell jlund...@pobox.com wrote: On Apr 2, 2010, at 12:25 PM, AchipA wrote: There was talk about this a few months back, and I even have a dev branch that

Re: [web2py] Re: web2py book and softcron

2010-04-02 Thread Jonathan Lundell
On Apr 2, 2010, at 5:18 PM, mdipierro wrote: the process that checks for the crontab runs but it does not spawns additional processes if nothing to do. Understood. But when it has something to do, if it's lightweight (like expiring sessions), why run another process ever? I'm only talking

[web2py] Re: web2py book and softcron

2010-04-02 Thread mdipierro
I agree. This should be an option but we do not have it yet. Massimo On Apr 2, 7:43 pm, Jonathan Lundell jlund...@pobox.com wrote: On Apr 2, 2010, at 5:18 PM, mdipierro wrote: the process that checks for the crontab runs but it does not spawns additional processes if nothing to do.

[web2py] Re: web2py book and softcron

2010-04-01 Thread AchipA
There is some overhead, but efficiency is a disputable term - there is certainly more overhead than hardcron, but IMO not in a way that would affect overall performance unless you're running it on a site that has hundreds of thousands of hits per day... On Apr 1, 5:40 pm, Jonathan Lundell

Re: [web2py] Re: web2py book and softcron

2010-04-01 Thread Jonathan Lundell
On Apr 1, 2010, at 10:37 AM, AchipA wrote: There is some overhead, but efficiency is a disputable term - there is certainly more overhead than hardcron, but IMO not in a way that would affect overall performance unless you're running it on a site that has hundreds of thousands of hits per

[web2py] Re: web2py book and softcron

2010-04-01 Thread AchipA
Exactly, hardcron checks once a minute, softcron checks on each page load. The 'check' is calling a function or two and comparing a file's timestamp, so not *that* much more expensive. On Apr 1, 7:51 pm, Jonathan Lundell jlund...@pobox.com wrote: On Apr 1, 2010, at 10:37 AM, AchipA wrote:

Re: [web2py] Re: web2py book and softcron

2010-04-01 Thread Jonathan Lundell
On Apr 1, 2010, at 11:20 AM, AchipA wrote: Exactly, hardcron checks once a minute, softcron checks on each page load. The 'check' is calling a function or two and comparing a file's timestamp, so not *that* much more expensive. Thanks. In that case, I have a suggestion, perhaps not entirely