Skip to content
Permalink
Browse files
docs: move psutil import into benchmark methods to avoid needing it a…
…s a dependency for doc building
  • Loading branch information
johanneskoester committed Nov 26, 2021
1 parent 6f1ff31 commit 6ffe38d1740294a7170765ab875b363f4ae82cd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
@@ -5,5 +5,4 @@ sphinx_rtd_theme
docutils
myst-parser
configargparse
appdirs
psutil
appdirs
@@ -11,8 +11,6 @@
import time
import threading

import psutil

from snakemake.exceptions import WorkflowError


@@ -192,6 +190,7 @@ class BenchmarkTimer(ScheduledPeriodicTimer):
"""Allows easy observation of a given PID for resource usage"""

def __init__(self, pid, bench_record, interval=BENCHMARK_INTERVAL):
import psutil
ScheduledPeriodicTimer.__init__(self, interval)
#: PID of observed process
self.pid = pid
@@ -203,6 +202,7 @@ def __init__(self, pid, bench_record, interval=BENCHMARK_INTERVAL):

def work(self):
"""Write statistics"""
import psutil
try:
self._update_record()
except psutil.NoSuchProcess:
@@ -212,6 +212,7 @@ def work(self):

def _update_record(self):
"""Perform the actual measurement"""
import psutil
# Memory measurements
rss, vms, uss, pss = 0, 0, 0, 0
# I/O measurements

0 comments on commit 6ffe38d

Please sign in to comment.