SAME-Project / same-project

https://sameproject.ml/
Apache License 2.0
20 stars 8 forks source link

Need better error messages when same.yaml isn't specified, and backend not specified #109

Closed aronchick closed 2 years ago

aronchick commented 2 years ago
❯ python3 ../../../sameproject/main.py program run
Traceback (most recent call last):
  File "/Users/daaronch/code/same-project/test/testdata/generic_notebook/../../../sameproject/main.py", line 20, in <module>
    main(auto_envvar_prefix="SAME")
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/daaronch/code/same-project/sameproject/program/commands.py", line 122, in run
    click.echo(f"File is: {same_file.name}")
AttributeError: 'NoneType' object has no attribute 'name'
❯ python3 ../../../sameproject/main.py program run -f same.yaml
File is: same.yaml
Traceback (most recent call last):
  File "/Users/daaronch/code/same-project/test/testdata/generic_notebook/../../../sameproject/main.py", line 20, in <module>
    main(auto_envvar_prefix="SAME")
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/daaronch/code/same-project/.venv/sameproject-PlHIzMk6-py3.10/lib/python3.10/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/daaronch/code/same-project/sameproject/program/commands.py", line 123, in run
    compiled_same_file, root_module_name = nbproc.compile(same_file, target, secret_dict, aml_dict)
  File "/Users/daaronch/code/same-project/sameproject/program/compile/notebook_processing.py", line 200, in compile
    return sameproject.backends.executor.render(target=target, steps=all_steps, same_config=same_config)
  File "/Users/daaronch/code/same-project/sameproject/backends/executor.py", line 21, in render
    raise ValueError(f"Unknown backend: {target}")
ValueError: Unknown backend: None
lukemarsden commented 2 years ago

which version of same are you running?

aronchick commented 2 years ago

Latest main?

Bubblyworld commented 2 years ago

Hmm, maybe your locally installed modules have different versions to the lockfile? Seems better when run with poetry:

$ poetry run python3 sameproject/main.py program run
Usage: main.py program run [OPTIONS]
Try 'main.py program run --help' for help.

Error: Invalid value for '-f' / '--same-file': 'same.yaml': No such file or directory

edit: and running your second example works fine with poetry for me. Weird 🤔

aronchick commented 2 years ago

hmmm... i wonder if this is an env setting i have. Regardless, if you both can't repo, i'll close