Skip to content

Commit

Permalink
Allow upper case characters in simulation code names
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed May 26, 2023
1 parent 0fe1191 commit d8103b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pyiron_base/jobs/job/extension/executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(
module=None,
code=None,
overwrite_nt_flag=False,
enforce_lower_case=True
):
"""
Handle the path to the executable, as well as the version selection.
Expand All @@ -51,7 +52,10 @@ def __init__(
codename = code.__name__
module = code.__module__.split(".")[1]
if codename is not None and module is not None:
self.storage.name = codename.lower()
if enforce_lower_case:
self.storage.name = codename.lower()
else:
self.storage.name = codename
code_path_lst = [
os.path.join(path, module, "bin") for path in path_binary_codes
]
Expand All @@ -64,7 +68,10 @@ def __init__(
if os.path.exists(exe_path)
]
else: # Backwards compatibility
self.storage.name = codename.lower()
if enforce_lower_case:
self.storage.name = codename.lower()
else:
self.storage.name = codename
self.path_bin = [
os.path.join(path, self.storage.name)
for path in path_binary_codes
Expand Down
5 changes: 5 additions & 0 deletions pyiron_base/jobs/job/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def __init__(self, project, job_name):
self._process = None
self._compress_by_default = False
self._python_only_job = False
self._enforce_lower_case = True
self.interactive_cache = None
self.error = GenericError(job=self)

Expand Down Expand Up @@ -1288,12 +1289,14 @@ def _executable_activate(self, enforce=False, codename=None):
codename=codename,
module=codename,
path_binary_codes=None,
enforce_lower_case=self._enforce_lower_case
)
elif len(self.__module__.split(".")) > 1:
self._executable = Executable(
codename=self.__name__,
module=self.__module__.split(".")[-2],
path_binary_codes=None,
enforce_lower_case=self._enforce_lower_case
)
elif self.__module__ == "__main__":
# Special case when the job classes defined in Jupyter notebooks
Expand All @@ -1302,11 +1305,13 @@ def _executable_activate(self, enforce=False, codename=None):
codename=parent_class.__name__,
module=parent_class.__module__.split(".")[-2],
path_binary_codes=None,
enforce_lower_case=self._enforce_lower_case
)
else:
self._executable = Executable(
codename=self.__name__,
path_binary_codes=None,
enforce_lower_case=self._enforce_lower_case
)

def _type_to_hdf(self):
Expand Down

0 comments on commit d8103b2

Please sign in to comment.