Does anyone know of a plugin that implements the `...
# nextflow-plugins
n
Does anyone know of a plugin that implements the
TraceObserver
? I'm trying to create a plugin that uses it but can't get it working and could use a good example to take inspiration from 🙂
n
Yes I looked at both
nf-hello
and
nf-quilt
and couldn't get it working 😕 I sadly can't share a repo since it's on a private organization
j
Did you register the factory in the extension idx and the factory instantiate the observer? https://github.com/nextflow-io/nf-hello/blob/master/plugins/nf-hello/src/main/nextflow/hello/HelloFactory.groovy
n
Yes, this is how the
extensions.idx
looks like:
Copy code
nextflow.drs.DrsObserverFactory
This is how the factory looks like:
Copy code
class DrsObserverFactory implements TraceObserverFactory {

    /**
     * Create the TraceObserverFactory
     *
     * @param session A nextflow session instance.
     */
    @Override
    Collection<TraceObserver> create(Session session) {
        final enabled = session.config.navigate("drs.enabled")
        log.warn("Trying to create a TraceObserver")
        return enabled ? [ new DrsObserver() ] = []
    }

}
I've just checked and Nextflow isn't able to find the
DrsObserverFactory
somehow and I'm not sure why
🧐 1
j
And the plugin is loaded at startup?
n
Yes this is in the `.nextflow.log`:
Copy code
Jun-07 14:33:07.710 [main] DEBUG nextflow.plugin.PluginsFacade - Plugins resolved requirement=[nf-drs]
Jun-07 14:33:07.711 [main] DEBUG nextflow.plugin.PluginUpdater - Update not supported during development mode
Jun-07 14:33:07.711 [main] DEBUG nextflow.plugin.PluginUpdater - Starting plugin nf-drs version: 0.1.0
Jun-07 14:33:07.711 [main] INFO  org.pf4j.AbstractPluginManager - Start plugin 'nf-drs@0.1.0'
j
Maybe is not required but put a new line in the idx file.
n
That sadly didn't do anything 😕
😞 1
j
I wrote this template but I think you have covered all steps At the end surely will be a typo in some file. Maybe the pacakage name, an uppercase.... https://github.com/edn-es/nf-plugin-template
n
Thank you I'll go through it all again 😛
Apparently I was working in the wrong folder facepalm
The
bin/
folder instead of the
src/
folder...
😁 1
It still doesn't work, I tried implementing an extension point to see if that would work but it causes this error:
Copy code
Plugin 'nf-drs' does not implement any extension point -- Check script '/home/nvnieuwk/Documents/cmgg/testpipeline/main.nf' at line: 1 or see '.nextflow.log' file for more details
Would you have any idea how to fix this? This is how my extension point looks like:
Copy code
@Slf4j
@CompileStatic
class DrsExtension extends PluginExtensionPoint {

    /**
     * A session holds information about current nextflow execution.
     */
    protected Session session

    /**
     * A custom configuration extracted from the drs scope.
     */
    protected DrsConfig config

    /**
     * An extension that is automatically initialized by nextflow when the session is ready.
     *
     * @param session A nextflow session instance.
     */
    @Override
    protected void init(final Session session) {
        this.session = session
        this.config = new DrsConfig(session.config?.navigate('drs') as Map)
    }

    @Function
    public String testFunction() {
        return "testHello"
    }

}
j
Are you using recent nextflow version? If I'm now wrong versions before 23.10 (not sure) doesnt work with extension implementing only Function
n
yep I'm using the main branch of the Nextflow repository (at least how it was on Thursday last week)
I've also had this issue a lot while developing nf-schema but there I could simply remove the cached build files and that would fix it
But no luck here 😕
j
😞 double check if you're deploying the plugin in .nextflow/plugins the right version and your pipeline is using it
sometimes I upgrade or compile using a different version and forget to update the nextflow.config file
n
I'm using
export NXF_PLUGINS_DEV="${PWD}/plugins"
or is that not the right way to do it?
j
yes, this is another valid way
n
I'll try it your way maybe it works 😁
j
did you add the extension point to the idx file, right?
n
yes!
Copy code
nextflow.drs.DrsObserverFactory
nextflow.drs.DrsExtension
It does seem to work using your method!
It still doesn't find the observer but the extension point works 😛
🤣 1
But I get an error about the observer now, which is more than before 😛
I managed to get it working after updating the Nextflow compile version. thank you for all the help debugging 😛
🙌 1