valohai / valohai-utils

Python helper library for Valohai
MIT License
2 stars 2 forks source link

Consider prioiritizing Python-defined parameters #126

Open tarekoraby opened 7 months ago

tarekoraby commented 7 months ago

Today, if a default parameter is defined differently in Python code than in valohai.yaml, the latter's value takes precedence over the former. However, my guess is that most developers would prefer it if things worked the other way around (i.e., parameters defined in Python code would take precedence over everything else).

For example, if I have

my_parameters = {
    'name': 'Jane'
}

valohai.prepare(step="hello-job", default_parameters=my_parameters)

name = valohai.parameters('name').value
print(f"and hello {name}!")

and

- step:
    name: hello-job
    image: python:3.12
    command:
    - pip install -r requirements.txt
    - python ./hello.py {parameters}
    parameters:
    - name: name
      default: Bruce
      optional: false
      type: string

Executing the above would still log Bruce.

Consider prioritizing the values defined in the code in such cases instead.