These are chat archives for lamerman/shellpy

29th
Feb 2016
Naresh Ghanate
@gnaresh
Feb 29 2016 06:34

@lamerman I want the time and memory usage of the child process. in this case 'echo someword' which was launched by /bin/sh.

For your reference, I am using:

Subprocess.Popen('python code.py < input.txt 1> output.txt 2> error.txt', <args>)

I want the time and memory consumed by 'python code.py < input.txt 1> output.txt 2> error.txt'

Naresh Ghanate
@gnaresh
Feb 29 2016 06:46
also can we limit the time of execution for the same command using shellpy? (I used resource setrlimit to limit memory of execution, thread to limit time of execution) and return the signal code based on exit status.
Nik
@nikudalov
Feb 29 2016 12:45
This message was deleted
lamerman
@lamerman
Feb 29 2016 22:17
@gnaresh I tried to find a simple way to get pid in subprocess but could not find it :( You can get pid of the /bin/sh but not the process that it runs. It is possible to traverse the tree of child processes of this sh, but it is not yet implemented.
Things like limits for execution and memory at first glance should be set somehow inside of shell, not by shellpython, I think. So if there is a command that can limit memory it should be used then.
lamerman
@lamerman
Feb 29 2016 22:23
time mesurements should look like
result = `time python compute.py
so, not by means of shellpy but by means of other tools and internals of the script you run