Commit 38789e94 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

ENH: add warning message if fslsub.info gets called more than 2 time

parent e01f95f8
...@@ -299,6 +299,12 @@ def info(job_ids) -> Dict[str, Optional[Dict[str, str]]]: ...@@ -299,6 +299,12 @@ def info(job_ids) -> Dict[str, Optional[Dict[str, str]]]:
:return: dictionary of jobid -> another dictionary with job information :return: dictionary of jobid -> another dictionary with job information
(or None if job does not exist) (or None if job does not exist)
""" """
if not hasattr(info, '_ncall'):
info._ncall = 0
info._ncall += 1
if info._ncall == 3:
warnings.warn("Please do not call `fslsub.info` repeatably, because it slows down the cluster. You can avoid this message by simply passing all the job IDs you are interested in to a single `fslsub.info` call.")
from fsl.utils.run import run from fsl.utils.run import run
job_ids_string = _flatten_job_ids(job_ids) job_ids_string = _flatten_job_ids(job_ids)
try: try:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment