Skip to content

Commit 57773bc

Browse files
authored
Merge pull request #770 from Project-MONAI/AC-1810
Handled Exception Metadata documentation
2 parents c97df30 + e589dc2 commit 57773bc

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

docs/setup/mwm-workflow-spec.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ Workflows can be created or updated via the [Workflow API](https://github.com/Pr
4848
- [Plugin](#plugin)
4949
- [Task Arguments](#task-arguments)
5050
- [Argo](#argo)
51-
- [Resource Request Object](#resource-request-object)
5251
- [Clinical Review](#clinical-review)
5352
- [Router](#router-1)
5453
- [Export](#export-1)
@@ -69,6 +68,7 @@ Workflows can be created or updated via the [Workflow API](https://github.com/Pr
6968
- [Execution Context](#execution-context)
7069
- [Result Metadata \& Execution Stats - Using Dictionary Values](#result-metadata--execution-stats---using-dictionary-values)
7170
- [Argo Metadata](#argo-metadata)
71+
- [Handled Exception Metadata](#handled-exception-metadata)
7272
- [DICOM Tags](#dicom-tags)
7373
- [Patient Details Context](#patient-details-context)
7474
- [Workflow Context](#workflow-context)
@@ -711,7 +711,7 @@ Conditional evaluators are logical statement strings that may be used to determi
711711

712712
NOT_CONTAINS (Valid for integers and strings compared to lists)
713713

714-
more information on conditionals can be found [Conditionals Docs](guidelines\mwm-conditionals.md)
714+
more information on conditionals can be found [Conditionals Docs](..\..\guidelines\mwm-conditionals.md)
715715

716716
### Context
717717
The workflow metadata is any data that can be used by Evaluators. This includes metadata added by previous tasks, but can also include metadata about the input files (most notably DICOM tags).
@@ -799,6 +799,33 @@ An example format of the metadata.json can be found below:
799799

800800
execution stats are populated from the argo execution values returned automatically.
801801

802+
#### Handled Exception Metadata
803+
Application models can throw handled exceptions, to do this your application model should output the properties "exception" and "exception_message" to the `metadata.json`
804+
805+
Example...
806+
```json
807+
{
808+
"exception": "NoDicomFilesException",
809+
"exception_message": "No dicom files found."
810+
}
811+
```
812+
813+
We recommend your application exits execution once the metadata.json has been written.
814+
815+
This exception can be used in the workflow task destinations queries for example like the following examples...
816+
817+
```python
818+
{{ context.executions.task_id.result.exception }} == 'NoDicomFilesException' && {{ context.executions.task_id.result.exception_message }} == 'No dicom files found.'
819+
```
820+
821+
```python
822+
{{ context.executions.task_id.result.exception_message }} CONTAINS 'No dicom files'
823+
```
824+
825+
```python
826+
{{ context.executions.task_id.result.exception }} == NULL
827+
```
828+
802829

803830
#### DICOM Tags
804831
When the input data is DICOM, Evaluators can use DICOM tag values in conditional statements.

0 commit comments

Comments
 (0)