-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Executing command using spython needs --cleanenv flag, while it's not necessary using Singularity #172
Comments
Could you show me the actual command you are trying to run, and why it does not work? |
Hi Vanessa! Command that works using Singularity natively: Same command in spython, that only works if I add If I don't use |
Ok good - so you did find that the exec command has options, singularity_options, and sudo_options. https://github.com/singularityhub/singularity-cli/blob/master/spython/main/execute.py#L26 For the cleanenv, I don't have intuition off the bat for why that happens - the environ variable gets passed as None to the ultimate function to run the command, here https://github.com/singularityhub/singularity-cli/blob/master/spython/utils/terminal.py#L179. Could you add --debug to see what the final command looks like? That might at least show us the difference in running the command. If they are the same, then it's some issue with executing from Python, and we can go from there. Here is an example that shows how the debug prints. from spython.main import Client
Client.debug =True
Client.pull('docker://busybox')
singularity --debug pull --name busybox.sif docker://busybox |
Sorry for my late answer! Couldn't get back to it yesterday. Here are the debug outputs: So spython forwards a different set of env variables to the container in comparison to native Singularity. |
Sorry I’m a bit confused - we want debug output from the Singularity Python client, which should (most importantly) sho us the Singularity command being run. Is that included in there (I only see native Singularity output). The first thing to do is compare the actual commands. |
Oh that's a bug, let's fix that so we can see the command. I should have some time this weekend unless you beat me to it. |
Alright! I'll try to find some time in the next few days and see if I can find anything 🙂 |
hey @maawoo ! As promised, I did a PR that will add extra logging to the execute command when you have debug=True, either on the client or provided to the function: Would you care to review, and test out for your use case? We'd first want to compare the commands generated by the singularity python client vs. when you run something locally for differences. If there are no differences, then we need to think about the context of execution (and why the environment is different). If it gets to that, I'll need a dummy example to reproduce the problem. |
Hi @vsoch ! To dig a little bit into the singularity-cli code, I cloned the repo and created a fresh conda environment. I didn't get very far with the digging, but noticed that my command worked in the new env. So I checked the installation and all dependencies in the other env and made sure that both are using the same versions with your PR.... so v0.1.11. So, I installed some packages that could be causing the issue into the new env and quickly found the troublemaker: rasterio, which is depending on the GDAL library and (not surprisingly) caused my command to fail. So, like I said... there actually was never a problem and the difference in behavior was to be expected :) |
Ah, so glad you found the bugger! 🎉 It was worth improving the debug output for spython to help with that (and future users that might run into the same issue!). Should I go ahead and merge that PR so it's added to singularity python proper? |
Yeah, at least something else could be fixed along the way! Again, thanks for your help and the work you do in general :) |
Expected Behavior
Executing a command within a container using spython works equally to when using Singularity.
E.g. If I need additional options to make a command work with Singularity, I expect to need that additional option using spython as well.
Actual Behavior
The command I'm executing in my container works without any additional options when I'm using Singularity, but needs the
--cleanenv
flag when I'm using spython to work properly.Steps to Reproduce
If actually needed, I can provide more detailed information.
In short: My container is based on the Docker image of this project and I noticed this bug while running a command described here in more detail.
Context
Failure Logs
Possible Fix
The text was updated successfully, but these errors were encountered: