Skip to content

Commit

Permalink
avoid race condition with argo-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
savingoyal committed Oct 18, 2023
1 parent 0c49524 commit 60a40fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion metaflow/plugins/pypi/conda_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def step_init(self, flow, graph, step, decos, environment, flow_datastore, logge

environment.set_local_root(LocalStorage.get_datastore_root_from_config(logger))

self.disabled = not self.environment.get_environment(
self.disabled = self.environment.is_disabled(
next(step for step in self.flow if step.name == self.step)
)

Expand Down
9 changes: 9 additions & 0 deletions metaflow/plugins/pypi/conda_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ def interpreter(self, step_name):
# User workloads are executed through the conda environment's interpreter.
return self.solvers["conda"].interpreter(id_)

def is_disabled(self, step):
for decorator in step.decorators:
# @conda decorator is guaranteed to exist thanks to self.decospecs
if decorator.name in ["conda", "pypi"]:
# handle @conda/@pypi(disabled=True)
disabled = decorator.attributes["disabled"]
return disabled or str(disabled).lower() != "false"
return False

@functools.lru_cache(maxsize=None)
def get_environment(self, step):
environment = {}
Expand Down

0 comments on commit 60a40fe

Please sign in to comment.