Skip to content

Commit

Permalink
all mem recording to GB
Browse files Browse the repository at this point in the history
  • Loading branch information
sheffien committed Feb 9, 2016
1 parent afacd2d commit 142ef6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Documentation
*************
Pypiper's documentation is at http://pypiper.readthedocs.org/.

You can generate the documentation yourself, using ``make``. Just change your working directory to `doc` and run `make` to see available documentation formats *e.g.*: `make html`. The documentation will be produced under ``doc/build``.
You can generate the documentation using ``sphinx <http://www.sphinx-doc.org/en/stable/install.html>``. With sphinx installed, just change your working directory to `doc` and run `make` to see available documentation formats *e.g.*: `make html`. The documentation will be produced under ``doc/build``.

Testing
*************
Expand Down
14 changes: 7 additions & 7 deletions pypiper/pypiper.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,16 +479,16 @@ def callprint(self, cmd, shell=False, nofail=False):

while p.poll() is None:
if not shell:
local_maxmem = max(local_maxmem, self.memory_usage(p.pid))
local_maxmem = max(local_maxmem, self.memory_usage(p.pid)/1e6)
# print("int.maxmem (pid:" + str(p.pid) + ") " + str(local_maxmem))
time.sleep(sleeptime)
sleeptime = min(sleeptime + 5, 60)

returncode = p.returncode
info = "Process " + str(p.pid) + " returned: (" + str(p.returncode) + ")."
if not shell:
info += " Peak memory: (Process: " + str(local_maxmem) + "kB;"
info += " Pipeline: " + str(self.peak_memory) + "kB)"
info += " Peak memory: (Process: " + str(round(local_maxmem, 3)) + "GB;"
info += " Pipeline: " + str(round(self.peak_memory, 3)) + "GB)"
# Close the preformat tag for markdown output
print("</pre>")
print(info)
Expand Down Expand Up @@ -524,7 +524,7 @@ def wait_for_process(self, p, shell=False):
sleeptime = .5
while p.poll() is None:
if not shell:
local_maxmem = max(local_maxmem, self.memory_usage(p.pid))
local_maxmem = max(local_maxmem, self.memory_usage(p.pid) / 1e6)
# print("int.maxmem (pid:" + str(p.pid) + ") " + str(local_maxmem))
time.sleep(sleeptime)
sleeptime = min(sleeptime + 5, 60)
Expand All @@ -534,8 +534,8 @@ def wait_for_process(self, p, shell=False):

info = "Process " + str(p.pid) + " returned: (" + str(p.returncode) + ")."
if not shell:
info += " Peak memory: (Process: " + str(local_maxmem) + "kB;"
info += " Pipeline: " + str(self.peak_memory) + "kB)"
info += " Peak memory: (Process: " + str(round(local_maxmem,3)) + "GB;"
info += " Pipeline: " + str(round(self.peak_memory,3)) + "GB)"

print(info + "\n")
if p.returncode != 0:
Expand Down Expand Up @@ -683,7 +683,7 @@ def stop_pipeline(self):
print("\n##### [Epilogue:]")
print("* " + "Total elapsed time".rjust(20) + ": " + str(self.time_elapsed(self.starttime)))
# print("Peak memory used: " + str(memory_usage()["peak"]) + "kb")
print("* " + "Peak memory used".rjust(20) + ": " + str(self.peak_memory / 1e6) + " GB")
print("* " + "Peak memory used".rjust(20) + ": " + str(round(self.peak_memory, 2)) + " GB")
self.timestamp("* Pipeline completed at: ".rjust(20))

def fail_pipeline(self, e):
Expand Down

0 comments on commit 142ef6a

Please sign in to comment.