Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
7333647
Merge branch 'bugfix/avoid-detecting-changes-for-tasks-with-no-tests'…
Mar 5, 2024
3727b17
Add command to calculate coverage for each task and output
Mar 5, 2024
ceeb069
Add initial version of script/CLI command to output task and output c…
Mar 6, 2024
0b940ef
Make minor formatting adjustments
Mar 6, 2024
4abf55a
Make more minor formatting adjustments
Mar 6, 2024
2425e70
Remove check and append to list for tests with no tasks
Mar 6, 2024
cf8a6ed
Adjust formatting of print statements
Mar 6, 2024
45f99e8
Remove creation of unused list
Mar 7, 2024
013cdec
Adjust style of warnings to match internal format
Mar 7, 2024
0eea505
Initial commit for handling output key errors
Mar 7, 2024
bf59f2d
Add error message for when an output key is not found
Mar 8, 2024
89e896c
Add error message for when an output key is not found
Mar 8, 2024
bdd8e82
Reorganize and simplify handling of missing outputs key error
Mar 11, 2024
4ba4380
Further reorganize and simplify handling of missing outputs key error
Mar 11, 2024
76dda77
Fix creation of list of outputs
Mar 12, 2024
6171a33
Adjust style of warnings to match internal format
Mar 13, 2024
ebd8a3d
Merge branch 'develop' into feature/task-and-output-test-coverage
hkeward Mar 13, 2024
0639e9a
Test handling of output key error in submit script instead of write_w…
Mar 14, 2024
bd269ed
Add comments for clarity
Mar 14, 2024
331d6e8
Merge branch 'feature/task-and-output-test-coverage' into feature/han…
geneticsjesse Mar 14, 2024
2efa231
Revert all commits that handled output key errors in write_workflow
Mar 14, 2024
5334c53
Merge pull request #49 from DNAstack/feature/handle-output-key-error
geneticsjesse Mar 27, 2024
09d4094
Add documentation surrounding wdl-ci coverage command
Mar 27, 2024
b46ffae
Rename subcommand; remove old subcommand script
Apr 4, 2024
f611b09
Add coverage subcommand to calculate and display test coverage
Apr 4, 2024
8d9d5ce
Adjust subcommand to handle compound outputs; clean up calculations
Apr 5, 2024
d8c0ad7
Adjust formatting/organization of task coverage output
Apr 5, 2024
5bb45db
Wrap task name properly
Nov 15, 2024
2f0e8cc
Clarify parameter precedence
hkeward Nov 18, 2024
3ac87fc
Improve coverage calculation login; add specific warning for optional…
Nov 21, 2024
0a762f0
Merge branch 'feature/task-and-output-test-coverage' of https://githu…
Nov 21, 2024
8498965
Add threshold and workflow name arguments to coverage command
Nov 21, 2024
8e88ad1
Implement usage of threshold and workflow name within coverage command
Nov 21, 2024
a29df08
Add context to new features of wdl-ci coverage
Nov 21, 2024
a998e8f
Clean up documentation
Nov 22, 2024
eec18b2
Merge branch 'main' of https://github.com/DNAstack/wdl-ci into featur…
Nov 22, 2024
624b22a
Make formatting changes
Nov 22, 2024
b6a665e
Report to user any optional input not covered as part of wdl-ci tests
Nov 22, 2024
c4da040
Comment out print statement re: optional inputs; add relevant TODO
Nov 22, 2024
fb07f30
Remove unused input checking code; adjust TODO
Nov 25, 2024
09057ef
Merge branch 'main' into feature/task-and-output-test-coverage
hkeward Nov 29, 2024
2f3248c
Rename coverage_threshold to target_coverage to make it a bit clearer
hkeward Nov 29, 2024
149eb63
Update docs for changed arg name
hkeward Nov 29, 2024
8b8b032
Remove comment and creation of set; add check for length to avoid fal…
Dec 5, 2024
b24c357
Clarify workflow file name is required
Dec 5, 2024
5052744
Avoid more false-y traps; remove redundant checks if threshold is not…
Dec 5, 2024
3ec8f62
Fix check for threshold > task_coverage or threshold not specified
Dec 5, 2024
ac61953
Avoid more false-ys; add TODOs
Dec 6, 2024
5538a07
Begin working through PR revisions; making holistic changes to test n…
Dec 6, 2024
262f0ea
Add function for repeated code and import/implement
Dec 9, 2024
fbf2645
Clarify how to provide workflow name based on changes to coverage com…
Dec 10, 2024
7c8bc76
Get command in a functional state based on PR revisions; UX changes a…
Dec 10, 2024
f180629
Remove some dev code and a TODO
Dec 10, 2024
3647f99
Add TODOs for more flags for the coverage command
Dec 12, 2024
2b88c42
Add working version but still in dev
Dec 12, 2024
12edb32
Remove redundant code that was refactored with helper functions
Dec 12, 2024
a66bde7
Remove unnecessary print
Dec 13, 2024
e79a4ad
Handle case where test_tasks is an empty list; would have considered …
Dec 13, 2024
4ed57c1
Adjust comment wording
Dec 13, 2024
f1c3ee0
Add .DS_STORE
Dec 13, 2024
4237fd4
Adjust TODO
Dec 13, 2024
e243224
Add tests for coverage handler -- in dev
Dec 13, 2024
8187b2b
Improve naming conventions of coverage_summary keys; set boolean flag…
Dec 13, 2024
086c75a
Add additional handling of boolean checks
Dec 13, 2024
3cebce8
Added extra test; rename coverage summary keys
Dec 13, 2024
c6e774c
Improve prints; return tested outputs for each {workflow.task}
Dec 13, 2024
36b712b
Suppress ResourceWarning; add additional tests to add; comment out se…
Dec 13, 2024
7ff888e
Move tests dir
Dec 13, 2024
9f83394
Fix typo
Dec 13, 2024
32c214d
Remove unused file with single test
Dec 13, 2024
f7166e0
Add more tests to add
Dec 13, 2024
3a2100e
Comment our warning suppression so I can handle it later
Dec 13, 2024
9156cdc
Adjust name of coverage_summary dict keys
Dec 13, 2024
ba14693
Add threshold to test
Dec 13, 2024
4c589e2
rename test
Dec 13, 2024
a8833d4
Rename key
Dec 13, 2024
660f8be
Improve naming conventions
Dec 13, 2024
987a03c
Add explicit tests for any remaining instances of if <varname>
Dec 13, 2024
074bde5
Add clarity in some comments; add single TODO
Dec 13, 2024
0a0ec33
Avoid adding to untested_outputs_dict if there are no missing outputs
Dec 14, 2024
d6c82f4
Avoid adding to tested_outputs_dict if there are no tested outputs
Dec 14, 2024
351a3ad
Add a class method to reset the config and reset it at the end of the…
Dec 14, 2024
9e5a19b
Redirect stdout to hide coverage output; suppress warning as part of …
Dec 14, 2024
586ce4d
Set tasks below threshold to false if there is the workflow is skippe…
Dec 14, 2024
98e2c31
Add more tests; still in dev
Dec 14, 2024
b271da1
Set tasks_below_threshold to false if workflows are skipped based on …
Dec 16, 2024
2a59feb
Set workflow_found via else explicitly
Dec 16, 2024
47c97df
Remove TODO
Dec 16, 2024
9a667b9
Add three threshold tests; add test for optional inputs
Dec 16, 2024
db6c3fd
Clarify TODO
Dec 16, 2024
a727fbf
Remove TODO; improve naming of all tests list; handle case where no o…
Dec 16, 2024
1645d98
Remove another TODO
Dec 16, 2024
59e65cc
Rename for clarity
Dec 16, 2024
b1f68b9
Simplify workflow_name_filter returned to user; remove check for filt…
Dec 16, 2024
b2e46a9
Add test todo
Dec 17, 2024
3385477
Remove comment; explicitly check workflow name; rename function for c…
Dec 17, 2024
b21590a
Move reset of config into a finally block
Dec 18, 2024
87b6ae9
Adjust if to elif
Dec 18, 2024
7396c86
Add todo
Dec 18, 2024
b391d6e
Simplify checking for missing outputs
hkeward Dec 18, 2024
ac98336
Allow multiple workflow filters to be passed
hkeward Dec 18, 2024
7def2da
Move coverage summary inside function; change strategy for detecting
hkeward Dec 18, 2024
db8950c
Moved final output messages around
hkeward Dec 18, 2024
6d49270
Add skipped workflows to check prior to printing warnings
Dec 20, 2024
2103dac
Adjust total and workflow output counts to lists; write function to u…
Jan 8, 2025
f4d8b57
Remove redundant code; begin trying to handle nested imports - in dev
Jan 8, 2025
8c650d0
Revert "Remove redundant code; begin trying to handle nested imports …
Jan 8, 2025
e369b38
Revert "Adjust total and workflow output counts to lists; write funct…
Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,6 @@ dmypy.json

