Adding ability to pull based on commit / hash#53
Adding ability to pull based on commit / hash#53vsoch merged 7 commits intosingularityhub:masterfrom vsoch:fix/pull
Conversation
|
I'll look into this more when I have more time, but trying out this branch on Python3 with a basic script #!/usr/bin/env python3
from spython.main import Client
Client.pull(
'shub://mwiens91/shub-debug',
pull_folder='/home/matt/temp',
name_by_commit=True,
)Resulted in Regular pulling seems to work fine, though. |
|
okay I think I fixed the issue! Here is what I just did: from spython.main import Client
Client.pull(
'shub://mwiens91/shub-debug',
pull_folder='/tmp',
name_by_commit=True,
)
## -- End pasted text --
singularity pull --commit shub://mwiens91/shub-debug
Progress |===================================| 100.0%
Done. Container is at: /tmp/d13898a106f9678c695ab479335e285c634d3686.simg
/tmp/d13898a106f9678c695ab479335e285c634d3686.simgLet me know if it works for you! |
|
Hmm. I'm getting another error: It seems to be pulling twice?? Not sure what to make of it. |
|
Hrm I am seeing the error from Singularity - what version of Singularity do you have? I think the issue is that there is a Singularity error that then returns output that is unexpected, and it can't be parsed to return the container name. |
This the version provided by default in Ubuntu 18.04. |
|
I don't think ubuntu has a default version? Anyway, could you please update? That is a very old version (and one with security issues too, I think). |
|
Yeah I'll try updating. https://launchpad.net/ubuntu/+source/singularity-container is what Ubuntu provides, btw. |
|
Oh I see, maybe 2.5.2 isn't specified for your distribution? --> https://launchpad.net/ubuntu/+source/singularity-container/2.5.2-2 |
|
Hmmm. I upgraded to 2.5.2 and am still getting the same error. Maybe I need to initialize my "config subsystem" (whatever that may mean)? |
|
okay I'm going to update mine to the latest (2.6.0) to test this out. Make sure you install based on those instructions - there is no "non sudo" install, etc. This works for me: $ singularity pull --commit shub://mwiens91/shub-debug
Progress |===================================| 100.0%
Done. Container is at: /tmp/d13898a106f9678c695ab479335e285c634d3686.simgNow in python! Note that I removed the old versions of spython first, otherwise you get weird conflicts. This still works okay for me, see if it does for you with updated singularity and removing old versions of spython: If that doesn't work, please open the file spython/main/pull.py and have it do a print for final_image |
|
Interesting I'm looking at the differences in the command now, and it comes down to having capture=True (to get the image name) vs If you report that regular pull works and this one doesn't, then this is the issue - capturing the output. If the above doesn't work I have a workaround I think :) |
|
and I would bet we installed singularity differently to get the different functionality - maybe you did disable suid? |
|
For Singularity 2.4.2 I just did a regular Ubuntu with no other modification past that. Upgrading to Singularity 2.5.2, I used the package archive at Debian Neuroscience here: http://neuro.debian.net/pkgs/singularity-container.html and upgraded with apt again: Again, with no further modification. I haven't tried building from source on my main machine (package managers are nice 😄), although I believe I have done so on a few VMs. |
|
okay I just a modification that should make the pull work as the one that you say is working... fingers crossed! It works for me still. |
|
See 6d0d25d The workaround is to pull (without capture) to a temporary folder, and then move to the final spot and clean up. |
|
And I'm definitely terrible, I didn't even know we had an official package on there, heh :) |
|
Ok great! I'm still getting the weird Singularity errors but it seems to be working. Naming by hash works great too: When do you expect these changes will be brought into the singularity-cli package on PyPI? Also, as I mentioned in #48, this option becomes way more useful when this issue: is fixed, but, as we discussed before, that's an issue with Singularity native, not spython. |
|
Awesome! The singularity error is strange indeed! I think it's related possibly to the package that you installed (because I'm not getting it locally with my install from source). I can get this merged and on pypi tonight, but first let's open an issue on the Singularity board. I want to get a little more insight to why this might be happening. |
|
Yeah it definitely is to do with the package. I switched one of my Travis builds from building Singularity from source to getting Singularity from the Debian Neuroscience package repository, and the error popped up after making that change (it was absent before). Before: After: |
|
okay, I'm good integrating this and we will hope to resolve the neurodebian issue on the other thread. Merging! |
|
Here you go @mwiens91 thanks for your help with this! https://pypi.org/project/spython/ https://pypi.org/project/spython/0.0.42/ |
This will fix #48 to add the missing --commit and --pull flags to the client.