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

Allow nf-core pipelines download -r to download commits #3374

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

muffato
Copy link
Member

@muffato muffato commented Dec 20, 2024

Supersedes #2906

This is to allow downloading a specific commit of a pipeline, instead of only a branch / tag.
As @ewels suggested in the original pull-request, I only check the commit once we know it's neither a branch nor a tag. It's a single extra query, and it won't download the whole list of possible commits.

I could reuse the tests @fellen31 wrote. Credits to them

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.93%. Comparing base (40fa26e) to head (12f6e36).
Report is 1 commits behind head on dev.

Additional details and impacted files

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@muffato muffato marked this pull request as ready for review December 20, 2024 23:59
@muffato muffato added enhancement download nf-core download labels Dec 21, 2024
Copy link
Member

@mirpedrol mirpedrol left a comment

Choose a reason for hiding this comment

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

LGTM!
I only made a couple of clean-up code suggestions.
Also tagging @MatthiasZepper in case you want to have a quick look

Comment on lines +88 to +90
pipeline = "exoseq"

download_obj = DownloadWorkflow(pipeline="exoseq", revision="819cbac792b76cf66c840b567ed0ee9a2f620db7")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pipeline = "exoseq"
download_obj = DownloadWorkflow(pipeline="exoseq", revision="819cbac792b76cf66c840b567ed0ee9a2f620db7")
pipeline = "exoseq"
revision = "819cbac792b76cf66c840b567ed0ee9a2f620db7"
download_obj = DownloadWorkflow(pipeline=pipeline, revision=revision)

) = nf_core.utils.get_repo_releases_branches(pipeline, wfs)
download_obj.get_revision_hash()
print(download_obj)
assert download_obj.wf_sha[download_obj.revision[0]] == "819cbac792b76cf66c840b567ed0ee9a2f620db7"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert download_obj.wf_sha[download_obj.revision[0]] == "819cbac792b76cf66c840b567ed0ee9a2f620db7"
assert download_obj.wf_sha[download_obj.revision[0]] == revision

download_obj.get_revision_hash()
print(download_obj)
assert download_obj.wf_sha[download_obj.revision[0]] == "819cbac792b76cf66c840b567ed0ee9a2f620db7"
assert download_obj.outdir == "nf-core-exoseq_819cbac792b76cf66c840b567ed0ee9a2f620db7"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert download_obj.outdir == "nf-core-exoseq_819cbac792b76cf66c840b567ed0ee9a2f620db7"
assert download_obj.outdir == f"nf-core-exoseq_{revision}"

assert download_obj.outdir == "nf-core-exoseq_819cbac792b76cf66c840b567ed0ee9a2f620db7"
assert (
download_obj.wf_download_url[download_obj.revision[0]]
== "https://github.com/nf-core/exoseq/archive/819cbac792b76cf66c840b567ed0ee9a2f620db7.zip"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
== "https://github.com/nf-core/exoseq/archive/819cbac792b76cf66c840b567ed0ee9a2f620db7.zip"
== f"https://github.com/nf-core/exoseq/archive/{revision}.zip"

wfs = nf_core.pipelines.list.Workflows()
wfs.get_remote_workflows()
# Exoseq pipeline is archived, so `dev` branch should be stable
pipeline = "exoseq"
Copy link
Member

Choose a reason for hiding this comment

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

same suggestions from test_get_release_hash_long_commit can also be applied here

download_obj.wf_branches,
) = nf_core.utils.get_repo_releases_branches(pipeline, wfs)
download_obj.get_revision_hash()
print(download_obj)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
print(download_obj)

@MatthiasZepper
Copy link
Member

Thanks for tagging. I took a brief look and have no objections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
download nf-core download enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants