Skip to content

Commit

Permalink
fix: new 'handover' section support
Browse files Browse the repository at this point in the history
Resolves: #362
  • Loading branch information
Dmitry Kochik committed Jul 8, 2021
1 parent 21645dd commit 5b3f126
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Released on ...
- TODO (see [#NNN](https://github.com/JetBrains-Research/snakecharm/issues/NNN))

### Fixed
- Support for 'handover' section (see [#362](https://github.com/JetBrains-Research/snakecharm/issues/362))
- TODO (see [#NNN](https://github.com/JetBrains-Research/snakecharm/issues/NNN))

## [2021.2.424]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.jetbrains.snakecharm.lang.SnakemakeNames.SECTION_CONTAINER
import com.jetbrains.snakecharm.lang.SnakemakeNames.SECTION_CWL
import com.jetbrains.snakecharm.lang.SnakemakeNames.SECTION_ENVMODULES
import com.jetbrains.snakecharm.lang.SnakemakeNames.SECTION_GROUP
import com.jetbrains.snakecharm.lang.SnakemakeNames.SECTION_HANDOVER
import com.jetbrains.snakecharm.lang.SnakemakeNames.SECTION_INPUT
import com.jetbrains.snakecharm.lang.SnakemakeNames.SECTION_LOG
import com.jetbrains.snakecharm.lang.SnakemakeNames.SECTION_MESSAGE
Expand Down Expand Up @@ -85,7 +86,8 @@ object SnakemakeAPI {
SECTION_CWL, SECTION_BENCHMARK, SECTION_VERSION,
SECTION_MESSAGE, SECTION_THREADS, SECTION_SINGULARITY,
SECTION_PRIORITY, SECTION_CONDA, SECTION_GROUP,
SECTION_SHADOW, SECTION_CACHE, SECTION_NOTEBOOK, SECTION_CONTAINER
SECTION_SHADOW, SECTION_CACHE, SECTION_NOTEBOOK, SECTION_CONTAINER,
SECTION_HANDOVER
)

/**
Expand All @@ -100,7 +102,8 @@ object SnakemakeAPI {
SECTION_CACHE,
SECTION_CONTAINER,
SECTION_ENVMODULES,
SECTION_NAME
SECTION_NAME,
SECTION_HANDOVER
)
val RULE_OR_CHECKPOINT_SECTION_KEYWORDS = (RULE_OR_CHECKPOINT_ARGS_SECTION_KEYWORDS + setOf(SnakemakeNames.SECTION_RUN))

Expand Down Expand Up @@ -152,7 +155,8 @@ object SnakemakeAPI {
SECTION_WRAPPER,
SECTION_VERSION, SECTION_THREADS,
SECTION_PRIORITY, SECTION_SINGULARITY, SECTION_CACHE,
SECTION_CONTAINER, SECTION_NOTEBOOK, SECTION_ENVMODULES
SECTION_CONTAINER, SECTION_NOTEBOOK, SECTION_ENVMODULES,
SECTION_HANDOVER
)

/**
Expand Down Expand Up @@ -210,7 +214,8 @@ object SnakemakeAPI {
val SECTIONS_WHERE_KEYWORD_ARGS_PROHIBITED = setOf(
SECTION_BENCHMARK, SECTION_VERSION, SECTION_MESSAGE, SECTION_SHELL, SECTION_THREADS, SECTION_SINGULARITY,
SECTION_PRIORITY, SECTION_GROUP, SECTION_SHADOW, SECTION_CONDA, SECTION_SCRIPT, SECTION_WRAPPER,
SECTION_CWL, SECTION_NOTEBOOK, SECTION_CACHE, SECTION_CONTAINER, SECTION_ENVMODULES, SECTION_NAME
SECTION_CWL, SECTION_NOTEBOOK, SECTION_CACHE, SECTION_CONTAINER, SECTION_ENVMODULES, SECTION_NAME,
SECTION_HANDOVER
)

val IO_FLAG_2_SUPPORTED_SECTION: HashMap<String, List<String>> = hashMapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ object SnakemakeNames {
const val SECTION_NOTEBOOK = "notebook"
const val SECTION_ENVMODULES = "envmodules" // >= 5.9
const val SECTION_NAME = "name" // >= 5.31
const val SECTION_HANDOVER = "handover" // >= 6.2

const val RUN_SECTION_VARIABLE_RULE = "rule"
const val RUN_SECTION_VARIABLE_JOBID = "jobid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Feature: Completion after rule/checkpoint name e.g. rules.NAME.input
| run |
| script |
| name |
| handover |
Examples:
| rule_like | injection_left | injection_right |
| rule | | |
Expand Down Expand Up @@ -122,6 +123,7 @@ Feature: Completion after rule/checkpoint name e.g. rules.NAME.input
| run |
| script |
| name |
| handover |
Examples:
| rule_like |
| rule |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Feature: Completion for sections/variables in SmkSL injections
priority: 1
name: "new_rule_name"
script: ""
handover: True
shell: "{}"
run: shell("{}")
"""
Expand All @@ -96,6 +97,7 @@ Feature: Completion for sections/variables in SmkSL injections
| script |
| cache |
| name |
| handover |
Examples:
| rule_like | signature |
| rule | shell: "{ |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Feature: Inspection for unexpected keyword arguments in section
| rule | singularity |
| rule | threads |
| rule | name |
| rule | handover |
| checkpoint | message |
| checkpoint | notebook |
| checkpoint | priority |
Expand All @@ -52,6 +53,7 @@ Feature: Inspection for unexpected keyword arguments in section
| checkpoint | shell |
| checkpoint | version |
| checkpoint | wrapper |
| checkpoint | handover |

Scenario Outline: No warn on expected keyword arguments in rule\checkpoint
Given a snakemake project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Feature: Annotate additional syntax
| rule | run | "" | PY.PREDEFINED_DEFINITION |
| rule | wrapper | "" | PY.DECORATOR |
| rule | name | "" | PY.DECORATOR |
| rule | handover | "" | PY.DECORATOR |
| checkpoint | output | "file.txt" | PY.DECORATOR |
| checkpoint | run | "" | PY.PREDEFINED_DEFINITION |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ Feature: Resolve for section after rule/checkpoint name e.g. rules.NAME.input
script: ""
shell: ""
cache: True
handover: True
run:
rule ANOTHER_NAME:
Expand All @@ -181,6 +182,7 @@ Feature: Resolve for section after rule/checkpoint name e.g. rules.NAME.input
| script |
| cache |
| name |
| handover |

Scenario Outline: Resolve for available sections
Given a snakemake project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,18 @@ Feature: Resolve for section names in rules and checkpoints
| <section> | <file> | <times> | <class> |
Examples:
| rule_like | text | section | file | times | class |
| rule | output: "" | output | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | input: "" | input | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | params: "" | params | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | log: "" | log | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | resources: "" | resources | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | version: "" | version | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | threads: 1 | threads | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| checkpoint | output: "" | output | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| checkpoint | threads: 1 | threads | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule_like | text | section | file | times | class |
| rule | output: "" | output | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | input: "" | input | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | params: "" | params | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | log: "" | log | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | resources: "" | resources | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | version: "" | version | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | threads: 1 | threads | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| rule | handover: True | handover | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| checkpoint | output: "" | output | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| checkpoint | threads: 1 | threads | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
| checkpoint | handover: True | handover | foo.smk | 1 | SmkRuleOrCheckpointArgsSectionImpl |
Scenario Outline: Do not resolve to section in another rule, part1 (correct filters in SmkPyReferenceImpl)
Given a snakemake project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Feature: Resolve for sections/variables in SmkSL injections
name: "new_rule_name"
resources: a=""
script: ""
handover: True
shell: "{<section>}"
run:
"""
Expand All @@ -65,6 +66,7 @@ Feature: Resolve for sections/variables in SmkSL injections
| script |
| cache |
| name |
| handover |
Scenario Outline: Resolve for python specific variables for sections w/o arguments
Given a <smk_vers> project
Expand Down

0 comments on commit 5b3f126

Please sign in to comment.