Skip to content

instance.run_command not working + Client.execute problem  #213

@EricDeveaud

Description

@EricDeveaud

Hello,

while testing singularity-cli I encountered a problem with instance.run_command method.
see:

from spython.main import Client
a = Client.instance('/my/image.sif', name='foo')
a.run_command(['ls'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/gensoft/adm/share/gensoft/spython/utils/terminal.py", line 186, in run_command
    cmd = _process_sudo_cmd(cmd, sudo, sudo_options)
  File "/opt/gensoft/adm/share/gensoft/spython/utils/terminal.py", line 30, in _process_sudo_cmd
    cmd = ["sudo"] + cmd
TypeError: can only concatenate list (not "Instance") to list

I tested instance.run_command method as I have a problem with Client.execute method

I have a singularity image that I need to test if it have nv support at runtime. from a different process than the one that instanciated it.

remember instance a was instanciated WITHOUT nv support in process1 but...
in process2
NB as expected instance.option is not available from different process

from spython.main import Client
foo = Client.instances('foo')
Client.execute(foo, ['nvidia-smi'], return_result=True)['return_code']
0
```
I was expecting anything but 0 ;-)

## Context

[provide more detailed introduction to the issue itself . This is for make a reproducible issue.]
* Operating System:
```
cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.8 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.8 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.8
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.8"
```
* singularity version:

singularity --version
apptainer version 1.2.4-1.el8

* spython version: 0.3.11

* python version: 

python3 --version
Python 3.8.1


Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions