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.
>
> Understood. But when it has something to do, if it's lightweight (like 
> expiring sessions), why run another process ever?
>
> I'm only talking about trivial tasks, but if you don't need cron 
> functionality for anything but trivial tasks....
>
>
>
> > 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 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 accomplish the same thing (though not 
> >> through crontab) by expiring sessions through a model file. Touch an empty 
> >> file in sessions/ to use as a timestamp, and when its mtime is more than 
> >> an hour old, run the expiry logic.
>
> >> BTW, does cron run if there's no crontab?
>
> >>> On Apr 2, 12:07 am, Jonathan Lundell <jlund...@pobox.com> wrote:
> >>>> 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 thought out. If 
> >>>> cron is being used only for something relatively simple, say 
> >>>> expire_sessions.py, how about a kind of 'cron lite' that runs its tasks 
> >>>> in the context of an application rather than spawning an entirely new 
> >>>> instance of python+web2py to do the work?
>
> >>>> At the point where softcron is invoked, at the end of a request, if 
> >>>> we're running in litecron mode, process only the crontab file for the 
> >>>> current app, and run the cron tasks more or less as if they were models 
> >>>> (that is, exec in environment).
>
> >>>>> On Apr 1, 7:51 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
> >>>>>> 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 day...
>
> >>>>>> Perhaps we could change (or eliminate) the wording. How about simply 
> >>>>>> 'Using softcron'?
>
> >>>>>> I'm curious: what is the extra overhead of soft vs hard cron? Just 
> >>>>>> that it does a test on each page access? I'm guessing that's pretty 
> >>>>>> cheap.
>
> >>>>>>> On Apr 1, 5:40 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
> >>>>>>>> Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't 
> >>>>>>>> say how to override them.
>
> >>>>>>>> Section 4.1 (cli) doesn't list --softcron
>
> >>>>>>>> The startup message for soft cron says: 'Using softcron (but this is 
> >>>>>>>> not very efficient)'
>
> >>>>>>>> In what sense "not efficient"? I understand that the timing is less 
> >>>>>>>> consistent, but is there really more overhead? softcron seems like a 
> >>>>>>>> pretty reasonable choice if all you're doing it deleting expired 
> >>>>>>>> sessions.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to