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

Check 'modules' directory structure #1867

Merged
merged 13 commits into from
Oct 4, 2022
Merged

Check 'modules' directory structure #1867

merged 13 commits into from
Oct 4, 2022

Conversation

mirpedrol
Copy link
Member

Add a step in all nf-core modules commands to check if the modules directory of a pipeline has the correct structure. See slack discussion

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
Member

@ewels ewels left a comment

Choose a reason for hiding this comment

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

Reading the code looks good 👍🏻

# If there are modules installed in the wrong location
if len(wrong_location_modules) > 0:
log.info("The modules folder structure is outdated. Reinstalling modules.")
# Remove the local copy of the modules repository
Copy link
Member

Choose a reason for hiding this comment

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

Can we not just git pull update it? 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

I did it like this in case there is a patch file

Copy link
Member

Choose a reason for hiding this comment

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

This is the cached modules repo though, right? ~/.config/nfcore/nf-core/modules/?

Patch files are held in the pipeline repo, so the central cache location should be unaffected by those.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yes you are right, I mixed things.
So for this I copied code from you 😇 from #1851
But if there's a better way of doing it, let's change!

Copy link
Member

Choose a reason for hiding this comment

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

Yeah but #1851 was for a modules clone that is corrupted, so no git operations would work.

Here the git repo is presumably just behind, so doing a git pull should fix stuff, right? I think the code in self.modules_repo.setup_local_repo() should already be pulling the latest changes:

# If the repo is already cloned, fetch the latest changes from the remote
if not ModulesRepo.local_repo_synced(self.fullname):
pbar = rich.progress.Progress(
"[bold blue]{task.description}",
rich.progress.BarColumn(bar_width=None),
"[bold yellow]{task.fields[state]}",
transient=True,
disable=hide_progress,
)
with pbar:
self.repo.remotes.origin.fetch(
progress=RemoteProgressbar(pbar, self.fullname, self.remote_url, "Pulling")
)
ModulesRepo.update_local_repo_status(self.fullname, True)

Is this not already working? If so it could be because it's doing git fetch rather than git pull. In other words, it's not checking out the latest commit, it's only downloading them 🤔 I don't think that there's any reason not to change this to a pull...

nf_core/modules/modules_command.py Outdated Show resolved Hide resolved
nf_core/__main__.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 4, 2022

Codecov Report

Merging #1867 (16d3909) into dev (227e400) will decrease coverage by 0.04%.
The diff coverage is 60.46%.

@@            Coverage Diff             @@
##              dev    #1867      +/-   ##
==========================================
- Coverage   64.49%   64.44%   -0.05%     
==========================================
  Files          34       35       +1     
  Lines        4137     4180      +43     
==========================================
+ Hits         2668     2694      +26     
- Misses       1469     1486      +17     
Impacted Files Coverage Δ
nf_core/modules/info.py 16.54% <0.00%> (-0.12%) ⬇️
nf_core/modules/modules_command.py 73.73% <39.13%> (-10.48%) ⬇️
nf_core/lint/modules_structure.py 88.88% <88.88%> (ø)
nf_core/modules/test_yml_builder.py 49.54% <100.00%> (+0.22%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mirpedrol mirpedrol marked this pull request as ready for review October 4, 2022 15:48
Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
Copy link
Member

@ewels ewels left a comment

Choose a reason for hiding this comment

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

Can probably refine the clone update code instead of deleting and redownloading, but can leave that to another day.

@ewels ewels merged commit 6c5d065 into nf-core:dev Oct 4, 2022
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.

2 participants