Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'lines,': 0.05; 'bash': 0.07; 'abort': 0.09; 'compute': 0.09; 'pause': 0.09; 'result.': 0.15; 'command,': 0.16; 'investigate': 0.16; 'prepend': 0.16; 'query.': 0.16; 'subject:threads': 0.16; 'wrote:': 0.17; 'pieces': 0.17; 'shell': 0.18; 'solution.': 0.18; 'proposed': 0.20; 'to:name :python-list@python.org': 0.20; 'linux': 0.24; 'header:In-Reply- To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'run': 0.28; 'query': 0.30; 'running': 0.32; 'problem': 0.33; 'to:addr:python- list': 0.33; '(with': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'along': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'itself': 0.37; 'does': 0.37; 'option': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'your': 0.60; 'real': 0.61; 'spending': 0.61; 'latest': 0.61; 'between': 0.63; 'limit': 0.65; 'regularly': 0.65; 'life': 0.66; 'sounds': 0.71; 'snapshot': 0.84; 'snapshots': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=kDQ3n24E/xA0YkO9s4zkyZfJbPWfDNfJlkHciEsKojM=; b=qIn+iKQ/R9VOujX/5Kgq3WfXzEw0EbWvS6tv2zwv8ONdkW9hEjSSfkB9P2NRNjxk/f IflOHhbjkrjhlU2CGPi/viK51HhH90MFaTmzkFfi9H5lRW7v9srEN2sgSUYnivGuYoAj jaH9d5V/s3y1UlrewyOEtE0imj42xyL/TpqX9bu4aP1g5Nc1XE6S85aNq4YrWy3vm2QM rwT6ZPwRZRzjXEV88WOlp3tscyV5xTSuYi8UxOe8r1rJEyzXQFiAqA8liPbAUAIGLge+ JnVr4asWl0kBer/zP7Dh3qXOLV8ogYWFTRRbFlvtKQpAuyydZ6iIgOJcNeTPYT5MudiG mtMw== MIME-Version: 1.0 X-Received: by 10.204.3.211 with SMTP id 19mr3582809bko.99.1359349034549; Sun, 27 Jan 2013 20:57:14 -0800 (PST) In-Reply-To: <20130127003413.GA21696@cskk.homeip.net> References: <20130127003413.GA21696@cskk.homeip.net> Date: Sun, 27 Jan 2013 21:57:14 -0700 Subject: Re: Cancel threads after timeout From: Jason Friedman To: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1359349042 news.xs4all.nl 6949 [2001:888:2000:d::a6]:46236 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37794 > On 26Jan2013 09:48, Matt Jones wrote: > | It sounds like your real problem is with your SQL query... Is that part of > | this problem under your control? Can you break the query into smaller, > | quicker, pieces that you can run in a reasonable amount of time? > > Another option to investigate is whether you can ask the database itself > to limit the run time of a query. Of course, that will abort the query > but so does your proposed solution. > > Another approach might be to simply run each query regularly (with a > pause between so the database is not spending its whole life running > your query). Snapshot each latest result. Compute your report from the > latest pair of snapshots at any given time on an independent schedule. > It may not be valid for what you need, but if it is then this decouples > you from the query time completely. Along these lines, if you are running on Linux then the bash shell comes with a "timeout" command, which you can prepend to snapshot requests.