Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37795
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'lines,': 0.05; 'bash': 0.07; 'abort': 0.09; 'compute': 0.09; 'pause': 0.09; 'cc:addr :python-list': 0.10; 'result.': 0.15; 'command,': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'investigate': 0.16; 'message- id:@cskk.homeip.net': 0.16; 'prepend': 0.16; 'query.': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:edu.au': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'simpson': 0.16; 'subject:threads': 0.16; 'wrote:': 0.17; 'pieces': 0.17; 'shell': 0.18; 'solution.': 0.18; 'equivalent': 0.20; 'proposed': 0.20; 'cheers,': 0.23; 'cc:2**0': 0.23; 'linux': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.28; 'run': 0.28; 'sleep': 0.29; 'query': 0.30; 'running': 0.32; 'problem': 0.33; '(with': 0.33; 'another': 0.33; 'done': 0.34; 'along': 0.35; 'jason': 0.35; 'something': 0.35; 'but': 0.36; 'received:au': 0.36; 'charset:us-ascii': 0.36; 'itself': 0.37; 'does': 0.37; 'option': 0.37; 'subject:: ': 0.38; 'your': 0.60; 'content- disposition:inline': 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 |
| Date | Mon, 28 Jan 2013 17:40:24 +1100 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | Jason Friedman <jsf80238@gmail.com> |
| Subject | Re: Cancel threads after timeout |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <CANy1k1ispAo5dV+W-ZOxV+2J58qXGq6UBjm=yeayC7rWWPii9A@mail.gmail.com> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <CANy1k1ispAo5dV+W-ZOxV+2J58qXGq6UBjm=yeayC7rWWPii9A@mail.gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1124.1359355238.2939.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1359355238 news.xs4all.nl 6879 [2001:888:2000:d::a6]:55761 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37795 |
Show key headers only | View raw
On 27Jan2013 21:57, Jason Friedman <jsf80238@gmail.com> wrote:
| > On 26Jan2013 09:48, Matt Jones <matt.walker.jones@gmail.com> 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.
I was thinking that if he does something equivalent to:
while :; do run-sql-query1-with-snapshot-of-result; sleep 900; done &
while :; do run-sql-query2-with-snapshot-of-result; sleep 900; done &
while :
do
report on latest pair of snapshots
sleep 7200
done
Then he doesn't need any timeouts.
Cheers,
--
Cameron Simpson <cs@zip.com.au>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Cancel threads after timeout Cameron Simpson <cs@zip.com.au> - 2013-01-28 17:40 +1100
csiph-web