.wdltest.changes.json
.wdltest.submission.json

# MAC
*.DS_STORE
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ Test params can be used to avoid repeating paths and values for test inputs and
- For parameters whose value is an object, object members can be accessed using `.`s: `"reference_index": ${reference.fasta.data_index}`
- Global params will replace values for all engines
- Engine params will replace values only when submitting to a particular engine; useful if for example input sets exist across multiple environments and are prefixed with different paths
- For parameters with the same key, `engine_params` take precedence over `global_params`
- Objects and arrays can be used for parameters; if you are using a complex parameter as an input or output value, this parameter must be the only content of the value, e.g. `"my_input": "${complex_param}"`, not `"my_input": "gs://my_bucket/${complex_param}"`
- The values of complex parameters can themselves use parameters, and will be substituted appropriately

Expand Down Expand Up @@ -459,6 +460,31 @@ If a configuration file already exists, this will add workflows or tasks that do

`wdl-ci generate-config [--remove]`

## Calculate coverage

Calculates percent coverage for each task and workflow. Task coverage is computed as the sum of task outputs with at least one test divided by the number of task outputs, while workflow coverage is computed as the sum of task outputs across all tasks with at least one test divided by the number of task outputs across all tasks within a given workflow. Total coverage is also computed, as the total number of outputs with tests defined divided by the number of total outputs across all workflows. If there are any tasks or outputs with no tests, a warning is provided to the user, listing the relevant outputs and associated tasks.

