Skip to content

SEAB-7130: Require that the initial path point at a Snakefile#3

Merged
svonworl merged 1 commit intodevelopfrom
feature/seab-7130/enforce-snakemake-primary-descriptor
Apr 30, 2025
Merged

SEAB-7130: Require that the initial path point at a Snakefile#3
svonworl merged 1 commit intodevelopfrom
feature/seab-7130/enforce-snakemake-primary-descriptor

Conversation

@svonworl
Copy link

@svonworl svonworl commented Apr 29, 2025

This PR updates the snakemake plugin so that the initial path must point at a Snakefile for the resulting version to be valid. It also changes the initialPathPattern to match any absolute path that ends with /Snakefile or /snakefile (see the documentation for the --snakefile option for why we would support the lowercase name https://snakemake.readthedocs.io/en/stable/executing/cli.html).

The goal is to prevent any valid Snakemake versions from having a primary descriptor that isn't the Snakefile.

Some notes and observations:

  • The plugin initialPathPattern method does not appear to be used anywhere in our codebase, other than to output some diagnostic information. One might expect our workflow registration code to confirm that the initial path matches the pattern, but it does not. Essentially, this PR implements this type of check in the Snakemake plugin, only, to avoid breaking existing workflows of other types that might fail such a test.

  • Currently, there is no defined way for a plugin to intentionally signal an exceptional condition to the surrounding code, in a way that the surrounding code can tell the difference between the intentional exception and and some other type of RuntimeException that resulted from a bug. Such a mechanism would be useful in cases that the plugin purposefully wanted to "throw up its hands", stop, and propagate a reason to the surrounding code.

  • The FileReader interface is functionally very similar to the FileTree abstraction introduced by the inference code. It is my belief that, conceptually, they are analogs.

  • If we're serious about using the plugin architecture to support more workflow types, we should assess its architecture to make sure it is flexible enough to field all of the possible workflow types we might throw at it. Sooner we do this, the less plugins we'll need to rewrite.

  • Our registration code has some pretty deep spaghetti in spots, through which the repo access code is interleaved. At some point, when we have the time, it would be great to refactor. It would take a while, but make the code much easier to understand and maintain, and give us the ability to do some interesting new stuff.

@denis-yuen
Copy link
Member

  • One might expect our workflow registration code to confirm that the initial path matches the pattern, but it does not.

Fair and probably an oversight

intentionally signal an exceptional condition to the surrounding code

Makes sense to define our own runtime exception if needed

@svonworl svonworl merged commit a1fd0ec into develop Apr 30, 2025
1 check passed
@denis-yuen denis-yuen deleted the feature/seab-7130/enforce-snakemake-primary-descriptor branch May 2, 2025 14:34
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.

3 participants