icaros-usc / pyribs

A bare-bones Python library for quality diversity optimization.
https://pyribs.org
MIT License
210 stars 35 forks source link

Fix SimpleNamespace error in CI/CD for examples #190

Closed btjanaka closed 1 year ago

btjanaka commented 2 years ago

Seems to be a new error in GitHub Actions even though we did not change any example code. May be related to https://github.com/rsalmei/alive-progress/issues/107

Example: https://github.com/icaros-usc/pyribs/runs/5702211360?check_suite_focus=true

Traceback (most recent call last):
  File "examples/lunar_lander.py", line 401, in <module>
    fire.Fire(lunar_lander_main)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/fire/core.py", line 471, in _Fire
    target=component.__name__)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "examples/lunar_lander.py", line 391, in lunar_lander_main
    metrics = run_search(client, optimizer, env_seed, iterations, log_freq)
  File "examples/lunar_lander.py", line 208, in run_search
    with alive_bar(iterations) as progress:
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/alive_progress/core/progress.py", line 276, in __alive_bar
    start_monitoring()
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/alive_progress/core/progress.py", line 1[63](https://github.com/icaros-usc/pyribs/runs/5702211360?check_suite_focus=true#step:6:63), in start_monitoring
    hook_manager.install()
  File "/opt/hostedtoolcache/Python/3.7.12/x[64](https://github.com/icaros-usc/pyribs/runs/5702211360?check_suite_focus=true#step:6:64)/lib/python3.7/site-packages/alive_progress/core/hook_manager.py", line [76](https://github.com/icaros-usc/pyribs/runs/5702211360?check_suite_focus=true#step:6:76), in install
    for logger in get_all_loggers()
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/alive_progress/core/hook_manager.py", line [77](https://github.com/icaros-usc/pyribs/runs/5702211360?check_suite_focus=true#step:6:77), in <dictcomp>
    for h in logger.handlers if isinstance(h, StreamHandler)})
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/alive_progress/core/hook_manager.py", line 64, in get_hook_for
    handler.stream.flush()
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/alive_progress/core/hook_manager.py", line 33, in flush
    if buffers[stream]:
TypeError: unhashable type: 'types.SimpleNamespace'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/logging/__init__.py", line 2036, in shutdown
    h.flush()
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/logging/__init__.py", line 1009, in flush
    self.stream.flush()
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/alive_progress/core/hook_manager.py", line 33, in flush
    if buffers[stream]:
TypeError: unhashable type: 'types.SimpleNamespace'
Error: Process completed with exit code 1.
btjanaka commented 1 year ago

Resolved by #254