Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rebench crashes if git isn't installed #243

Closed
vext01 opened this issue Jul 31, 2024 · 5 comments · Fixed by #245
Closed

rebench crashes if git isn't installed #243

vext01 opened this issue Jul 31, 2024 · 5 comments · Fixed by #245

Comments

@vext01
Copy link
Contributor

vext01 commented Jul 31, 2024

Hi Stefan! Long time no see.

I'm trying out rebench for the first time and I think I've found some bugs. I'll file them, but if it's user error then I apologise in advance :)

I've noticed that if you run rebench on a system without git installed (I was using a very minimal docker container for a CI system), then you get an error like:

+ /home/ci/.local/bin/rebench --no-denoise -c rebench.conf -q
Traceback (most recent call last):
  File "/home/ci/.local/bin/rebench", line 8, in <module>
    sys.exit(main_func())
             ^^^^^^^^^^^
  File "/home/ci/.local/pipx/venvs/rebench/lib/python3.11/site-packages/rebench/rebench.py", line 313, in main_func
    return 0 if rebench.run() else -1
                ^^^^^^^^^^^^^
  File "/home/ci/.local/pipx/venvs/rebench/lib/python3.11/site-packages/rebench/rebench.py", line 251, in run
    self._config = Configurator(config, data_store, self.ui, args,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ci/.local/pipx/venvs/rebench/lib/python3.11/site-packages/rebench/configurator.py", line 226, in __init__
    self._experiments = self._compile_experiments(experiments)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ci/.local/pipx/venvs/rebench/lib/python3.11/site-packages/rebench/configurator.py", line 336, in _compile_experiments
    results[exp_name] = self._compile_experiment(exp_name, experiments[exp_name])
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ci/.local/pipx/venvs/rebench/lib/python3.11/site-packages/rebench/configurator.py", line 347, in _compile_experiment
    return Experiment.compile(exp_name, experiment, self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ci/.local/pipx/venvs/rebench/lib/python3.11/site-packages/rebench/model/experiment.py", line 51, in compile
    return Experiment(name, description or desc, action, env, data_file, reporting,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ci/.local/pipx/venvs/rebench/lib/python3.11/site-packages/rebench/model/experiment.py", line 66, in __init__
    self._persistence = self._data_store.get(data_file, configurator, action)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ci/.local/pipx/venvs/rebench/lib/python3.11/site-packages/rebench/persistence.py", line 54, in get
    source = determine_source_details(configurator)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ci/.local/pipx/venvs/rebench/lib/python3.11/site-packages/rebench/environment.py", line 57, in determine_source_details
    is_git_repo = _exec(git_cmd + ['rev-parse']) is not None
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ci/.local/pipx/venvs/rebench/lib/python3.11/site-packages/rebench/environment.py", line 22, in _exec
    out = subprocess.check_output(cmd, stderr=dev_null_f)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'git'

I'm not sure if git is a hard dependency of rebench, but it might be an idea to print a better error message like "git is required" instead of a stack trace.

Cheers

@smarr
Copy link
Owner

smarr commented Jul 31, 2024

Hi @vext01 :)

Hm, yeah, I guess that's expected to break. But only in the sense that this isn't something I have tested for.

Should be an easy fix...

@smarr
Copy link
Owner

smarr commented Jul 31, 2024

Could you give #245 a go?
I should probably see whether I can run tests in an empty docker container, too.
Though, if you happen to have a corresponding Dockerfile, that's probably a better start than me trying to do it from scratch.

Thanks!

@vext01
Copy link
Contributor Author

vext01 commented Jul 31, 2024

Sorry for the delay. Took me a while to figure out how to install a branch using pipx!

You've made it so git is a not a dependency at all, right?

Using this Dockerfile (without git installed) and this build script I'm able to run rebench just fine!

CI output here if you are curious.

Thanks

@smarr
Copy link
Owner

smarr commented Jul 31, 2024

You've made it so git is a not a dependency at all, right?

Well, technically, no.
Technically, I thought I had tried that already in the past here:

def git_not_available():

But practically, there seem to be different failure modes.
I guess, I could just try to catch everything... but being not sure what else might be missed, I'd rather not catch too much.

Using this Dockerfile (without git installed) and this build script I'm able to run rebench just fine!

Thanks. It would probably be sensible to add something like this to the CI, but not today. Let's go with the quick fix in #245 for now, and then reconsider if something else crops up.

Thanks!

@smarr smarr linked a pull request Jul 31, 2024 that will close this issue
@smarr
Copy link
Owner

smarr commented Jul 31, 2024

Closing with #245 being merged. Thanks!

@smarr smarr closed this as completed Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants