List Info

Thread: Running Scheduled functions in Cherrypy




Running Scheduled functions in Cherrypy
user name
2006-03-30 18:36:13
ingoognigmail.com wrote:
> Robert Brewer wrote:
> 
> > Dejavu includes that module, but it's designed
and distributed as a
> > standalone. See http://proje
cts.amor.org/misc/wiki/Recur
> 
> Off topic for Cherrypy, but related to the subject,
> 
> Is there a simple sample somewhere that shows a not so 
> confident Python
> user, like me, how to use the recur module?
> 
> I'd like to use it to make time lapse movies. For
example, take an
> image every 30 minutes between 7.00 and 17.00 on each 
> work-day and none in the weekend.

Wow, that's complicated! ;) The recur module doesn't do
compound
schedules; you'd have to combine those three requirements
yourself,
either with nested workers, or with a single worker that
just ignores
invalid datetimes. For example, I'd probably write:

    class MovieWorker(recur.Worker):
        def work(self):
            if (self.nextrun.day not in (5, 6) 
                and (7 < self.nextrun.hour < 17)):
                take_frame()

    mw = MovieWorker("30 minutes")

You could also pass the (5, 6) and (7, 17) bounds as
arguments to the
worker, if you needed that flexibility. Normal Python rules
still apply.
;)


Robert Brewer
System Architect
Amor Ministries
fumanchuamor.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Running Scheduled functions in Cherrypy
user name
2006-03-30 21:08:33

Robert Brewer wrote:
> ingoognigmail.com wrote:

> > I'd like to use it to make time lapse movies.
>
> Wow, that's complicated! ;) The recur module doesn't
do compound
> schedules;

Rob C.'s code gave me a head start, thanks for that Rob,
and the
"first" thing I did was to crash into that wall
....

> you'd have to combine those three requirements
yourself,
> either with nested workers, or with a single worker
that just ignores
> invalid datetimes. For example, I'd probably write:
> [...]

.... and then you appear to push me in the right direction.
I'll have
to 'schedule' a bit more Python-time this weekend.

Thanks,

Ingo


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Running Scheduled functions in Cherrypy
user name
2006-04-24 12:19:53
http://proje
cts.amor.org/misc/wiki/Recur

Haven't been able to reach that URL.  ? if project exists
at another location.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )