reanahub / reana-cluster

REANA cluster management
http://reana-cluster.readthedocs.io/
5 stars 23 forks source link

cli: status command traceback #69

Closed tiborsimko closed 6 years ago

tiborsimko commented 6 years ago

When you create a cluster and are too fast running status command, you will see the following traceback:

$ reana-cluster status
Traceback (most recent call last):
  File "/home/simko/.virtualenvs/rc/bin/reana-cluster", line 11, in <module>
    sys.exit(cli())
  File "/home/simko/.virtualenvs/rc/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/simko/.virtualenvs/rc/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/simko/.virtualenvs/rc/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simko/.virtualenvs/rc/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/simko/.virtualenvs/rc/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/simko/.virtualenvs/rc/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/simko/.virtualenvs/rc/lib/python3.6/site-packages/reana_cluster/cli/cluster.py", line 235, in status
    components_status = ctx.obj.backend.get_components_status(component)
  File "/home/simko/.virtualenvs/rc/lib/python3.6/site-packages/reana_cluster/backends/kubernetes/k8s.py", line 770, in get_components_status
    components_status)
  File "/home/simko/.virtualenvs/rc/lib/python3.6/site-packages/reana_cluster/backends/kubernetes/k8s.py", line 738, in _write_status
    if pod.status.container_statuses[0].ready:
TypeError: 'NoneType' object is not subscriptable

Few seconds later things are OK:

$ reana-cluster status
COMPONENT               STATUS           
job-controller          Running          
message-broker          ContainerCreating
server                  Running          
workflow-controller     ContainerCreating
workflow-monitor        ContainerCreating
zeromq-msg-proxy        ContainerCreating
yadage-default-worker   ContainerCreating
yadage-alice-worker     Running          
yadage-atlas-worker     ContainerCreating
yadage-cms-worker       Running          
yadage-lhcb-worker      ContainerCreating
cwl-default-worker      ContainerCreating
wdb                     ContainerCreating
REANA cluster is not ready.

We shoud catch the first exception and report that the cluster is not yet ready in a nicer way...

tiborsimko commented 6 years ago

This is still the case for v0.3.0-pre.