Source code for pycif.plugins.platforms.empa_daint.utils
from logging import warn
import os
import subprocess
[docs]
def n_jobs_running(self):
"""Return the number of jobs running at the moment for the user."""
# Asks the queue how many jobs are still running
process = subprocess.Popen(
self.SQUEUE_CMD,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
stdout, stderr = process.communicate()
if stderr != b"":
raise RuntimeError(
"Could not run squeue because of error \n"
+ stderr.decode('utf-8')
)
# 1 line is used for the title and one is extra from the split
return len(stdout.decode('utf-8').split("\n")) - 2