Skip to content

Commit

Permalink
Revert "test forcing subprocess for large_jobs"
Browse files Browse the repository at this point in the history
This reverts commit 31ff95d.
  • Loading branch information
chris-langfield committed Aug 19, 2024
1 parent 696ff01 commit 81481d0
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions ibllib/pipes/ephys_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,27 +656,32 @@ def _run_iblsort(self, ap_file):
_logger.info(f"job progress command: tail -f {temp_dir} *.log")
temp_dir.mkdir(parents=True, exist_ok=True)
check_nvidia_driver()
command2run = f"{self.SHELL_SCRIPT} {ap_file} {temp_dir}"
_logger.info(command2run)
process = subprocess.Popen(
command2run,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
executable="/bin/bash",
)
info, error = process.communicate()
info_str = info.decode("utf-8").strip()
_logger.info(info_str)
if process.returncode != 0:
error_str = error.decode("utf-8").strip()
# try and get the kilosort log if any
for log_file in temp_dir.rglob('*_kilosort.log'):
with open(log_file) as fid:
log = fid.read()
_logger.error(log)
break
raise RuntimeError(f"{self.SPIKE_SORTER_NAME} {info_str}, {error_str}")
try:
# if pykilosort is in the environment, use the installed version within the task
import iblsorter.ibl # noqa
iblsorter.ibl.run_spike_sorting_ibl(bin_file=ap_file, scratch_dir=temp_dir)
except ImportError:
command2run = f"{self.SHELL_SCRIPT} {ap_file} {temp_dir}"
_logger.info(command2run)
process = subprocess.Popen(
command2run,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
executable="/bin/bash",
)
info, error = process.communicate()
info_str = info.decode("utf-8").strip()
_logger.info(info_str)
if process.returncode != 0:
error_str = error.decode("utf-8").strip()
# try and get the kilosort log if any
for log_file in temp_dir.rglob('*_kilosort.log'):
with open(log_file) as fid:
log = fid.read()
_logger.error(log)
break
raise RuntimeError(f"{self.SPIKE_SORTER_NAME} {info_str}, {error_str}")

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

0 comments on commit 81481d0

Please sign in to comment.