Skip to content

Commit 06a4182

Browse files
authored
App SDK Migration (to depend on Holoscan SDK) (#441)
* Squashed commit of the following: commit ec84820 Author: M Q <mingmelvinq@nvidia.com> Date: Tue Jul 18 11:42:45 2023 -0700 Aligned with the changes in v0.5.1 before rebase/merge Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 422add1 Author: M Q <mingmelvinq@nvidia.com> Date: Mon Jul 17 15:28:19 2023 -0700 Ran the remaining notebooks post Holoscan RC1 fix Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 3b06f9b Author: M Q <mingmelvinq@nvidia.com> Date: Mon Jul 17 12:13:35 2023 -0700 Made sure to use the App SDK in dev and the latest Holoscan build (post RC1) Signed-off-by: M Q <mingmelvinq@nvidia.com> commit fa7f913 Author: M Q <mingmelvinq@nvidia.com> Date: Mon Jul 17 12:06:29 2023 -0700 Ran the notebook successfully after Holoscan SDK fixed the early termination bug Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 154b242 Author: M Q <mingmelvinq@nvidia.com> Date: Mon Jul 3 15:46:26 2023 -0700 Update notebook after testing with App SDK on Holoscan v0.6 RC1 Note that apps with more complex graph, with fork and join, terminates early. This issue had came out after some commits in the Holoscan just before RC1. Will file a bug and investigate in Holoscan Signed-off-by: M Q <mingmelvinq@nvidia.com> commit cfabded Author: M Q <mingmelvinq@nvidia.com> Date: Fri Jun 30 15:27:16 2023 -0700 Update after rerun notebook Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 6f34784 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Jun 30 13:19:17 2023 -0700 Updated the notebook Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 6a04890 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Jun 30 10:47:36 2023 -0700 Remove importing a removed function from holoscan logger Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 5088c66 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Jun 30 00:04:08 2023 -0700 Remove import load_env_log_level in apps as the function is removed from holoscan Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 5d6ed8c Author: M Q <mingmelvinq@nvidia.com> Date: Tue Jun 27 18:47:59 2023 -0700 Fix formatting complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 4d380f7 Author: M Q <mingmelvinq@nvidia.com> Date: Tue Jun 27 18:25:13 2023 -0700 Remove redundant condition Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 30e13c7 Author: M Q <mingmelvinq@nvidia.com> Date: Tue Jun 27 18:04:27 2023 -0700 Updated the app to resolve PIL Image issue running in MAP container Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 78d58ff Author: M Q <mingmelvinq@nvidia.com> Date: Fri Jun 23 18:39:20 2023 -0700 Cleaned output before each run Signed-off-by: M Q <mingmelvinq@nvidia.com> commit a621e4b Author: M Q <mingmelvinq@nvidia.com> Date: Fri Jun 23 17:54:46 2023 -0700 update after rerunning cell by cell with kernal restart. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 9f14646 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Jun 23 16:54:17 2023 -0700 Update notebook after testing with latest SDK Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 2a42f21 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Jun 2 16:44:16 2023 -0700 Ran this notebook with dev version of holoscan v0.6 Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 8883028 Author: M Q <mingmelvinq@nvidia.com> Date: Tue May 16 00:08:38 2023 -0700 Migrated multi-AI and updated MedNIST Jupyter notebook Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 5fd613c Author: M Q <mingmelvinq@nvidia.com> Date: Mon May 15 17:21:34 2023 -0700 Add migrated Jupyter notebook for MedNIST app. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 70ee706 Author: M Q <mingmelvinq@nvidia.com> Date: Thu May 11 23:33:50 2023 -0700 Update Jupyter notebook Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 94d093a Author: M Q <mingmelvinq@nvidia.com> Date: Tue May 9 00:04:07 2023 -0700 fix complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> commit a4b9285 Author: M Q <mingmelvinq@nvidia.com> Date: Mon May 8 23:53:33 2023 -0700 Fix mytype complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 3e12c85 Author: M Q <mingmelvinq@nvidia.com> Date: Mon May 8 23:00:53 2023 -0700 Fix pytype complaint, details below File "/home/runner/work/monai-deploy-app-sdk/monai-deploy-app-sdk/monai/deploy/core/app_context.py", line 49, in update: Type annotation for models does not match type of assignment [annotation-type-mismatch] Annotation: monai.deploy.core.models.model.Model (Did you mean 'typing.Optional[monai.deploy.core.models.model.Model]'?) Assignment: None In assignment of type: Optional[monai.deploy.core.models.model.Model] Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 9fb7de6 Author: M Q <mingmelvinq@nvidia.com> Date: Mon May 8 22:51:09 2023 -0700 Removed unused import Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 44f7164 Author: M Q <mingmelvinq@nvidia.com> Date: Mon May 8 18:10:20 2023 -0700 Removed explictily loading from model file path, after model factory is used. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 708a05e Author: M Q <mingmelvinq@nvidia.com> Date: Mon May 8 10:46:55 2023 -0700 Fixed a typo and format Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 968b853 Author: M Q <mingmelvinq@nvidia.com> Date: Fri May 5 20:22:00 2023 -0700 WIP add Jupyter notebook for ClaraViz integration Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 36d632e Author: M Q <mingmelvinq@nvidia.com> Date: Thu May 4 23:47:25 2023 -0700 WIP Jupyter notebook update Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 247a352 Author: M Q <mingmelvinq@nvidia.com> Date: Thu May 4 00:07:15 2023 -0700 Mypy complaints as well as cleanup Signed-off-by: M Q <mingmelvinq@nvidia.com> commit e088953 Author: M Q <mingmelvinq@nvidia.com> Date: Wed May 3 23:10:15 2023 -0700 Flake8 complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 4b4d34c Author: M Q <mingmelvinq@nvidia.com> Date: Wed May 3 22:37:48 2023 -0700 Flake 8 complaint of unused import Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 016add6 Author: M Q <mingmelvinq@nvidia.com> Date: Wed May 3 22:10:51 2023 -0700 Enabled model factory and migrated multi-AI app Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 9675245 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 28 19:56:46 2023 -0700 Removed unused imports Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 58da261 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 28 19:05:44 2023 -0700 Updated the liver tumor example Signed-off-by: M Q <mingmelvinq@nvidia.com> commit b697b0e Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 28 18:27:05 2023 -0700 Migrated the UNetR app Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 3e4b839 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 28 15:24:16 2023 -0700 Saving uncompress nii file to save 10s in execution time Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 60ffd9e Author: M Q <mingmelvinq@nvidia.com> Date: Thu Apr 27 22:56:02 2023 -0700 iSort complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> commit a7e6702 Author: M Q <mingmelvinq@nvidia.com> Date: Thu Apr 27 21:12:01 2023 -0700 Migrated the MEDNIST app Signed-off-by: M Q <mingmelvinq@nvidia.com> commit edfd6e7 Author: M Q <mingmelvinq@nvidia.com> Date: Thu Apr 27 17:54:07 2023 -0700 Why the "./run check --autofix" again did not fix the complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 5d7c7d8 Author: M Q <mingmelvinq@nvidia.com> Date: Thu Apr 27 17:41:29 2023 -0700 Migrated the breast density classification app, and fixed a bug. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 7626078 Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 26 19:54:42 2023 -0700 Removed commented out code Signed-off-by: M Q <mingmelvinq@nvidia.com> commit df8db48 Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 26 19:43:13 2023 -0700 More missed complaint with local "./run check --autofix" Signed-off-by: M Q <mingmelvinq@nvidia.com> commit fec24aa Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 26 18:30:16 2023 -0700 flake8 complained but "./run check --autofix" did not. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 40b75be Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 26 18:16:34 2023 -0700 Fix mypy complaints for already migrated code. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit df4cfba Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 26 12:34:15 2023 -0700 iSort wants the import its way! Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 3c40512 Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 26 12:13:53 2023 -0700 More explicit imports to quiet mypy complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 77ce0f6 Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 26 11:33:33 2023 -0700 Use both explicit and wildcard import to quiet mypy complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 4671a2c Author: M Q <mingmelvinq@nvidia.com> Date: Tue Apr 25 22:03:07 2023 -0700 fix typo Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 29844a9 Author: M Q <mingmelvinq@nvidia.com> Date: Tue Apr 25 21:45:22 2023 -0700 Properly add the fucntion to fix holoscan init file. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 1145c15 Author: M Q <mingmelvinq@nvidia.com> Date: Tue Apr 25 15:38:55 2023 -0700 Use the correct path for the pacakge __init__.py Signed-off-by: M Q <mingmelvinq@nvidia.com> commit d200043 Author: M Q <mingmelvinq@nvidia.com> Date: Tue Apr 25 15:21:07 2023 -0700 In fact needed to fix holoscan/__init__.py Signed-off-by: M Q <mingmelvinq@nvidia.com> commit b95650a Author: M Q <mingmelvinq@nvidia.com> Date: Tue Apr 25 14:42:37 2023 -0700 Minor formatting change Signed-off-by: M Q <mingmelvinq@nvidia.com> commit ea9ae5d Author: M Q <mingmelvinq@nvidia.com> Date: Tue Apr 25 14:32:24 2023 -0700 Replace holoscan core __init__.py from v0.6 to fix import errors Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 3f7862a Author: M Q <mingmelvinq@nvidia.com> Date: Mon Apr 24 13:32:53 2023 -0700 AVoid import holoscan.operator as it drags in too much dependencies Signed-off-by: M Q <mingmelvinq@nvidia.com> commit f54fa7c Author: M Q <mingmelvinq@nvidia.com> Date: Sun Apr 23 22:21:59 2023 -0700 Fix pytype complaints, and remove an unused local variable Signed-off-by: M Q <mingmelvinq@nvidia.com> commit d45df16 Author: M Q <mingmelvinq@nvidia.com> Date: Sun Apr 23 21:57:13 2023 -0700 One mor pytype fix Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 7483e0a Author: M Q <mingmelvinq@nvidia.com> Date: Sun Apr 23 20:09:47 2023 -0700 Fix pytype complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> commit a0f013d Author: M Q <mingmelvinq@nvidia.com> Date: Sun Apr 23 19:29:11 2023 -0700 Missed checking in setup.cfg Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 000fa61 Author: M Q <mingmelvinq@nvidia.com> Date: Sun Apr 23 19:21:21 2023 -0700 Fix Flake8 complaints, e.g. "import *" which is needed. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit de06258 Author: M Q <mingmelvinq@nvidia.com> Date: Sun Apr 23 19:00:37 2023 -0700 Fix more Black complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 1271733 Author: M Q <mingmelvinq@nvidia.com> Date: Sun Apr 23 17:39:27 2023 -0700 Using the `!r` to replace literal quotes Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 6dda9d8 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 21 20:39:42 2023 -0700 iSort now complains about the best practice import order! Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 97fb812 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 21 20:19:22 2023 -0700 Fix Black complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> commit f1d05c3 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 21 17:24:16 2023 -0700 update min version of Python to 3.8 as required by Holoscan SDK Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 5f16e1b Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 12 18:17:21 2023 -0700 Migrate more apps Signed-off-by: M Q <mingmelvinq@nvidia.com> commit fff394d Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 12 12:09:24 2023 -0700 Migrate the ClaraViz operator Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 89153e0 Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 12 00:09:30 2023 -0700 Migrated the bundle inference operator and the sample app using it. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 84af3e1 Author: M Q <mingmelvinq@nvidia.com> Date: Mon Apr 10 00:10:50 2023 -0700 Migrated stl writer and the liver tumor seg example. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit ccaf1de Author: M Q <mingmelvinq@nvidia.com> Date: Sun Apr 9 18:06:53 2023 -0700 Updated the stl writer Signed-off-by: M Q <mingmelvinq@nvidia.com> commit f28e33c Author: M Q <mingmelvinq@nvidia.com> Date: Sat Apr 8 00:46:52 2023 -0700 PNG converter operator and the DICOM series to image app final update Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 228d195 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 7 18:48:39 2023 -0700 Add optional input to seg writer for overriding the output folder. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit f43bc35 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 7 12:14:58 2023 -0700 Fine tune the env var names Signed-off-by: M Q <mingmelvinq@nvidia.com> commit f2dbf45 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 7 10:53:20 2023 -0700 Change to env var prefix to HOLOSCAN_ Signed-off-by: M Q <mingmelvinq@nvidia.com> commit d62dd39 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Apr 7 00:28:57 2023 -0700 Make DICOM PDF and SR writer consistent Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 91ffbdb Author: M Q <mingmelvinq@nvidia.com> Date: Thu Apr 6 21:43:04 2023 -0700 Also dicom loader to support optional named input port for folder path to dcm files Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 21e59fc Author: M Q <mingmelvinq@nvidia.com> Date: Thu Apr 6 20:41:25 2023 -0700 Enhanced nii loader operator after testing with a single operator app. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 91652fc Author: M Q <mingmelvinq@nvidia.com> Date: Thu Apr 6 19:13:45 2023 -0700 Migrated the simple nii loader Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 3c58884 Author: M Q <mingmelvinq@nvidia.com> Date: Thu Apr 6 15:19:03 2023 -0700 Add the missed sub modules Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 24960d4 Author: M Q <mingmelvinq@nvidia.com> Date: Thu Apr 6 00:33:40 2023 -0700 Enhanced the code and documentation Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 60e1854 Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 5 16:21:23 2023 -0700 Make the contructor of the derived operators explictly requiring fragment as arg. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit c1395ee Author: M Q <mingmelvinq@nvidia.com> Date: Wed Apr 5 13:23:09 2023 -0700 Make use of Conditiontype.None to support dangling outputs Signed-off-by: M Q <mingmelvinq@nvidia.com> commit f81c905 Author: M Q <mingmelvinq@nvidia.com> Date: Tue Apr 4 18:23:39 2023 -0700 WIP check-in mostly for the enhanced simple imaging app. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 553bd99 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Mar 31 16:02:09 2023 -0700 Bump the min version of holoscan to the newly released 0.5.0 Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 08d7147 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Mar 31 13:55:12 2023 -0700 Add another app yaml file. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 1144ddf Author: M Q <mingmelvinq@nvidia.com> Date: Fri Mar 31 13:53:46 2023 -0700 Add the app config yaml file, which may be removed later. Signed-off-by: M Q <mingmelvinq@nvidia.com> commit 22d14f2 Author: M Q <mingmelvinq@nvidia.com> Date: Fri Mar 31 13:38:27 2023 -0700 WIP and initial commit Signed-off-by: M Q <mingmelvinq@nvidia.com> Signed-off-by: M Q <mingmelvinq@nvidia.com> * Fix black complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> * Local Flake8 did not complain this one. Signed-off-by: M Q <mingmelvinq@nvidia.com> * Quiet mypy complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated the notebook and included packaging and running the MAP Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated the notebook after resovling issues with MAP extract command Signed-off-by: M Q <mingmelvinq@nvidia.com> * Correct typo Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updates with Holoscan v0.6 release version, and remove not needed tests Signed-off-by: M Q <mingmelvinq@nvidia.com> * Fix complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> * Fix Flake complaint that "check --autofix" did not catch Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated the app and notebook using the seg inference operator. Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated, renamed, and removed Jupyter notebooks Signed-off-by: M Q <mingmelvinq@nvidia.com> * Add files needed for packaging, and move test input file to default input folder Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated/added files for the tutorials section in the user's guide Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated the tutorial section of the doc Signed-off-by: M Q <mingmelvinq@nvidia.com> * Exposing more holoscan modules and updated doc Signed-off-by: M Q <mingmelvinq@nvidia.com> * Import sorting complaint Signed-off-by: M Q <mingmelvinq@nvidia.com> * Import fewer Holoscan SDK operators in own module Signed-off-by: M Q <mingmelvinq@nvidia.com> * Even less HS operator imported due to dependency issue Signed-off-by: M Q <mingmelvinq@nvidia.com> * Updated the user doc Signed-off-by: M Q <mingmelvinq@nvidia.com> * Remove the packager command line options required during dev testing Signed-off-by: M Q <mingmelvinq@nvidia.com> * Ping holoscan~=0.6.0 and updated section on ARM64 MAP packaging Signed-off-by: M Q <mingmelvinq@nvidia.com> * Added command line option support for ease of running python app directly Signed-off-by: M Q <mingmelvinq@nvidia.com> * Fix format checking complaints Signed-off-by: M Q <mingmelvinq@nvidia.com> --------- Signed-off-by: M Q <mingmelvinq@nvidia.com>
1 parent 7128a1c commit 06a4182

File tree

139 files changed

+14049
-15172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+14049
-15172
lines changed

docs/source/developing_with_sdk/core_concepts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ classDiagram
2929
Graph "1" --> "many" Operator : contains
3030
```
3131

32-
[Application](/modules/_autosummary/monai.deploy.core.Application) represents a workflow as a [Graph](/modules/_autosummary/monai.deploy.core.graphs.Graph) and the graph handles [Operator](/modules/_autosummary/monai.deploy.core.Operator)s which are computational tasks.
32+
[Application](/modules/_autosummary/monai.deploy.core.Application) represents a workflow as a [Graph](/modules/graphs) and the graph handles [Operator](/modules/_autosummary/monai.deploy.core.Operator)s which are computational tasks.
3333

3434
To develop and deploy your MONAI App, you can follow the steps below (click a node to see the detail):
3535

docs/source/developing_with_sdk/creating_application_class.md

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ caption: |
1616
from monai.deploy.core import Application, env, resource
1717
1818
19-
@resource(cpu=1, gpu=1, memory="2Gi")
20-
# pip_packages can be a string that is a path(str) to requirements.txt file or a list of packages.
21-
@env(pip_packages=["scikit-image >= 0.17.2"])
2219
class App(Application):
2320
"""This is a very basic application.
2421
@@ -37,41 +34,34 @@ class App(Application):
3734
pass
3835
3936
if __name__ == "__main__":
40-
App(do_run=True)
37+
App().run()
4138
4239
```
4340

44-
### Decorators
45-
46-
The resource requirements (such as `cpu`, `memory`, and `gpu`) for the application can be specified by using [@resource](/modules/_autosummary/monai.deploy.core.resource) decorator. This information is used only when the packaged app (Docker image) is executed.
47-
48-
[@env](/modules/_autosummary/monai.deploy.core.env) accepts `pip_packages` parameter as a string that is a path to requirements.txt file or a list of packages to install. If `pip_packages` is specified, the definition will be aggregated with the package dependency list of other operators. The aggregated requirement definitions are stored as a "[requirements.txt](https://pip.pypa.io/en/stable/cli/pip_install/#example-requirements-file)" file and it would be installed in [packaging time](/developing_with_sdk/executing_packaged_app_locally).
49-
50-
5141
### compose() method
5242

5343
In `compose()` method, operators are instantiated and connected through <a href="../modules/_autosummary/monai.deploy.core.Application.html#monai.deploy.core.Application.add_flow">self.add_flow()</a>.
5444

55-
> add_flow(source_op, destination_op, io_map=None)
45+
> add_flow(source_op, destination_op, port_pairs )
5646
57-
`io_map` is a dictionary of mapping from the source operator's label to the destination operator's label(s) and its type is `Dict[str, str|Set[str]]`.
47+
`port_pairs` is a sequence of string tuples mapping from the source operator's named output(s) to the destination operator's named input(s) and its type is `Set[Tuple[str, str]]`.
5848

59-
We can skip specifying `io_map` if both the number of `source_op`'s outputs and the number of `destination_op`'s inputs are one.
60-
For example, if Operators named `task1` and `task2` has only one input and output (with the label `image`), `self.add_flow(task1, task2)` is same with `self.add_flow(task1, task2, {"image": "image"})` or `self.add_flow(task1, task2, {"image": {"image"}})`.
49+
We can skip specifying `Set[Tuple[str, str]]` if both the number of `source_op`'s outputs and the number of `destination_op`'s inputs are one.
50+
For example, if Operators named `task1` and `task2` has only one input and output (with the label `image`), `self.add_flow(task1, task2)` is same with `self.add_flow(task1, task2, {("image", "image")})` or `self.add_flow(task1, task2, {("image", "image")})`.
6151

6252
```python
6353
def compose(self):
6454
task1 = Task1()
6555
task2 = Task2()
6656

6757
self.add_flow(task1, task2)
68-
# self.add_flow(task1, task2, {"image": "image"})
69-
# self.add_flow(task1, task2, {"image": {"image"}})
58+
# self.add_flow(task1, task2, {("image", "image")})
59+
# self.add_flow(task1, task2, {("image", "image")})
7060
```
7161

7262
> add_operator(operator)
7363
74-
If an operator in the workflow graph is both a root node and a leaf node, you can execute <a href="../modules/_autosummary/monai.deploy.core.Application.html#monai.deploy.core.Application.add_flow">self.add_operator()</a> for adding the operator to the workflow graph of the application.
64+
If an operator in the workflow graph is both a root node and a leaf node, you can execute <a href="../modules/_autosummary/monai.deploy.core.Application.html#monai.deploy.core.Application.add_operator">self.add_operator()</a> for adding the operator to the workflow graph of the application.
7565

7666
```python
7767
def compose(self):
@@ -83,7 +73,7 @@ If an operator in the workflow graph is both a root node and a leaf node, you ca
8373

8474
```python
8575
if __name__ == "__main__":
86-
App(do_run=True)
76+
App().run()
8777
```
8878

8979
The above lines in `app.py` are needed to execute the application code by using `python` interpreter.
@@ -101,9 +91,15 @@ caption: |
10191
from app import App
10292
10393
if __name__ == "__main__":
104-
App(do_run=True)
94+
App().run()
10595
```
10696

97+
## Package Dependency and Resource Requirements
98+
99+
Unlike in previous versions where Python decorators are used to define the resource requirements (such as `cpu`, `memory`, and `gpu`) for the application, a YAML file is required to store such information with sections and attributes as defined in the [MONAI Application Package Specification](https://github.com/Project-MONAI/monai-deploy/blob/main/guidelines/monai-application-package.md). This file is only needed when the application is packaged into a MONAI Application Package container image. When the MAP is run, the executor is expected to parse the resource requirements embedded in the MAP to ensure they are met in the host system.
100+
101+
Similarly, instead of using Python decorators, package dependencies of the application and all of its operators need to be aggregated and stored as a "[requirements.txt](https://pip.pypa.io/en/stable/cli/pip_install/#example-requirements-file)" file, to be installed at [packaging time](/developing_with_sdk/packaging_app).
102+
107103
## Creating a Reusable Application
108104

109105
Like <a href="./creating_operator_classes.html#creating-a-reusable-operator">Operator class</a>, an Application class can be implemented in a way that the common Application class can be reusable.
@@ -174,12 +170,12 @@ The above workflow can be expressed like below
174170
notifier = Notifier()
175171
writer = Writer()
176172

177-
self.add_flow(reader1, processor1, {"image": {"image1", "image2"},
178-
"metadata": "metadata"})
179-
self.add_flow(reader2, processor2, {"roi": "roi"})
180-
self.add_flow(processor1, processor2, {"image": "image"})
181-
self.add_flow(processor1, writer, {"image": "image"})
173+
self.add_flow(reader1, processor1, {("image", "image1"), ("image", "image2"),
174+
("metadata", "metadata")})
175+
self.add_flow(reader2, processor2, {("roi", "roi")})
176+
self.add_flow(processor1, processor2, {("image", "image")})
177+
self.add_flow(processor1, writer, {("image", "image")})
182178
self.add_flow(processor2, notifier)
183179
self.add_flow(processor2, processor3)
184-
self.add_flow(processor3, writer, {"seg_image": "seg_image"})
180+
self.add_flow(processor3, writer, {("seg_image", "seg_image")})
185181
```

docs/source/developing_with_sdk/creating_operator_classes.md

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,24 @@ lineno-start: 1
1010
caption: |
1111
An Operator class definition example
1212
---
13-
from typing import Any, Dict
13+
from pathlib import Path
14+
from monai.deploy.core import (ExecutionContext, Image, InputContext,
15+
Operator, OutputContext, OperatorSpec)
1416
15-
import monai.deploy.core as md # 'md' stands for MONAI Deploy (or can use 'core' instead)
16-
from monai.deploy.core import (DataPath, ExecutionContext, Image, InputContext,
17-
IOType, Operator, OutputContext)
1817
19-
20-
@md.input("image", DataPath, IOType.DISK)
21-
@md.input("mask", Image, IOType.IN_MEMORY)
22-
@md.output("image", Image, IOType.IN_MEMORY)
23-
@md.output("metadata", Dict[str, Any], IOType.IN_MEMORY)
24-
@md.env(pip_packages=["scikit-image>=0.17.2"])
2518
class MyOperator(Operator):
2619
"""Sample Operator implementation."""
2720
21+
def setup(self, spec: OperatorSpec):
22+
spec.input("image_path")
23+
spec.output("image")
24+
spec.output("metadata")
25+
2826
def compute(self, op_input: InputContext, op_output: OutputContext, context: ExecutionContext):
2927
from skimage import filters, io
3028
3129
# Get input image
32-
image_path = op_input.get("image").path
30+
image_path = Path(op_input.receive("image_path")) # omitting validation for brevity
3331
if image_path.is_dir():
3432
image_path = next(image_path.glob("*.*")) # take the first file
3533
input_image = io.imread(image_path)
@@ -44,24 +42,13 @@ class MyOperator(Operator):
4442
metadata = {"shape": input_image.shape, "dtype": input_image.dtype}
4543
4644
# Set output
47-
op_output.set(Image(output_image), "image")
48-
op_output.set(metadata, "metadata")
45+
op_output.emit(Image(output_image), "image")
46+
op_output.emit(metadata, "metadata")
4947
```
5048

51-
### Decorators
52-
53-
The input and output properties of the operator are specified by using [@input](/modules/_autosummary/monai.deploy.core.input) and [@output](/modules/_autosummary/monai.deploy.core.output) decorators.
49+
### setup() method
5450

55-
[@input](/modules/_autosummary/monai.deploy.core.input) and [@output](/modules/_autosummary/monai.deploy.core.output) decorators accept (**`<Label>`**, [`<Data Type>`](/modules/domain_objects), [`<Storage Type>`](/modules/_autosummary/monai.deploy.core.IOType)) as parameters.
56-
57-
If no `@input` or `@output` decorator is specified, the following properties are used by default:
58-
59-
```python
60-
@md.input("", DataPath, IOType.DISK) # if no @input decorator is specified.
61-
@md.output("", DataPath, IOType.DISK) # if no @output decorator is specified.
62-
```
63-
64-
[@env](/modules/_autosummary/monai.deploy.core.env) accepts `pip_packages` parameter as a string that is a path to requirements.txt file or a list of packages to install. If `pip_packages` is specified, the definition will be aggregated with the package dependency list of other operators and the application. The aggregated requirement definitions are stored as a "[requirements.txt](https://pip.pypa.io/en/stable/cli/pip_install/#example-requirements-file)" file and it would be installed in [packaging time](/developing_with_sdk/executing_packaged_app_locally).
51+
In prior releases, the input and output properties of the operator are specified by using `@input` and `@output` decorators, but starting with release v0.6, the **<a href="../modules/_autosummary/monai.deploy.core.Operator.html#monai.deploy.core.Operator.setup">setup()</a>** method is used.
6552

6653
### compute() method
6754

@@ -73,15 +60,11 @@ Please check the description of **<a href="../modules/_autosummary/monai.deploy.
7360
2. Application's input/output
7461
3. [Model](/modules/_autosummary/monai.deploy.core.models.Model)'s name/path/predictor
7562

76-
Note that, if the operator is a leaf operator in the workflow graph and the operator output's `(<data type>, <storage type>) == (DataPath, DISK)`, you cannot call `op_output.set()` method.
77-
Instead, you can use the destination path available by `op_output.get().path` to store output data and the
78-
following logic is expected:
63+
Note that, if the operator is a leaf operator in the workflow graph and the operator output is file(s) written to the file system, the path needs to be set using the operator's constructor or a named input for path object or string. The leaf operator can also have in-memory output(s) without requiring other operator(s) as receiver, if the output is configured correctly like in the [GaussionOperator in Simple Image Processing App](https://github.com/Project-MONAI/monai-deploy-app-sdk/blob/main/examples/apps/simple_imaging_app/gaussian_operator.py)
7964

80-
```python
81-
output_folder = op_output.get().path # get the output folder path
82-
output_path = output_folder / "final_output.png" # get the output file path
83-
imsave(output_path, data_out) # save the output data
84-
```
65+
## Package dependencies
66+
67+
The dependencies of the operator need to be captured in a "[requirements.txt](https://pip.pypa.io/en/stable/cli/pip_install/#example-requirements-file)", instead of using the `@env` decorator as in earlier releases. The aggregated requirement definitions for an application are then store in a consolidated "[requirements.txt](https://pip.pypa.io/en/stable/cli/pip_install/#example-requirements-file)" file, to be installed at [packaging time](/developing_with_sdk/packaging_app).
8568

8669
## Creating a Reusable Operator
8770

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Deploying and Hosting MONAI App Package
22

33
The MONAI Application Package, MAP, built and packaged using MONAI Deploy App SDK, can be deployed in multiple ways, each with different levels of integration with a hosting platform.
4-
- A MAP is an OCI compliant container, albeit requiring <a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/overview.html"> Nvidia Container Toolkit </a> as it is based on the <a href="https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch">Nvidia PyTorch Python container image </a>. The hosting platforms, via their own tooling, can inspect the MAP metadata and ensure dependencies are satisfied on launching the MAP container, for example, an MAP can used in a Argo workflow.
5-
- A MAP runs "natively" on a platform, where the platform specific adaptor or shim embedded in the MAP can understand the MAP and the platform APIs thus manages the life cycle of the application per platform requests. At the onset, the only native execution planned is on the <a href="https://github.com/Project-MONAI/monai-deploy/releases">MONAI Deploy</a>. The support for other platforms is on the horizon.
6-
- As envisioned for the long term, standardization of deployment package specification will be needed, so that compliant application packages shall work on all compliant platforms. One of the initiatives in this area is the <a href="https://oam.dev/">Open Appication Model</a>, though the App SDK project is not yet actively investigating the integration.
4+
- A MAP is an OCI compliant container, albeit requiring <a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/overview.html"> Nvidia Container Toolkit </a> as it is by default based on <a href="https://catalog.ngc.nvidia.com/orgs/nvidia/teams/clara-holoscan/containers/holoscan">Nvidia container image with GPU support</a>. The hosting platforms, via their own tooling, can inspect the MAP metadata and ensure dependencies are satisfied on launching the MAP container, for example, an MAP can be used in a [Argo workflow](https://argoproj.github.io/argo-workflows/), in [Docker Compose](https://docs.docker.com/compose/), or simply run using [Docker](https://www.docker.com/).
5+
- A MAP runs "natively" on a platform, where the platform specific adaptor or utilities embedded in the MAP can understand the MAP and the platform APIs thus manage the life cycle of the application per platform requests. At the onset, the only native execution planned is on the <a href="https://github.com/Project-MONAI/monai-deploy/releases">MONAI Deploy</a>. The support for other platforms is on the horizon.
6+
- As envisioned for the long term, standardization of deployment package specification will be needed, so that compliant application packages shall work on all compliant platforms. One of the initiatives in this area is the <a href="https://oam.dev/">Open Application Model</a>, where an MAP can be used as the Application component.

docs/source/developing_with_sdk/designing_workflow.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ Those domain object classes are controllable by the SDK so can be optimized furt
8484

8585
The full list of Domain Object classes are available [here](/modules/domain_objects).
8686

87+
:::{note}
88+
**`The functionality of mapping DataPath to the input and output of root and leaf operator(s) is absent starting with Release V0.6 of this App SDK, due to the move to rely on Holoscan SDK. It is planned to be re-introduced at a later time. For the time being, the application's input and output folders are passed to the root and leaf operators' constructor, as needed.`**
89+
8790
Among those classes, [**DataPath**](/modules/_autosummary/monai.deploy.core.domain.DataPath) data type is special.
8891

8992
- If an operator in the workflow graph is a root node (a node with no incoming edges) and its input's `(<data type>, <storage type>) == (DataPath, DISK)`, the input path given by the user [during the execution](/developing_with_sdk/executing_app_locally) would be mapped into the input of the operator.
@@ -102,9 +105,10 @@ In `A linear workflow` example above, if the workflow is processing the image da
102105
- **Output** (`output3`): a file path ([`DataPath`](/modules/_autosummary/monai.deploy.core.domain.DataPath), [`DISK`](/modules/_autosummary/monai.deploy.core.IOType))
103106

104107
Note that `input1` and `output3` are [DataPath](/modules/_autosummary/monai.deploy.core.domain.DataPath) type with [IOType.DISK](/modules/_autosummary/monai.deploy.core.IOType). Those paths are mapped into input and output paths given by the user during the execution.
108+
:::
105109

106110
:::{note}
107-
The above workflow graph is the same as a [Simple Image Processing App](/getting_started/tutorials/01_simple_app). Please look at the tutorial to see how such an application can be made with MONAI Deploy App SDK.
111+
The above workflow graph is the same as a [Simple Image Processing App](/getting_started/tutorials/simple_app). Please look at the tutorial to see how such an application can be made with MONAI Deploy App SDK.
108112
:::
109113

110114
## Complex Workflows

0 commit comments

Comments
 (0)