Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34618
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.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 | <andrea.crotti.0@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'output': 0.04; 'debug': 0.05; 'os.getcwd()': 0.09; 'part,': 0.09; 'cc:addr:python-list': 0.10; 'chdir': 0.16; 'process?': 0.16; 'subject:avoiding': 0.16; 'wrote:': 0.17; 'directory.': 0.17; 'pfxlen:0': 0.17; 'skip': 0.17; 'shell': 0.18; 'module': 0.19; 'suggested': 0.20; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'logging': 0.27; 'message-id:@mail.gmail.com': 0.27; 'parent': 0.29; 'this.': 0.29; 'maybe': 0.29; "skip:' 10": 0.30; 'function': 0.30; 'file': 0.32; 'launch': 0.32; 'directory,': 0.33; 'another': 0.33; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'useful': 0.36; 'should': 0.36; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'sure': 0.38; 'where': 0.40; 'header:Received:5': 0.40; 'andrea': 0.84; 'skip:/ 30': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Pf3usR587oIPDS/AE7PtDgqYTyQR+6WYL4AcIA2rIyE=; b=sRqAm9IIigyClo5E8WRMUng4taeWt/g4aj6lqIIHhJ1PYCcXm27zET+NhvCFIJbaPw ry2/Grz7Ef+YrgVXHF0RR/hnaffmxyblyAY+3MEj4Pj2dzTzE3ixZBOOKs1ROjFC0Rqa GbZMbq9FT/4U2qU9lin0FK6gINx6LBZ2fYIrmkd+8UHWg7ATeymIQsTTMaYtaRFbX2nj zwOWM3lf6PM/c6XKdl8o4YwEEVdQ8PQvQuAVnJwCM24nPhtEckC0/Ydo+VOq+hL1xj79 UOOFIYd29K6gUAVfQc6aZfb/sHa5Y+GPDNxbccFDTepIHIzc01xIRMW3N/9Zo1oT2N4S e2pA== |
| MIME-Version | 1.0 |
| In-Reply-To | <50C7365F.20908@gmail.com> |
| References | <CAF_E5JbjkWfjyCg3HwuQLekzqm=8c7X9iR=D0rZF+ekr4WcEPw@mail.gmail.com> <50C6153F.8050205@gmail.com> <CAF_E5JbPa9gb_a7o1ZgwaNfhu_ycz+CdnMCvhDe2VC8Dy5WAgA@mail.gmail.com> <50C7282B.8000708@gmail.com> <CAF_E5JZfqEsxxfCoE_TzOAxjPhwgzFe+M_MmwBUwHURdVGZLKQ@mail.gmail.com> <50C7365F.20908@gmail.com> |
| Date | Tue, 11 Dec 2012 13:57:03 +0000 |
| Subject | Re: forking and avoiding zombies! |
| From | andrea crotti <andrea.crotti.0@gmail.com> |
| To | peter <pjmakey2@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | 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.726.1355234225.29569.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1355234225 news.xs4all.nl 6866 [2001:888:2000:d::a6]:59363 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:34618 |
Show key headers only | View raw
2012/12/11 peter <pjmakey2@gmail.com>: > On 12/11/2012 10:25 AM, andrea crotti wrote: >> >> Ah sure that makes sense! >> >> But actually why do I need to move away from the current directory of >> the parent process? >> In my case it's actually useful to be in the same directory, so maybe >> I can skip that part, >> or otherwise I need another chdir after.. > > You don't need to move away from the current directory. You cant use os to > get the current work directory > > stderrfile = '%s/error.log' % os.getcwd() > stdoutfile = '%s/out.log' % os.getcwd() > > then call the daemon function like this. > > daemonize(stdout=stdoutfile, stderr=stderrfile) But the nice thing now is that all the forked processes log also on stdout/stderr, so if I launch the parent in the shell I get DEBUG -> csim_flow.worker[18447]: Moving the log file /user/sim/tests/batch_pdump_records/running/2012_12_11_13_4_10.log to /user/sim/tests/batch_pdump_records/processed/2012_12_11_13_4_10.log DEBUG -> csim_flow.area_manager[19410]: No new logs found in /user/sim/tests/batch_pdump_records where in [] I have the PID of the process. In this suggested way I should use some other files as standard output and error, but for that I already have the logging module that logs in the right place..
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: forking and avoiding zombies! andrea crotti <andrea.crotti.0@gmail.com> - 2012-12-11 13:57 +0000
csiph-web