Skip to content

Commit

Permalink
fix converter version listing command
Browse files Browse the repository at this point in the history
  • Loading branch information
TorecLuik committed Jun 20, 2024
1 parent e2e610f commit abe5302
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions biomero/slurm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class SlurmClient(Connection):
_DEFAULT_SLURM_GIT_SCRIPT_PATH = "slurm-scripts"
_OUT_SEP = "--split--"
_VERSION_CMD = "ls -h \"{slurm_images_path}/{image_path}\" | grep -oP '(?<=\-|\_)(v.+|latest)(?=.simg|.sif)'"
_CONVERTER_VERSION_CMD = "ls -h \"{converter_path}\" | grep -oP '(convert_.+)(?=.simg|.sif)' | awk '{n=split($0, a, \"_\"); last=a[n]; sub(\"_\"last\"$\", \"\", $0); print $0, last}'"
_CONVERTER_VERSION_CMD = "ls -h \"{converter_path}\" | grep -oP '(convert_.+)(?=.simg|.sif)' | awk '{{n=split($0, a, \"_\"); last=a[n]; sub(\"_\"last\"$\", \"\", $0); print $0, last}}'"
# Note, grep returns exitcode 1 if no match is found!
# This will translate into a UnexpectedExit error, so mute that if you
# don't care about empty.
Expand Down Expand Up @@ -498,8 +498,10 @@ def list_available_converter_versions(self) -> Dict:
cmd = self._CONVERTER_VERSION_CMD.format(
converter_path=self.slurm_converters_path),
r = self.run_commands([cmd])
# split lines further into a k,v dict
result_dict = {line.rsplit(' ', 1)[0]: line.rsplit(' ', 1)[1] for line in r.split('\n')}
result_dict = {}
if r.ok:
# split lines further into a k,v dict
result_dict = {line.rsplit(' ', 1)[0]: line.rsplit(' ', 1)[1] for line in r.stdout.strip().split('\n')}
return result_dict

def setup_converters(self):
Expand Down

0 comments on commit abe5302

Please sign in to comment.