Skip to content

Comments

POC: Remote module inclusion#6815

Draft
jorgee wants to merge 17 commits into251117-module-system-implementationfrom
251117-module-system-implementation-with-remote-inclusion
Draft

POC: Remote module inclusion#6815
jorgee wants to merge 17 commits into251117-module-system-implementationfrom
251117-module-system-implementation-with-remote-inclusion

Conversation

@jorgee
Copy link
Contributor

@jorgee jorgee commented Feb 6, 2026

This pull request introduces a new Service Provider Interface (SPI) for resolving remote Nextflow modules using the @scope/name syntax. The changes provide an implementation that can work with Syntax parser V1 and V2 without coupling Nextflow runtime classes to nf-lang. It also includes a fallback resolver which check if the module files exists in case any resolver is loaded.

Remote Module Resolution SPI Integration:

  • Added the RemoteModuleResolver SPI interface in nextflow.module.spi, defining methods for resolving remote modules and specifying resolver priority.
  • Implemented the RemoteModuleResolverProvider class, which uses Java's ServiceLoader to discover and select the highest-priority resolver, with a fallback if none are found.
  • Provided a fallback implementation (FallbackRemoteModuleResolver) that throws an informative error if no SPI resolver is available.
  • Registered the default resolver implementation (DefaultRemoteModuleResolver) via the SPI mechanism in META-INF/services/nextflow.module.spi.RemoteModuleResolver.

Default Resolver Implementation and Testing:

  • Added DefaultRemoteModuleResolver as the default SPI implementation, handling local and remote module resolution, version constraints, and registry integration.
  • Added a test suite for DefaultRemoteModuleResolver to verify SPI loading and priority behavior.

Module Inclusion Logic Updates:

  • Updated Groovy and Java module inclusion logic (IncludeDef.groovy, ModuleResolver.java, ResolveIncludeVisitor.java) to use the SPI resolver for @scope/name references and ensure correct path resolution. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

@jorgee jorgee mentioned this pull request Feb 6, 2026
5 tasks
@jorgee
Copy link
Contributor Author

jorgee commented Feb 9, 2026

Updated the PoC for remote module inclusion, working with V2 and V1 syntax parsers and nextflow lint. @bentsherman, not sure if it will work with the language server.

@pditommaso
Copy link
Member

@jorgee can you please include a super short "how to test" in a comment?

@jorgee
Copy link
Contributor Author

jorgee commented Feb 10, 2026

To test this branch you need to do the following:

  1. Clone the registry repo and clone branch 251215-module-binary-registry-fixes

  2. Build and publish the npr-api version 0.20.1 in Maven local

$ make build
$ ./gradlew :npr-api:publishToMavenLocal 
  1. Deploy a local docker registry to store modules
    $ docker run -d --name docker-registry -p 5010:5000 registry:latest

  2. Run the Nextflow registry
    $ bash run.sh

  3. Clone Nextflow repo and checkout this branch

  4. Include the Maven local in the build.gradle file

         mavenCentral()
         maven { url 'https://repo.eclipse.org/content/groups/releases' }
         maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
+        mavenLocal()
         maven { url = "https://s3-eu-west-1.amazonaws.com/maven.seqera.io/releases" }
         maven { url = "https://s3-eu-west-1.amazonaws.com/maven.seqera.io/snapshots" }
  1. Build Nextflow as usual

@jorgee jorgee force-pushed the 251117-module-system-implementation branch from 1785870 to 2432e90 Compare February 10, 2026 10:05
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
@jorgee jorgee force-pushed the 251117-module-system-implementation-with-remote-inclusion branch from 3b6e77c to c38b4a8 Compare February 10, 2026 10:44
adamrtalbot and others added 3 commits February 10, 2026 08:36
* Fix JGit resources not being closed in CLI commands

AssetManager now implements Closeable and CLI commands wrap manager
usage in try-finally blocks to ensure JGit resources are properly
released. This prevents ~90 second shutdown delays caused by JGit
shutdown hooks cleaning up unclosed Repository objects.

