rackslab / Slurm-web

Open source web dashboard for Slurm HPC clusters
https://slurm-web.com
GNU General Public License v3.0
340 stars 97 forks source link

KeyError with unsupported Slurm version #316

Closed rezib closed 2 months ago

rezib commented 4 months ago

Error reported by @Talavig in #315, with unsupported Slurm version:

Thread-38 (process_request_thread): [INFO] 127.0.0.1 - - [16/Jul/2024 13:28:26] "GET /v3.1.0/stats HTTP/1.1" 500 -
Jul 16 13:28:26 standalone slurm-web-agent[2310]: KeyError: 'warnings'
Jul 16 13:28:26 standalone slurm-web-agent[2310]:     if len(result["warnings"]):
Jul 16 13:28:26 standalone slurm-web-agent[2310]:   File "/usr/lib/python3/dist-packages/slurmweb/views/agent.py", line 64, in slurmrest
Jul 16 13:28:26 standalone slurm-web-agent[2310]:     items = func(*args)
Jul 16 13:28:26 standalone slurm-web-agent[2310]:   File "/usr/lib/python3/dist-packages/slurmweb/views/agent.py", line 76, in filter_fields
Jul 16 13:28:26 standalone slurm-web-agent[2310]:     return func(*args)
Jul 16 13:28:26 standalone slurm-web-agent[2310]:   File "/usr/lib/python3/dist-packages/slurmweb/views/agent.py", line 88, in _cached_data
Jul 16 13:28:26 standalone slurm-web-agent[2310]:     return _cached_data(
Jul 16 13:28:26 standalone slurm-web-agent[2310]:   File "/usr/lib/python3/dist-packages/slurmweb/views/agent.py", line 101, in _cached_jobs
Jul 16 13:28:26 standalone slurm-web-agent[2310]:     for job in _cached_jobs():
Jul 16 13:28:26 standalone slurm-web-agent[2310]:   File "/usr/lib/python3/dist-packages/slurmweb/views/agent.py", line 236, in stats
Jul 16 13:28:26 standalone slurm-web-agent[2310]:     return view(*args, **kwargs)
Jul 16 13:28:26 standalone slurm-web-agent[2310]:   File "/usr/lib/python3/dist-packages/rfl/web/tokens.py", line 93, in wrapped
Jul 16 13:28:26 standalone slurm-web-agent[2310]:     return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
Jul 16 13:28:26 standalone slurm-web-agent[2310]:   File "/usr/lib/python3/dist-packages/flask/app.py", line 1499, in dispatch_request
Jul 16 13:28:26 standalone slurm-web-agent[2310]:     rv = self.dispatch_request()
Jul 16 13:28:26 standalone slurm-web-agent[2310]:   File "/usr/lib/python3/dist-packages/flask/app.py", line 1513, in full_dispatch_request
Jul 16 13:28:26 standalone slurm-web-agent[2310]:     rv = self.handle_user_exception(e)
Jul 16 13:28:26 standalone slurm-web-agent[2310]:   File "/usr/lib/python3/dist-packages/flask/app.py", line 1515, in full_dispatch_request
Jul 16 13:28:26 standalone slurm-web-agent[2310]:     response = self.full_dispatch_request()
Jul 16 13:28:26 standalone slurm-web-agent[2310]:   File "/usr/lib/python3/dist-packages/flask/app.py", line 2070, in wsgi_app
Jul 16 13:28:26 standalone slurm-web-agent[2310]: Traceback (most recent call last):
Jul 16 13:28:26 standalone slurm-web-agent[2310]: Thread-38 (process_request_thread): [ERROR] Exception on /v3.1.0/stats [GET]

Unsupported Slurm version error should be reported more clearly to users.