diff --git a/docs/requirements.txt b/docs/requirements.txt index 26c5fac61..d1abb074d 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -5,5 +5,4 @@ sphinx_rtd_theme docutils myst-parser configargparse -appdirs -psutil \ No newline at end of file +appdirs \ No newline at end of file diff --git a/snakemake/benchmark.py b/snakemake/benchmark.py index 0e47905bf..b59c2a4ca 100644 --- a/snakemake/benchmark.py +++ b/snakemake/benchmark.py @@ -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