Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Cancel threads after timeout

Reply
Thread Tools

Re: Cancel threads after timeout

 
 
Jason Ma
Guest
Posts: n/a
 
      01-27-2013
I am not sure which database you're using, but all the mainstream RDBMS is
server-client Architecture, when you're running one DML(including the
SELECT), the RDBMS setting up a server process, the query running in that
process instead of your client process, so I guess your problem can solved
in the database layer more elegant than in your program.
1. Investigate the reason why you're take more time
2. Find your DBA or yourself, setting the related parameters in the
database.
3. If possible, using some embedded language in the database (like PL/SQL
in Oracle), it is more convenient.

Regards,
Jason


2013/1/26 hyperboreean <(E-Mail Removed)>

> Here's the use case I want to implement - I have to generate a report
> from multiple database servers. This report should be generated every 2
> hours. Sometimes it happens that a query on one of the database servers
> takes longer than expected and impedes the generation of this report
> (that's right, the queries are ran sequential). What I am trying to
> achieve is to parallelize the queries on each database server and to be
> able to cancel one of them if it takes longer than X minutes.
> threading.Thread doesn't support this and seems that in
> general programming languages don't implement a way to cancel threads
> from the outside.
>
> Now, I've read all the stackoverflow threads about killing a thread,
> canceling a thread after a timeout, but all of them imply that you are
> able to check from within the thread if you should end the computation
> or not - that's not really my case, where the computation is a SQL
> query.
>
> So, what I have in mind is something like: the main loop starts a
> threading.Thread which in turn is responsible for starting another
> thread in which the actual computation happens (could be a
> threading.Thread or a multiprocessing.Process) *and* checks if the
> specified timeout has passed. If the time is up, it exits, letting the
> main loop know.
>
> Lots of words, no code - let me know if you have any suggestions, ideas
> to this rant.
>
> Thanks!
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>




--
Best wishes,

Jason Ma

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Cancel threads after timeout Cameron Simpson Python 0 01-27-2013 12:34 AM
Re: Cancel threads after timeout Matt Jones Python 0 01-26-2013 03:48 PM
Re: Cancel threads after timeout Jason Friedman Python 0 01-26-2013 03:43 PM
Cancel threads after timeout hyperboreean Python 0 01-26-2013 01:14 PM
HELP CANCEL CANCEL CANCEL Carmen Rosario Computer Support 7 04-06-2005 11:04 PM



Advertisments