Signed-off-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>

* Improve res handling [ci fast]

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>

* Fix unclosed JGit resources in SCM strategies

- Use cached getBareGit() instead of Git.open() in revisionToCommitWithBareRepo()
- Cache legacy Git object to avoid repeated unclosed Git.open() calls
- Close Git objects returned by clone commands
- Wrap FileRepository in try-with-resources in createSharedClone()
- Use try-with-resources for RevWalk/TreeWalk in LocalRepositoryProvider

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>

---------

Signed-off-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@pditommaso
Copy link
Member

Trying this I get

» ./launch.sh -h
java.lang.NullPointerException: Cannot invoke "com.beust.jcommander.JCommander.getUnknownOptions()" because the return value of "java.util.Map.get(Object)" is null
        at nextflow.cli.Launcher.parseMainArgs(Launcher.groovy:162)
        at nextflow.cli.Launcher.command(Launcher.groovy:454)
        at nextflow.cli.Launcher.main(Launcher.groovy:682)

@jorgee
Copy link
Contributor Author

jorgee commented Feb 11, 2026

I miss to check it. Fixed in the last commit. I have also added the fix in #6768

ewels and others added 3 commits February 11, 2026 10:28
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@pditommaso
Copy link
Member

pditommaso commented Feb 16, 2026

This looks going into the right direction, first comments:

  • nextflow module should print the help (now crashes)
  • The search command should likely report only "name" and "description"
  • likely it should be added a info command, that dump the module meta data and include a template how to run the module itself e.g. nextflow run modules/nf-core/shasta --meta.id <ID> --reads <FASTQ_FILE> --outdir results

@jorgee jorgee force-pushed the 251117-module-system-implementation-with-remote-inclusion branch from e46c0a5 to 400737a Compare February 17, 2026 10:19
pditommaso and others added 2 commits February 17, 2026 09:32
…sistency (#6833)

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@jorgee jorgee force-pushed the 251117-module-system-implementation-with-remote-inclusion branch from 400737a to 61f9954 Compare February 19, 2026 11:01
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
@jorgee jorgee force-pushed the 251117-module-system-implementation-with-remote-inclusion branch from 61f9954 to a483d3e Compare February 19, 2026 11:06
@jorgee
Copy link
Contributor Author

jorgee commented Feb 19, 2026

Updated from source branch:

  • Add module info command
  • Update to registry API to v1
  • /api path expected in registry config URL
  • search only prints name and description (full for -json)

To test, you must run with registry branch fix-module-release-metadata

@pditommaso
Copy link
Member

To test, you must run with registry branch fix-module-release-metadata

This has been merged, isn't it?

…on' of github.com:nextflow-io/nextflow into 251117-module-system-implementation-with-remote-inclusion
@jorgee
Copy link
Contributor Author

jorgee commented Feb 19, 2026

Yes, it has been merged to 251215-module-binary-registry.

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@pditommaso
Copy link
Member

Push a small change, to fix compilation on my side

@pditommaso
Copy link
Member

Nice the info command, suggest command can be improved:

This is what mcp is suggesting

  nextflow run modules/nf-core/shasta/main.nf \
      --meta.id <ID> \
      --reads <FASTQ_FILE> \
      -resume \
      --outdir results

@pditommaso
Copy link
Member

Run supports nextflow.config, great

@pditommaso
Copy link
Member

Likely this error message is not needed because there's already the dump of the failing command

ERROR ~ Failed to run module


Module run failed: null

@pditommaso
Copy link
Member

Regarding the RegistryConfig i'd like to align with with one used by the gradle plugin

registry {
    url = 'https://registry.nextflow.io/api'
    apiKey = 'your-api-key'
}

it should be fairly simple declare url as List<String> (or URL?) and allow the seting as plain string (url) or a list of strings (url)

as the auth it should be assumed the first is the primary, and publish (auth) would only be allowed for it.

wdyt?

@pditommaso
Copy link
Member

I'd also keep RegistryConfig into nf-commons

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.

5 participants