how to schedule a job using tornado?

138 views
Skip to first unread message
Message has been deleted

aliane abdelouahab

unread,
Oct 10, 2012, 6:02:46 PM10/10/12
to Tornado Web Server
hi,
sorry for this queston ;)
here is the code:

if time = 18:00 pm, then print "hello"

so i guess, verifying time in a regular way, will consume ressources?
so do i use a separated thread only redicated to checking if it's time
to print "hello"? there is no shared ressources, since i use a
database call, that will post a message only at a given time.

is it possible?

Jean Chassoul

unread,
Oct 10, 2012, 6:41:45 PM10/10/12
to python-...@googlegroups.com
Hi,

have you checked the documentation?

I think the timeouts section it's what you're looking for...

Regards,
Jean

aliane abdelouahab

unread,
Oct 10, 2012, 6:52:20 PM10/10/12
to Tornado Web Server
then i must use a special thread for listening to time and waiting
till the 18:00 gets? and do i receivre a confirmatio that the
operation has done correctly? because if i automate it, imagine that
at 17:59 there is a bug on the machine, and it will restarts at
18:01 !!!!

On 10 oct, 23:41, Jean Chassoul <chass...@gmail.com> wrote:
> Hi,
>
> have you checked the documentation?http://www.tornadoweb.org/documentation/ioloop.html
>
> I think the timeouts section it's what you're looking for...
>
> Regards,
> Jean
>
> On Wed, Oct 10, 2012 at 4:02 PM, aliane abdelouahab <alabdeloua...@gmail.com

Lorenzo Bolla

unread,
Oct 11, 2012, 4:45:31 AM10/11/12
to python-...@googlegroups.com
On Wed, Oct 10, 2012 at 11:52 PM, aliane abdelouahab <alabde...@gmail.com> wrote:
then i must use a special thread for listening to time and waiting
till the 18:00 gets? and do i receivre a confirmatio that the
operation has done correctly? because if i automate it, imagine that
at 17:59 there is a bug on the machine, and it will restarts at
18:01 !!!!

No threads. What about this (pseudocode):

add_timeout(datetime("when you want your operation to kick in") - datetime.now(), operation)

L.

aliane abdelouahab

unread,
Oct 11, 2012, 6:57:57 AM10/11/12
to Tornado Web Server
mmmmmmmmmm, it seems to be useful, but to be honest, i dident
understand... am a beginner and my mind works with blueprints (def
foo: print bar ).

On 11 oct, 09:45, Lorenzo Bolla <lbo...@gmail.com> wrote:
> On Wed, Oct 10, 2012 at 11:52 PM, aliane abdelouahab <
>

Jimmy

unread,
Oct 11, 2012, 9:39:01 AM10/11/12
to python-...@googlegroups.com
IOLoop.instance().add_timeout( Time you want to time out in datetime type. )

aliane abdelouahab

unread,
Oct 11, 2012, 10:21:13 AM10/11/12
to Tornado Web Server
and how it is behaving? do it control the time each X seconds? how
much this value X?

Lorenzo Bolla

unread,
Oct 11, 2012, 11:26:24 AM10/11/12
to python-...@googlegroups.com
On Thu, Oct 11, 2012 at 3:21 PM, aliane abdelouahab <alabde...@gmail.com> wrote:
and how it is behaving? do it control the time each X seconds? how
much this value X?


Check these out:
and

Timeouts are stored in a heap (self._timeouts). At each IOLoop iteration, the most urgent timeout is checked out from the heap and executed (if its time has come).

L.

aliane abdelouahab

unread,
Oct 11, 2012, 11:38:55 AM10/11/12
to Tornado Web Server
ah! so for each "Loop" time is checked!
thank you :)

On 11 oct, 16:26, Lorenzo Bolla <lbo...@gmail.com> wrote:
> On Thu, Oct 11, 2012 at 3:21 PM, aliane abdelouahab <alabdeloua...@gmail.com
>
> > wrote:
> > and how it is behaving? do it control the time each X seconds? how
> > much this value X?
>
> Check these out:http://www.tornadoweb.org/documentation/_modules/tornado/ioloop.html#...
> andhttp://www.tornadoweb.org/documentation/_modules/tornado/ioloop.html#...
Reply all
Reply to author
Forward
0 new messages