Skip to content

Commit eef9c7e

Browse files
authored
[DEMO] App runner demo (#57)
* add demo app with app runner integration Signed-off-by: Victor Chang <[email protected]>
1 parent 0980fe2 commit eef9c7e

File tree

10 files changed

+639
-1
lines changed

10 files changed

+639
-1
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ name: ci
77
on:
88
# Triggers on pushes and on pull requests
99
push:
10+
paths-ignore:
11+
- 'demos/**'
1012
pull_request:
13+
paths-ignore:
14+
- 'demos/**'
1115

1216
# Allows you to run this workflow manually from the Actions tab
1317
workflow_dispatch:

demos/app_runner/.gitignore

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# job dir
2+
jobs/
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
share/python-wheels/
27+
*.egg-info/
28+
.installed.cfg
29+
*.egg
30+
MANIFEST
31+
32+
# PyInstaller
33+
# Usually these files are written by a python script from a template
34+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
35+
*.manifest
36+
*.spec
37+
38+
# Installer logs
39+
pip-log.txt
40+
pip-delete-this-directory.txt
41+
42+
# Unit test / coverage reports
43+
htmlcov/
44+
.tox/
45+
.nox/
46+
.coverage
47+
.coverage.*
48+
.cache
49+
nosetests.xml
50+
coverage.xml
51+
*.cover
52+
*.py,cover
53+
.hypothesis/
54+
.pytest_cache/
55+
cover/
56+
57+
# Translations
58+
*.mo
59+
*.pot
60+
61+
# Django stuff:
62+
*.log
63+
local_settings.py
64+
db.sqlite3
65+
db.sqlite3-journal
66+
67+
# Flask stuff:
68+
instance/
69+
.webassets-cache
70+
71+
# Scrapy stuff:
72+
.scrapy
73+
74+
# Sphinx documentation
75+
docs/_build/
76+
77+
# PyBuilder
78+
.pybuilder/
79+
target/
80+
81+
# Jupyter Notebook
82+
.ipynb_checkpoints
83+
84+
# IPython
85+
profile_default/
86+
ipython_config.py
87+
88+
# pyenv
89+
# For a library or package, you might want to ignore these files since the code is
90+
# intended to run in multiple environments; otherwise, check them in:
91+
# .python-version
92+
93+
# pipenv
94+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
96+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
97+
# install all needed dependencies.
98+
#Pipfile.lock
99+
100+
# poetry
101+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
102+
# This is especially recommended for binary packages to ensure reproducibility, and is more
103+
# commonly ignored for libraries.
104+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
105+
#poetry.lock
106+
107+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
108+
__pypackages__/
109+
110+
# Celery stuff
111+
celerybeat-schedule
112+
celerybeat.pid
113+
114+
# SageMath parsed files
115+
*.sage.py
116+
117+
# Environments
118+
.env
119+
.venv
120+
env/
121+
venv/
122+
ENV/
123+
env.bak/
124+
venv.bak/
125+
126+
# Spyder project settings
127+
.spyderproject
128+
.spyproject
129+
130+
# Rope project settings
131+
.ropeproject
132+
133+
# mkdocs documentation
134+
/site
135+
136+
# mypy
137+
.mypy_cache/
138+
.dmypy.json
139+
dmypy.json
140+
141+
# Pyre type checker
142+
.pyre/
143+
144+
# pytype static type analyzer
145+
.pytype/
146+
147+
# Cython debug symbols
148+
cython_debug/
149+
150+
# PyCharm
151+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
152+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
153+
# and can be added to the global gitignore or merged into this file. For a more nuclear
154+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
155+
#.idea/

demos/app_runner/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# DEMO: MONAI Deploy App SDK App Runner Integration
2+
3+
This demo shows how an application integrates with the MONAI Deploy Informatics Gateway (MIG) by subscribing to events emitted by MIG and launches the configured MONAI Deploy Application Package (MAP).
4+
5+
6+
![Demo-AppRunner](./demo-apprunner.png)
7+
8+
## Requirements
9+
10+
- MONAI Deploy Informatics Gateway 0.1.1+
11+
- MONAI Deploy App SDK 0.2.1+
12+
- A MAP from the [examples](https://github.com/Project-MONAI/monai-deploy-app-sdk/tree/main/examples/apps/) or BYO MAP.
13+
- RabbitMQ configured and running
14+
- MinIO configured and running
15+
- Python 3.7+
16+
17+
18+
## Running the demo
19+
20+
1. Install requirements specified above
21+
2. Configure an AET with one or more workflows. For example, the following command would trigger the `dcm-to-img:latest` MAP.
22+
```
23+
mig-cli aet add -a DCM2PNG -w dcm-to-img:latest -v
24+
```
25+
3. Install python dependencies specified in [requirements.txt](./requirements.txt)
26+
4. Edit `config.json` and change:
27+
1. `endpoint`/`host`, `username`, and `password` for both storage and messaging services
28+
2. `bucket` where payloads are stored
29+
5. python app.py
30+
31+
**Notes**: For MONAI Deploy App SDK 0.2.1, set `ignore_json` to `false` in the `config.json` file so DICOM JSON files are not downloaded.
32+
33+
## Job Directory Structure
34+
35+
Both retrieved input dataset and MAP generated output are stored under the `jobs/` directory which is configurable in the
36+
`config.json` file under `working_dir`.
37+
38+
A subdirectory is created for each request received using the `correlation_id` specified in the payload.
39+
Given that one or more workflows can be specified in the payload, output generated from each MAP is stored under `jobs/{correlation_id}/output/{map_name}`.
40+
41+
Sample output of `jobs` directory:
42+
```
43+
└── db61c4fc-b84e-4255-b40a-60254f93ca6f (correlation_id of the request)
44+
├── input
45+
└── output
46+
└── dcm-to-img-latest (name of the workflow/MAP)
47+
```
48+
49+
## Other Ideas
50+
51+
💡 Instead of calling App Runner, integrate with [MIS](https://github.com/Project-MONAI/monai-deploy-app-server)

0 commit comments

Comments
 (0)