Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: forking and avoiding zombies!

Reply
Thread Tools

Re: forking and avoiding zombies!

 
 
andrea crotti
Guest
Posts: n/a
 
      12-11-2012
2012/12/11 peter <(E-Mail Removed)>:
> 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..
 
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: forking and avoiding zombies! andrea crotti Python 1 12-12-2012 03:23 PM
Re: forking and avoiding zombies! peter Python 0 12-11-2012 12:33 PM
Re: forking and avoiding zombies! andrea crotti Python 0 12-11-2012 11:47 AM
Re: forking and avoiding zombies! peter Python 0 12-10-2012 05:00 PM
forking and avoiding zombies! andrea crotti Python 0 12-10-2012 03:42 PM



Advertisments