Skip to content
Permalink
Browse files
fix: fix a bug leading to duplicate conda env initializations; fix di…
…splay of jobs and output files with changes
  • Loading branch information
johanneskoester committed Mar 2, 2022
1 parent 4607232 commit 994b1510766083df7f22d10c0e6e4bb65ffdd710
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
@@ -282,6 +282,7 @@ def create_conda_envs(
for job in jobs
if job.conda_env_spec and (self.workflow.run_local or job.is_local)
}

# Then based on md5sum values
self.conda_envs = dict()
for (env_spec, simg_url) in env_set:
@@ -696,6 +696,14 @@ def is_file(self):
def contains_wildcard(self):
...

@abstractmethod
def __hash__(self):
...

@abstractmethod
def __eq__(self):
...


class CondaEnvFileSpec(CondaEnvSpec):
def __init__(self, filepath: str, rule=None):
@@ -731,6 +739,12 @@ def is_file(self):
def contains_wildcard(self):
return contains_wildcard(self.file)

def __hash__(self):
return hash(self.file)

def __eq__(self, other):
return self.file == other.file


class CondaEnvNameSpec(CondaEnvSpec):
def __init__(self, name: str):
@@ -756,6 +770,12 @@ def check(self):
def contains_wildcard(self):
return contains_wildcard(self.name)

def __hash__(self):
return hash(self.name)

def __eq__(self, other):
return self.name == other.name


def is_conda_env_file(spec: str):
return spec.endswith(".yaml") or spec.endswith(".yml")
@@ -323,36 +323,40 @@ def code(self, path):
return self.metadata(path).get("code")

def version_changed(self, job, file=None):
"""Yields output files with changed versions of bool if file given."""
"""Yields output files with changed versions or bool if file given."""
return _bool_or_gen(self._version_changed, job, file=file)

def code_changed(self, job, file=None):
"""Yields output files with changed code of bool if file given."""
"""Yields output files with changed code or bool if file given."""
return _bool_or_gen(self._code_changed, job, file=file)

def input_changed(self, job, file=None):
"""Yields output files with changed input of bool if file given."""
"""Yields output files with changed input or bool if file given."""
return _bool_or_gen(self._input_changed, job, file=file)

def params_changed(self, job, file=None):
"""Yields output files with changed params of bool if file given."""
"""Yields output files with changed params or bool if file given."""
return _bool_or_gen(self._params_changed, job, file=file)

def _version_changed(self, job, file=None):
assert file is not None
return self.version(file) != job.rule.version
recorded = self.version(file)
return recorded is not None and recorded != job.rule.version

def _code_changed(self, job, file=None):
assert file is not None
return self.code(file) != self._code(job.rule)
recorded = self.code(file)
return recorded is not None and recorded != self._code(job.rule)

def _input_changed(self, job, file=None):
assert file is not None
return self.input(file) != self._input(job)
recorded = self.input(file)
return recorded is not None and recorded != self._input(job)

def _params_changed(self, job, file=None):
assert file is not None
return self.params(file) != self._params(job)
recorded = self.params(file)
return recorded is not None and recorded != self._params(job)

def noop(self, *args):
pass

0 comments on commit 994b151

Please sign in to comment.