Skip to content

Commit 696ff01

Browse files
author
chris-langfield
committed
test forcing subprocess for large_jobs
1 parent d1aac3f commit 696ff01

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

ibllib/pipes/ephys_tasks.py

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -656,32 +656,27 @@ def _run_iblsort(self, ap_file):
656656
_logger.info(f"job progress command: tail -f {temp_dir} *.log")
657657
temp_dir.mkdir(parents=True, exist_ok=True)
658658
check_nvidia_driver()
659-
try:
660-
# if pykilosort is in the environment, use the installed version within the task
661-
import iblsorter.ibl # noqa
662-
iblsorter.ibl.run_spike_sorting_ibl(bin_file=ap_file, scratch_dir=temp_dir)
663-
except ImportError:
664-
command2run = f"{self.SHELL_SCRIPT} {ap_file} {temp_dir}"
665-
_logger.info(command2run)
666-
process = subprocess.Popen(
667-
command2run,
668-
shell=True,
669-
stdout=subprocess.PIPE,
670-
stderr=subprocess.PIPE,
671-
executable="/bin/bash",
672-
)
673-
info, error = process.communicate()
674-
info_str = info.decode("utf-8").strip()
675-
_logger.info(info_str)
676-
if process.returncode != 0:
677-
error_str = error.decode("utf-8").strip()
678-
# try and get the kilosort log if any
679-
for log_file in temp_dir.rglob('*_kilosort.log'):
680-
with open(log_file) as fid:
681-
log = fid.read()
682-
_logger.error(log)
683-
break
684-
raise RuntimeError(f"{self.SPIKE_SORTER_NAME} {info_str}, {error_str}")
659+
command2run = f"{self.SHELL_SCRIPT} {ap_file} {temp_dir}"
660+
_logger.info(command2run)
661+
process = subprocess.Popen(
662+
command2run,
663+
shell=True,
664+
stdout=subprocess.PIPE,
665+
stderr=subprocess.PIPE,
666+
executable="/bin/bash",
667+
)
668+
info, error = process.communicate()
669+
info_str = info.decode("utf-8").strip()
670+
_logger.info(info_str)
671+
if process.returncode != 0:
672+
error_str = error.decode("utf-8").strip()
673+
# try and get the kilosort log if any
674+
for log_file in temp_dir.rglob('*_kilosort.log'):
675+
with open(log_file) as fid:
676+
log = fid.read()
677+
_logger.error(log)
678+
break
679+
raise RuntimeError(f"{self.SPIKE_SORTER_NAME} {info_str}, {error_str}")
685680

686681
shutil.copytree(temp_dir.joinpath('output'), sorter_dir, dirs_exist_ok=True)
687682
shutil.rmtree(temp_dir, ignore_errors=True)

0 commit comments

Comments
 (0)