As long as an output is covered by one task, it is considered to be 100% covered, while if 3/4 outputs for a task have at least one test, that task has 75% test coverage.

Example output:

```
workflowNameA coverage: 84%
taskA coverage: 75%
taskB coverage: 63%
taskC coverage: 100%
taskD coverage: 100%
workflowNameB coverage: 100%
taskA coverage: 100%
taskB coverage: 100%
...
Total coverage across outputs and tasks among all workflows: 89%
```

`wdl-ci coverage` can be run with additional options to filter results and set thresholds. The `--workflow-name` option allows the user to specify a workflow name to filter the results, showing only the coverage for that specific workflow. The `--target-coverage` option takes a float percent value and allows the user to set a threshold percentage; only tasks and workflows with coverage below this threshold will be displayed. If no tasks/workflows match the specified filter, a message will be printed to inform the user. Additionally, if all optional outputs are tested, a confirmation message will be displayed.

`wdl-ci coverage --workflow-name <workflow_name> --target-coverage <threshold>`

## Lint workflows

`wdl-ci lint`
Expand Down
33 changes: 33 additions & 0 deletions src/wdlci/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from wdlci.cli.submit import submit_handler
from wdlci.cli.monitor import monitor_handler
from wdlci.cli.cleanup import cleanup_handler
from wdlci.cli.coverage import coverage_handler
from wdlci.utils.ordered_group import OrderedGroup

remove_option = click.option(
Expand Down Expand Up @@ -34,6 +35,23 @@
help="Do not exit upon encountering a linting warning or error",
)

target_coverage = click.option(
"--target-coverage",
"-t",
type=float,
default=None,
show_default=True,
help="Target coverage (%); only output tasks or workflows with test coverage below this threshold",
)

workflow_name = click.option(
"--workflow-name",
"-w",
multiple=True,
show_default=True,
help="Set of workflows to filter by; should be the full path to this workflow (same as the key in the config file)",
)


@click.group(cls=OrderedGroup)
@click.version_option(
Expand Down Expand Up @@ -100,3 +118,18 @@ def cleanup(**kwargs):
"""Clean Workbench namespace of transient artifacts"""

cleanup_handler(kwargs)


@main.command
@target_coverage
@workflow_name
# TODO: Add options for minimalist output; e.g., maybe hide warning output for:
# tests that don't have tests both excluding and including optional inputs
# list of outputs that are not tested for each task
# skipped workflows
# workflows that have outputs but no tests
# TODO: Add option to consider totally untested tasks/outputs as 0% coverage or ignore them
def coverage(**kwargs):
"""Outputs percent coverage for each task and output, and which tasks/outputs have no associated tests"""

coverage_handler(kwargs)
Loading