Skip to content

Commit

Permalink
updated default values
Browse files Browse the repository at this point in the history
  • Loading branch information
drazendee committed Mar 5, 2021
1 parent 3e28d26 commit 1b14278
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def read_test_data():
info["parameters"],
info["inputs"],
info["step"]["name"],
info["step"]["image"] if 'image' in info["step"] else DEFAULT_DOCKER_IMAGE,
info["step"]["image"] if 'image' in info["step"] else None,
)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_yaml/test2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def prepare(a, b):
print(f"this is fake method {a} {b}")


valohai.prepare(step="foobar1", default_parameters=params, default_inputs=inputs, image="hope/thiswillnotchange:1234")
valohai.prepare(step="foobar1", default_parameters=params, default_inputs=inputs)
4 changes: 2 additions & 2 deletions valohai/internals/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from valohai_yaml.objs.base import Item
from valohai_yaml.utils.merge import merge_dicts, merge_simple

from valohai.consts import DEFAULT_DOCKER_IMAGE

def python_to_yaml_merge_strategy(original: Item, parsed: Item) -> Item:
"""Merging strategy in the valohai-utils AST parser use-case
Expand Down Expand Up @@ -74,8 +75,7 @@ def _merge_step(original: Step, parsed: Step) -> Step:
skip_missing_b=True,
)

if(parsed.image is not None) :
if(parsed.image is not None and parsed.image != DEFAULT_DOCKER_IMAGE) :
result.image = parsed.image


return result
3 changes: 2 additions & 1 deletion valohai/internals/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self):
self.parameters = {}
self.inputs = {}
self.step = None
self.image = DEFAULT_DOCKER_IMAGE
self.image = None

def visit_Assign(self, node):
try:
Expand Down Expand Up @@ -100,4 +100,5 @@ def parse(source):
parser = PrepareParser()
parser.visit(tree)
result = namedtuple("result", ["step", "parameters", "inputs", "image"])
print(result)
return result(step=parser.step, parameters=parser.parameters, inputs=parser.inputs, image=parser.image)

0 comments on commit 1b14278

Please sign in to comment.