Adds analysis registration script#194
Conversation
|
At the moment cpg-utils does not depend on metamist; meanwhile metamist does use cpg-utils. Also cpg-utils is purely a library for use from Python code and does not currently contain any scripts. So this doesn't seem like a great fit for cpg-utils. Are there other places this facility could be added instead to make it widely available? |
|
Strategically this is both a script and an importable process - allowing its use as a standalone script doesn't affect anything else in the library - taking behaviour we only previously accessed via prod-pipes and CPG-Flow, and casting it as a generically accessible function with a simple interface. This core function is required across all workflows during the migration away from CPG-Flow/hail batch as our runner, so it should live somewhere communal, and CPG-utils is already ubiquitous either directly or as a dependency in all our workflows. |
Johnnyassaf
left a comment
There was a problem hiding this comment.
From a design perspective I understand not wanting to introduce a dependency on metamist, and not wanting to risk a cyclic dependency.
We don't really have a communal scripts repo though and I think this script fits in cpg-utils as CPG communal code that can live as a script (just register jobs when you're done with work) or as a function (register outputs as part of a job). As long as we ensure that the metamist functions imported here don't import this cpg-utils script in the future, it should be fine.
|
I guess the onus is on the PR's proponents to demonstrate that the cyclic dependency is not an issue. I see this as yet more grist for the mill of sorting out a suitable location for scripts. |
|
I'm not sure where this talk of cyclic dependencies is coming from. There's no install-time cyclic issues, pip or any other package manager treats this as an "other and self" dependency resolution, not a recursion risk. There are cpg-utils imports within the metamist library, but a new import of This is adding new functionality to be used globally across the CPG, which is the exact remit of cpg-utils. It is not a |
Alexander-Stuckey
left a comment
There was a problem hiding this comment.
Few comments, mostly looks good
A candidate collection of methods/standalone script for registering outputs in metamist. This general process has been trialled in NF/Seqera workflows, but required the script to leave inside each workflow. Migrating this code upstream will mean each CPG-Utils install makes this available.
This is not a script per se, it's a parameterised metamist interaction for registering analyses. The previous incarnation in the seqera-trial repository was a script, because that's what NextFlow required. This implementation takes that same interaction, keeps a script-like entrypoint, and also adds the same functionality as an importable method. The exact same logic is exposed both ways, making this solution usable for both code-accessed and cli-accessed registrations.
This file contains a
__main__entrypoint, or a direct-usecreate_newmethod. If called as a script the CLI looks like:If run via import in code, usage looks like:
This interface takes:
The result is:
The analysis record 388733 has been generated by this process as a demonstration, go check it out.