epics-containers / edge-containers-cli

command line shortcuts for epics containers developers
Apache License 2.0
3 stars 1 forks source link

ec ps throws TypeError #115

Closed ulrikpedersen closed 3 months ago

ulrikpedersen commented 3 months ago

I'm following the tutorial here. When I run ec ps it always throws a TypeError, whether or not I have any IOCs deployed.

I have epics-containers-cli version 3.1.0 installed in my python3.10 virtualenv.

(ec-venv) ukp@osloxf04:~/EPICS/bl01t$ ec ps
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/ukp/ec-venv/lib/python3.10/site-packages/edge_containers_cli/cmds/cli.py:37 in ps          │
│                                                                                                  │
│    34 ):                                                                                         │
│    35 │   """List the IOCs/services running in the current namespace"""                          │
│    36 │   if ctx.obj.namespace == globals.LOCAL_NAMESPACE:                                       │
│ ❱  37 │   │   LocalCommands(ctx.obj).ps(all, wide)                                               │
│    38 │   else:                                                                                  │
│    39 │   │   K8sCommands(ctx.obj).ps(all, wide)                                                 │
│    40                                                                                            │
│                                                                                                  │
│ /home/ukp/ec-venv/lib/python3.10/site-packages/edge_containers_cli/cmds/local_commands.py:197 in │
│ ps                                                                                               │
│                                                                                                  │
│   194 │   │   │   select_data.append(                                                            │
│   195 │   │   │   │   {                                                                          │
│   196 │   │   │   │   │   "name": service["Names"][0],                                           │
│ ❱ 197 │   │   │   │   │   "version": service["Labels"]["version"],                               │
│   198 │   │   │   │   │   "running": service["State"] == "running",                              │
│   199 │   │   │   │   │   "restarts": service["Restarts"],                                       │
│   200 │   │   │   │   │   "deployed": service["CreatedAt"][:19]                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: string indices must be integers

I can see the IOC container is deployed:

(ec-venv) ukp@osloxf04:~/EPICS/bl01t$ docker container ls
CONTAINER ID   IMAGE                                                               COMMAND                  CREATED         STATUS         PORTS     NAMES
f3f5f390208b   ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2024.2.1   "/bin/bash -c ${IOC}…"   7 minutes ago   Up 7 minutes             bl01t-ea-test-01
gilesknap commented 3 months ago

Thanks Ulrik. There may be a regression on using docker as we don't try it out all that often.

@marcelldls are you able to check docker usage as part of your tutorials review please? If not give it back to me.

marcelldls commented 3 months ago

Thanks for this @ulrikpedersen - appears to be a subtle difference between the docker and podman APIs for how labels are returned. I can reproduce your issue so I will get it sorted. In future our system tests will catch these

marcelldls commented 3 months ago

@ulrikpedersen Fix is released. Please try pip install edge-containers-cli==3.1.1

ulrikpedersen commented 3 months ago

Very cool, thank you @marcelldls

Works for me with version 3.1.1

(ec-venv) ukp@osloxf04:~/EPICS/bl01t$ pip install --upgrade edge-containers-cli
Requirement already satisfied: edge-containers-cli in /home/ukp/ec-venv/lib/python3.10/site-packages (3.1.0)
Collecting edge-containers-cli
  Downloading edge_containers_cli-3.1.1-py3-none-any.whl.metadata (15 kB)
...snip...
Downloading edge_containers_cli-3.1.1-py3-none-any.whl (29 kB)
Installing collected packages: edge-containers-cli
  Attempting uninstall: edge-containers-cli
    Found existing installation: edge-containers-cli 3.1.0
    Uninstalling edge-containers-cli-3.1.0:
      Successfully uninstalled edge-containers-cli-3.1.0
Successfully installed edge-containers-cli-3.1.1
(ec-venv) ukp@osloxf04:~/EPICS/bl01t$ 
(ec-venv) ukp@osloxf04:~/EPICS/bl01t$ 
(ec-venv) ukp@osloxf04:~/EPICS/bl01t$ ec ps
| name             | version       | running | restarts | deployed            |
|------------------|---------------|---------|----------|---------------------|
| bl01t-ea-test-01 | 2024.3.cb41-b | true    | 0        | 2024-03-19 14:27:49 |