eth-cscs / sarus

OCI-compatible engine to deploy Linux containers on HPC environments.
https://sarus.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
129 stars 10 forks source link

error when trying to use --workdir / -w flag #4

Closed marcodelapierre closed 3 years ago

marcodelapierre commented 4 years ago

Virtual machine with Ubuntu 18.04

Sarus installed as per https://sarus.readthedocs.io/en/stable/quickstart/quickstart.html

Here is what happens:

# this is ok
md@nimbus1:~$ sarus run ubuntu:18.04 pwd
/

# I am in the home
md@nimbus1:~$ pwd
/home/ubuntu

# this fails (same with --workdir)
md@nimbus1:~$ sarus run -w /home/ubuntu ubuntu:18.04 pwd
the required argument for option '--workdir' is missing
See 'sarus help run'
Madeeks commented 4 years ago

Hi @marcodelapierre, thanks for the report. I looked into the issue and I can confirm the detection of option values separated by whitespace is not working as intended. We are currently working on fixing this.

In the meantime, you could use the "adjacent" style, i.e. providing the value in the same token as the option. I verified this works with both long and short options in Sarus 1.1.0:

# long option: '=' works as separator
amadonna@localhost:~> sarus run --workdir=/home alpine pwd
/home

# short option: value starts right after the option character
amadonna@localhost:~> sarus run -w/home alpine pwd
/home
marcodelapierre commented 4 years ago

Cheers Alberto, to be honest I hadn't tried the adjacent style, I can confirm it works beautifully

Madeeks commented 3 years ago

Hi @marcodelapierre, as of version 1.3.0 Sarus correctly detects CLI option values separated by whitespace:

# workdir from image
amadonna@localhost:~> srun -C gpu sarus run ubuntu pwd
/

# change workdir using long option and value separated by whitespace
amadonna@localhost:~> sarus run --workdir /home ubuntu pwd
/home

# change workdir using short option and value separated by whitespace
amadonna@localhost:~> sarus run -w /home ubuntu pwd
/home
marcodelapierre commented 3 years ago

thanks for the update Alberto!