Skip to content
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

Singularity23 fix #1113

Merged
merged 38 commits into from
Jun 3, 2019
Merged

Conversation

drkennetz
Copy link
Contributor

@drkennetz drkennetz commented May 8, 2019

I added a fun _normalize_sif_id() which creates a regex based on how singularity3.x will write out image files.
Also added logic which will search for .img or .sif in $SINGULARITY_CACHEDIR and $SINGULARITY_PULLFOLDER only if they exist in users env. If they do not exist, the file will be written locally (this is how you previously had it). If the cwltool is run again, it will use the local copy if it is found in any of the locations pwd, $SINGULARITY_CACHEDIR, or $SINGULARITY_PULLFOLDER. If those are not in env, the image must be in the same directory as the tool in order to be found.

(continuation of #1111)

It is also important to note that any images or sif's generate using singularity ad hoc (without cwl) that follow the singularity naming convention will also be found if they are written to these directories, which I think is desirable behavior.

@cwl-bot
Copy link

cwl-bot commented May 8, 2019

Can one of the admins verify this patch?

cwltool/singularity.py Outdated Show resolved Hide resolved
cwltool/singularity.py Outdated Show resolved Hide resolved
@drkennetz
Copy link
Contributor Author

@mr-c here is the new PR whenever you get some time. Let me know if you need anything from me!

@mr-c mr-c mentioned this pull request May 8, 2019
.travis.yml Outdated Show resolved Hide resolved
cwltool/singularity.py Outdated Show resolved Hide resolved
@mr-c
Copy link
Member

mr-c commented May 8, 2019

Jenkins, Okay to test

@mr-c
Copy link
Member

mr-c commented May 8, 2019

Jenkins, okay to test

Co-Authored-By: drkennetz <38996870+drkennetz@users.noreply.github.com>
@codecov
Copy link

codecov bot commented May 8, 2019

Codecov Report

Merging #1113 into master will increase coverage by 4.89%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1113      +/-   ##
==========================================
+ Coverage   73.26%   78.15%   +4.89%     
==========================================
  Files          34       34              
  Lines        6878     6890      +12     
  Branches     1750     1753       +3     
==========================================
+ Hits         5039     5385     +346     
+ Misses       1310     1058     -252     
+ Partials      529      447      -82
Impacted Files Coverage Δ
cwltool/argparser.py 85.78% <ø> (+0.47%) ⬆️
cwltool/singularity.py 71.42% <66.66%> (-3.9%) ⬇️
cwltool/load_tool.py 84.4% <0%> (+1.37%) ⬆️
cwltool/utils.py 72.65% <0%> (+1.56%) ⬆️
cwltool/docker.py 55.89% <0%> (+1.74%) ⬆️
cwltool/executors.py 78.46% <0%> (+2.05%) ⬆️
cwltool/job.py 66.59% <0%> (+2.83%) ⬆️
cwltool/expression.py 86.55% <0%> (+4.3%) ⬆️
cwltool/sandboxjs.py 73.7% <0%> (+4.31%) ⬆️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd6e054...6b4c430. Read the comment docs.

cwltool/singularity.py Outdated Show resolved Hide resolved
@drkennetz
Copy link
Contributor Author

drkennetz commented May 9, 2019

We will likely have access to singularity2.6 on our cluster in the next few days. I can work on version specific code if that seems like something you'd like to have. I will run some tests to see if Singularity3.x is backwards compatible with 2.x. If it is, I can write code to allow sing3.x to run 2.x and 3.x images, while limiting 2.x to Sing2.x specific images.

After diving into this a bit more I am going to put this on hold. This would be relevant if a user is switching between Singularity2.x and 3.x to run the same tool which is bad practice. I think down the road, I can add a feature that will validate $SINGULARITY_CACHEDIR based on a given version, but in the mean time it is not an immediate concern.

@drkennetz
Copy link
Contributor Author

I'm learning a lot of git! I pulled the changes you made locally and then added my tests and pushed them now. The tests I added should test for images to be created in SINGULARITY_PULLFOLDER and locally depending on if the environmental variable exists. We shall see.

@drkennetz
Copy link
Contributor Author

It seems that the singularity_pull_folder test failed, perhaps I don't understand what get_data() does, but I figured it just ran the cwltool I passed it and would output anything that the tool would output. The tool writes an image file and that's it. Inside of the test directory I created a singularity_pullfolder and set it in env, and then checked to see if the .img was in the folder I designated as pull_folder. Let me know if you see anything wrong with the test!

Copy link
Contributor Author

@drkennetz drkennetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the change.

assert 'debian.img' in file_in_dir

@needs_singularity
def test_singularity_pullfolder():
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you investigate why test_singularity_local() succeeds in this fails? I tested this locally and it generated a dir called 'tmp' im my current working directory and wrote an image file to it. The resultant
assert 'debian.img' in file_in_dir returned True in my local case.

@drkennetz
Copy link
Contributor Author

Is the default branch failing because commits have been made?

@mr-c
Copy link
Member

mr-c commented May 14, 2019

@drkennetz No, that was a transient error on the Jenkins server

tests/test_singularity.py Outdated Show resolved Hide resolved
tests/test_singularity.py Outdated Show resolved Hide resolved
@mr-c
Copy link
Member

mr-c commented May 14, 2019

Almost there!

Copy link
Contributor Author

@drkennetz drkennetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, this has been some solid progress. I just want to see that coverage increase!

@drkennetz
Copy link
Contributor Author

I will let you resolve the get_data issue then we can see if this will increase cov.

Thanks for your help!

@drkennetz
Copy link
Contributor Author

@mr-c have you had a chance to review this at all? I believe I am waiting on your update to the get_data() function to increase coverage. After that, PR complete?

@mr-c
Copy link
Member

mr-c commented May 28, 2019

In the latest commit I've changed how the images are named, only / is replaced and no components are dropped

309919e

This way same named images from different organizations or registries aren't mistaken for each other.

@drkennetz This is different than singularity's behavior, but I and others feel it is more correct and more useful. What do you think?

Thia probably means that we shouldn't use the SINGULARITY_PULLFOLDER but I want to study that some more

@drkennetz
Copy link
Contributor Author

@mr-c I think that is a good idea. I don't think you should strip any part of the name to keep them as unique as possible. However, I don't know why that would conflict with SINGULARITY_PULLFODLER as that is just a storage space.

Singularity by default writes images to

$SINGULARITY_CACHEDIR/oci-tmp/<image_hash>/fullimage-bwa.version.sif.

However, you have changed this behavior by including an image name and a write location to singularity image files in cwd(). The naming convention shouldn't matter. As long as you provide a name to dockerPull: that corresponds to the regex that your code will output, it should find the image in SINGULARITY_PULLFOLDER or SINGULARITY_CACHEDIR. Does this make sense?

Maybe I am misunderstanding you or what you are trying to change. I have a pretty intimate understanding of how cwl and singularity interact. Maybe you could tell me what you are trying to have as default behavior and I could comment on that or provide possible coding changes.

@drkennetz
Copy link
Contributor Author

@mr-c I think I misunderstood you the first time. If you guys want to change $SINGULARITY_PULLFOLDER to something like $CWL_PULLFOLDER because the image names will have different naming conventions than singularity's I am completely okay with that. You guys just let me know how you would like to rearchitect and I will comply.

Maybe we could bring it up in the next meeting.

@mr-c
Copy link
Member

mr-c commented Jun 2, 2019

Seems that Singularity 3.1 and 3.2 don't use the SINGULARITY_PULLFOLDER environment variable 😿

@drkennetz
Copy link
Contributor Author

drkennetz commented Jun 3, 2019

Seems that Singularity 3.1 and 3.2 don't use the SINGULARITY_PULLFOLDER environment variable 😿

I see the changes you've made and they look good and work locally for me for both singularity 2.6 and 3.x once I set CWL_SINGULARITY_CACHE in my env.

In the end, SINGULARITY_PULLFOLDER is behaving the same way as CWL_SINGULARITY_CACHE would for 3x.

@mr-c mr-c merged commit 26870e3 into common-workflow-language:master Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants