Timeout

66 views
Skip to first unread message

jay_t

unread,
Feb 2, 2012, 10:56:44 AM2/2/12
to apsch...@googlegroups.com
Hi,

I was wondering whether there's a mechanism which provides a timeout for a running job?
I think the scheduler itself is the right place to have this functionality.

Cheers,

Jay

Alex Grönholm

unread,
Feb 2, 2012, 8:15:37 PM2/2/12
to apsch...@googlegroups.com
And what do you propose the scheduler do when this timeout occurs?

jay_t

unread,
Feb 3, 2012, 11:27:43 AM2/3/12
to apsch...@googlegroups.com
Hi Alex,

Kill the running job, ...


Alex Grönholm

unread,
Feb 3, 2012, 7:07:54 PM2/3/12
to apsch...@googlegroups.com
03.02.2012 18:27, jay_t kirjoitti:
> Hi Alex,
>
> Kill the running job, ...
>
>
How do you "kill" a running thread?

jay_t

unread,
Feb 4, 2012, 5:02:45 PM2/4/12
to apsch...@googlegroups.com
How do you "kill" a running thread?

I'm aware that killing threads is bad practice and somehow problematic as they might have other threads by themselves or have filedescriptors open and what not.
Yet, ... if one has a job which is running too long (or for ever) it might be desirable to take action, whatever that is.
Maybe offering a callback function which is called when the timeout occurs?  This way one needs not to build a timeout function in the function which is executed by the scheduler, ....

Just a though,

Cheers,

J

Alex Grönholm

unread,
Feb 4, 2012, 8:48:49 PM2/4/12
to apsch...@googlegroups.com
05.02.2012 00:02, jay_t kirjoitti:
How do you "kill" a running thread?

I'm aware that killing threads is bad practice and somehow problematic as they might have other threads by themselves or have filedescriptors open and what not.
Killing a thread is outright impossible. There is no such function.

Yet, ... if one has a job which is running too long (or for ever) it might be desirable to take action, whatever that is.
Maybe offering a callback function which is called when the timeout occurs?  This way one needs not to build a timeout function in the function which is executed by the scheduler, ....
Well, I could add a timeout event which you could listen to. Would that work for you?

jay_t

unread,
Feb 4, 2012, 9:33:14 PM2/4/12
to apsch...@googlegroups.com
Well, I could add a timeout event which you could listen to. Would that work for you?

Yes that might be helpful.

Thanks a lot. 

Jay

Alex Grönholm

unread,
Feb 4, 2012, 10:37:03 PM2/4/12
to apsch...@googlegroups.com
I'm still having doubts. People will expect the job to stop when it reaches timeout -- it's only natural.
In your case, what did you plan to do in response to the timeout event?

jay_t

unread,
Feb 20, 2012, 5:58:27 PM2/20/12
to apsch...@googlegroups.com
yeah, makes sense.
I was initially hoping that a running thread could be killed if it's running longer than X seconds.  But this doesn't appear to be possible in a sound way.

One could do something like

while timeout == False: do_stuff()

but then again, this could be easily done within the function/class itself, so maybe apscheduler isn't the right place for it.

Cheers,
Reply all
Reply to author
Forward
0 new messages