ersilia-os / ersilia

The Ersilia Model Hub, a repository of AI/ML models for infectious and neglected disease research.
https://ersilia.io
GNU General Public License v3.0
224 stars 148 forks source link

🐛 Bug: Ersilia close when model serving is interrupted #1171

Closed Malikbadmus closed 4 months ago

Malikbadmus commented 4 months ago

Describe the bug.

If the model serving process was interrupted when the service class has not been specified yet, you get this error when you use the ersilia close command.

Traceback (most recent call last):
  File "/root/miniconda3/bin/ersilia", line 8, in <module>
    sys.exit(cli())
  File "/root/miniconda3/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/root/miniconda3/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/root/miniconda3/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/miniconda3/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/miniconda3/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/ersilia/ersilia/cli/commands/__init__.py", line 22, in wrapper
    return func(*args, **kwargs)
  File "/ersilia/ersilia/cli/commands/close.py", line 16, in close
    service_class = session.current_service_class()
  File "/ersilia/ersilia/core/session.py", line 36, in current_service_class
    return data["service_class"]
KeyError: 'service_class'

Describe the steps to reproduce the behavior

  1. ersilia -v serve eos4tcc
  2. ctrl c
  3. ersilia close

Operating environment

Ubuntu 22.04.1

Malikbadmus commented 4 months ago

@DhanshreeA, this is a relatively minor issue.

It has been resolved with a tiny fix in this PR.

DhanshreeA commented 4 months ago

Ah this is an interesting one. Thanks @Malikbadmus!