Code Monkey home page Code Monkey logo

Comments (4)

ASLeonard avatar ASLeonard commented on June 12, 2024 1

It is a fragile hack, but rather than importing submodules you can just make a rule in your top snakefile that runs the submodule directly. This would also solve your DAG visualiation, because the complex submodules only appear as the single rule “Create_transport_timeseries” etc (which then spawn all their own jobs when run). include: <submodule> can sometimes slow DAG building too much or have naming clashes, so each approach has its own drawbacks.

rule Create_transport_timeseries:
    input:
        <all input needed to start submodule>
    output:
       <any output you want from the entire submodule>
    shell:
        'snakemake -s <submodule> ...'

from snakemake.

irm-codebase avatar irm-codebase commented on June 12, 2024

It is a fragile hack, but rather than importing submodules you can just make a rule in your top snakefile that runs the submodule directly. This would also solve your DAG visualiation, because the complex submodules only appear as the single rule “Create_transport_timeseries” etc (which then spawn all their own jobs when run). include: <submodule> can sometimes slow DAG building too much or have naming clashes, so each approach has its own drawbacks.

rule Create_transport_timeseries:
    input:
        <all input needed to start submodule>
    output:
       <any output you want from the entire submodule>
    shell:
        'snakemake -s <submodule> ...'

Thank you for the input. This might work! Testing shows some issues, though.
With the following structure:

project
- Snakemake
- output/
- modules/
    - light/
        - output/ 
        - Snakemake

I run

rule run_light_submodule:
    input:
        "output/global.txt"
    output:
        "modules/light/output/final.txt"
    shell:
        'snakemake -s modules/light/Snakefile -c 1'

Which returns

LockException:
Error: Directory cannot be locked. Please make sure that no other Snakemake process is trying to create the same files in the following directory:
/home/ivanruizmanuel/Documents/git/snakemake_tests
If you are sure that no other instances of snakemake are running on this directory, the remaining lock was likely caused by a kill signal or a power loss. It can be removed with the --unlock argument.
[Wed Mar 27 15:15:13 2024]
Error in rule run_light_submodule:
    jobid: 8
    input: output/global.txt
    output: modules/light/output/final.txt
    shell:
        snakemake -s modules/light/Snakefile -c 1
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: .snakemake/log/2024-03-27T151513.412171.snakemake.log
WorkflowError:
At least one job did not complete successfully.

It seems like the subfolder is locked by snakemake... any advice?

from snakemake.

ASLeonard avatar ASLeonard commented on June 12, 2024

You should pass --nolock to any "submodule" snakemake calls, as well as any config/profile args you would normally run them with

from snakemake.

irm-codebase avatar irm-codebase commented on June 12, 2024

In the end, I just went with the module functionality.
It's... not perfect, and does not abstract the DAG, but it's enough for now.

from snakemake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.