holoscan 2.6.0__cp312-cp312-manylinux_2_35_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. holoscan-2.6.0.data/purelib/holoscan/__init__.py +133 -0
  2. holoscan-2.6.0.data/purelib/holoscan/cli/__init__.py +32 -0
  3. holoscan-2.6.0.data/purelib/holoscan/cli/__main__.py +159 -0
  4. holoscan-2.6.0.data/purelib/holoscan/cli/common/argparse_types.py +153 -0
  5. holoscan-2.6.0.data/purelib/holoscan/cli/common/artifact_sources.py +149 -0
  6. holoscan-2.6.0.data/purelib/holoscan/cli/common/constants.py +119 -0
  7. holoscan-2.6.0.data/purelib/holoscan/cli/common/dockerutils.py +509 -0
  8. holoscan-2.6.0.data/purelib/holoscan/cli/common/enum_types.py +52 -0
  9. holoscan-2.6.0.data/purelib/holoscan/cli/common/exceptions.py +130 -0
  10. holoscan-2.6.0.data/purelib/holoscan/cli/common/sdk_utils.py +180 -0
  11. holoscan-2.6.0.data/purelib/holoscan/cli/common/utils.py +130 -0
  12. holoscan-2.6.0.data/purelib/holoscan/cli/logging.json +37 -0
  13. holoscan-2.6.0.data/purelib/holoscan/cli/nics/__init__.py +18 -0
  14. holoscan-2.6.0.data/purelib/holoscan/cli/nics/nics.py +34 -0
  15. holoscan-2.6.0.data/purelib/holoscan/cli/packager/__init__.py +18 -0
  16. holoscan-2.6.0.data/purelib/holoscan/cli/packager/arguments.py +137 -0
  17. holoscan-2.6.0.data/purelib/holoscan/cli/packager/config_reader.py +181 -0
  18. holoscan-2.6.0.data/purelib/holoscan/cli/packager/container_builder.py +368 -0
  19. holoscan-2.6.0.data/purelib/holoscan/cli/packager/manifest_files.py +220 -0
  20. holoscan-2.6.0.data/purelib/holoscan/cli/packager/models.py +93 -0
  21. holoscan-2.6.0.data/purelib/holoscan/cli/packager/package_command.py +189 -0
  22. holoscan-2.6.0.data/purelib/holoscan/cli/packager/packager.py +122 -0
  23. holoscan-2.6.0.data/purelib/holoscan/cli/packager/parameters.py +558 -0
  24. holoscan-2.6.0.data/purelib/holoscan/cli/packager/platforms.py +402 -0
  25. holoscan-2.6.0.data/purelib/holoscan/cli/packager/templates/Dockerfile.jinja2 +470 -0
  26. holoscan-2.6.0.data/purelib/holoscan/cli/packager/templates/dockerignore +93 -0
  27. holoscan-2.6.0.data/purelib/holoscan/cli/packager/templates/tools.sh +416 -0
  28. holoscan-2.6.0.data/purelib/holoscan/cli/py.typed +0 -0
  29. holoscan-2.6.0.data/purelib/holoscan/cli/runner/__init__.py +18 -0
  30. holoscan-2.6.0.data/purelib/holoscan/cli/runner/resources.py +174 -0
  31. holoscan-2.6.0.data/purelib/holoscan/cli/runner/run_command.py +203 -0
  32. holoscan-2.6.0.data/purelib/holoscan/cli/runner/runner.py +306 -0
  33. holoscan-2.6.0.data/purelib/holoscan/cli/version/__init__.py +18 -0
  34. holoscan-2.6.0.data/purelib/holoscan/cli/version/version.py +50 -0
  35. holoscan-2.6.0.data/purelib/holoscan/conditions/__init__.py +57 -0
  36. holoscan-2.6.0.data/purelib/holoscan/core/__init__.py +430 -0
  37. holoscan-2.6.0.data/purelib/holoscan/decorator.py +592 -0
  38. holoscan-2.6.0.data/purelib/holoscan/executors/__init__.py +26 -0
  39. holoscan-2.6.0.data/purelib/holoscan/graphs/__init__.py +32 -0
  40. holoscan-2.6.0.data/purelib/holoscan/gxf/__init__.py +57 -0
  41. holoscan-2.6.0.data/purelib/holoscan/lib/gxf_extensions/libgxf_holoscan_wrapper.so +0 -0
  42. holoscan-2.6.0.data/purelib/holoscan/lib/gxf_extensions/libgxf_holoscan_wrapper_lib.so +0 -0
  43. holoscan-2.6.0.data/purelib/holoscan/lib/gxf_extensions/libgxf_ucx_holoscan.so +0 -0
  44. holoscan-2.6.0.data/purelib/holoscan/lib/gxf_extensions/libgxf_ucx_holoscan_lib.so +0 -0
  45. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_app.so +0 -0
  46. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_core.so +0 -0
  47. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_cuda.so +0 -0
  48. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_logger.so +0 -0
  49. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_multimedia.so +0 -0
  50. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_rmm.so +0 -0
  51. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_sample.so +0 -0
  52. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_serialization.so +0 -0
  53. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_std.so +0 -0
  54. holoscan-2.6.0.data/purelib/holoscan/lib/libgxf_ucx.so +0 -0
  55. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_core.so.2.6.0 +0 -0
  56. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_infer.so.2.6.0 +0 -0
  57. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_infer_onnx_runtime.so.2.6.0 +0 -0
  58. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_infer_torch.so.2.6.0 +0 -0
  59. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_infer_utils.so.2.6.0 +0 -0
  60. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_logger.so.2.6.0 +0 -0
  61. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_aja.so.2.6.0 +0 -0
  62. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_async_ping_rx.so.2.6.0 +0 -0
  63. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_async_ping_tx.so.2.6.0 +0 -0
  64. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_bayer_demosaic.so.2.6.0 +0 -0
  65. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_format_converter.so.2.6.0 +0 -0
  66. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_gxf_codelet.so.2.6.0 +0 -0
  67. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_holoviz.so.2.6.0 +0 -0
  68. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_inference.so.2.6.0 +0 -0
  69. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_inference_processor.so.2.6.0 +0 -0
  70. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_ping_rx.so.2.6.0 +0 -0
  71. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_ping_tensor_rx.so.2.6.0 +0 -0
  72. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_ping_tensor_tx.so.2.6.0 +0 -0
  73. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_ping_tx.so.2.6.0 +0 -0
  74. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_segmentation_postprocessor.so.2.6.0 +0 -0
  75. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_v4l2.so.2.6.0 +0 -0
  76. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_video_stream_recorder.so.2.6.0 +0 -0
  77. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_op_video_stream_replayer.so.2.6.0 +0 -0
  78. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_profiler.so.2.6.0 +0 -0
  79. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_spdlog_logger.so.2.6.0 +0 -0
  80. holoscan-2.6.0.data/purelib/holoscan/lib/libholoscan_viz.so.2.6.0 +0 -0
  81. holoscan-2.6.0.data/purelib/holoscan/lib/libucm.so.0.0.0 +0 -0
  82. holoscan-2.6.0.data/purelib/holoscan/lib/libucp.so.0.0.0 +0 -0
  83. holoscan-2.6.0.data/purelib/holoscan/lib/libucs.so.0.0.0 +0 -0
  84. holoscan-2.6.0.data/purelib/holoscan/lib/libucs_signal.so.0.0.0 +0 -0
  85. holoscan-2.6.0.data/purelib/holoscan/lib/libuct.so.0.0.0 +0 -0
  86. holoscan-2.6.0.data/purelib/holoscan/lib/libyaml-cpp.so.0.7.0 +0 -0
  87. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libucm_cuda.so.0.0.0 +0 -0
  88. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libucs_fuse.so.0.0.0 +0 -0
  89. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_cma.so.0.0.0 +0 -0
  90. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_cuda.so.0.0.0 +0 -0
  91. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_cuda_gdrcopy.so.0.0.0 +0 -0
  92. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_ib.so.0.0.0 +0 -0
  93. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_rdmacm.so.0.0.0 +0 -0
  94. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libuct_xpmem.so.0.0.0 +0 -0
  95. holoscan-2.6.0.data/purelib/holoscan/lib/ucx/libucx_perftest_cuda.so.0.0.0 +0 -0
  96. holoscan-2.6.0.data/purelib/holoscan/logger/__init__.py +37 -0
  97. holoscan-2.6.0.data/purelib/holoscan/network_contexts/__init__.py +28 -0
  98. holoscan-2.6.0.data/purelib/holoscan/operators/__init__.py +97 -0
  99. holoscan-2.6.0.data/purelib/holoscan/operators/aja_source/__init__.py +22 -0
  100. holoscan-2.6.0.data/purelib/holoscan/operators/bayer_demosaic/__init__.py +24 -0
  101. holoscan-2.6.0.data/purelib/holoscan/operators/format_converter/__init__.py +23 -0
  102. holoscan-2.6.0.data/purelib/holoscan/operators/gxf_codelet/__init__.py +67 -0
  103. holoscan-2.6.0.data/purelib/holoscan/operators/holoviz/__init__.py +424 -0
  104. holoscan-2.6.0.data/purelib/holoscan/operators/inference/__init__.py +23 -0
  105. holoscan-2.6.0.data/purelib/holoscan/operators/inference_processor/__init__.py +23 -0
  106. holoscan-2.6.0.data/purelib/holoscan/operators/ping_rx/__init__.py +45 -0
  107. holoscan-2.6.0.data/purelib/holoscan/operators/ping_tensor_rx/__init__.py +22 -0
  108. holoscan-2.6.0.data/purelib/holoscan/operators/ping_tensor_tx/__init__.py +22 -0
  109. holoscan-2.6.0.data/purelib/holoscan/operators/ping_tx/__init__.py +46 -0
  110. holoscan-2.6.0.data/purelib/holoscan/operators/segmentation_postprocessor/__init__.py +23 -0
  111. holoscan-2.6.0.data/purelib/holoscan/operators/v4l2_video_capture/__init__.py +23 -0
  112. holoscan-2.6.0.data/purelib/holoscan/operators/video_stream_recorder/__init__.py +22 -0
  113. holoscan-2.6.0.data/purelib/holoscan/operators/video_stream_replayer/__init__.py +22 -0
  114. holoscan-2.6.0.data/purelib/holoscan/resources/__init__.py +147 -0
  115. holoscan-2.6.0.data/purelib/holoscan/schedulers/__init__.py +32 -0
  116. holoscan-2.6.0.data/purelib/holoscan-2.6.0.pth +1 -0
  117. holoscan-2.6.0.dist-info/LICENSE.txt +202 -0
  118. holoscan-2.6.0.dist-info/METADATA +125 -0
  119. holoscan-2.6.0.dist-info/NOTICE.txt +174 -0
  120. holoscan-2.6.0.dist-info/NVIDIA-AI-PRODUCT-EULA.txt +243 -0
  121. holoscan-2.6.0.dist-info/RECORD +126 -0
  122. holoscan-2.6.0.dist-info/WHEEL +5 -0
  123. holoscan-2.6.0.dist-info/axle.lck +0 -0
  124. holoscan-2.6.0.dist-info/entry_points.txt +3 -0
  125. holoscan-2.6.0.dist-info/symlinks.txt +82 -0
  126. holoscan-2.6.0.dist-info/top_level.txt +3 -0
@@ -0,0 +1,558 @@
1
+ """
2
+ SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ """ # noqa: E501
17
+
18
+ import logging
19
+ import os
20
+ import platform
21
+ from pathlib import Path
22
+ from typing import Any, Optional
23
+
24
+ from ..common.constants import SDK, Constants, DefaultValues
25
+ from ..common.dockerutils import parse_docker_image_name_and_tag
26
+ from ..common.enum_types import ApplicationType, Arch, Platform, PlatformConfiguration, SdkType
27
+ from ..common.exceptions import InvalidTagValueError, UnknownApplicationTypeError
28
+
29
+
30
+ class PlatformParameters:
31
+ def __init__(
32
+ self, platform: Platform, platform_config: PlatformConfiguration, tag: str, version: str
33
+ ) -> None:
34
+ self._logger = logging.getLogger("platform.parameters")
35
+ self._platform: Platform = platform
36
+ self._platform_config: PlatformConfiguration = platform_config
37
+ self._arch: Arch = SDK.PLATFORM_MAPPINGS[platform]
38
+ self._tag_prefix: Optional[str]
39
+ self._version: Optional[str]
40
+
41
+ (self._tag_prefix, self._version) = parse_docker_image_name_and_tag(tag)
42
+
43
+ if self._tag_prefix is None:
44
+ raise InvalidTagValueError(f"'{tag}' is not a valid Docker tag. Format: name[:tag]")
45
+
46
+ if self._version is None:
47
+ self._version = version
48
+
49
+ self._data: dict[str, Any] = {}
50
+ self._data["tag"] = tag
51
+ self._data["base_image"] = None
52
+ self._data["build_image"] = None
53
+ self._data["holoscan_sdk_file"] = None
54
+ self._data["holoscan_sdk_filename"] = None
55
+ self._data["monai_deploy_sdk_file"] = None
56
+ self._data["monai_deploy_sdk_filename"] = None
57
+ self._data["custom_base_image"] = False
58
+ self._data["custom_holoscan_sdk"] = False
59
+ self._data["custom_monai_deploy_sdk"] = False
60
+ self._data["target_arch"] = "aarch64" if self._arch == Arch.arm64 else "x86_64"
61
+ self._data["cuda_deb_arch"] = "sbsa" if self._arch == Arch.arm64 else "x86_64"
62
+ self._data["holoscan_deb_arch"] = "arm64" if self._arch == Arch.arm64 else "amd64"
63
+ self._data["gpu_type"] = self.platform_config.value
64
+
65
+ @property
66
+ def tag(self) -> str:
67
+ return (
68
+ f"{self._tag_prefix}-"
69
+ f"{self.platform.value}-"
70
+ f"{self.platform_config.value}-"
71
+ f"{self.platform_arch.value}:"
72
+ f"{self.version}"
73
+ ).replace("/", "-")
74
+
75
+ @property
76
+ def tag_prefix(self) -> str:
77
+ return self._tag_prefix
78
+
79
+ @property
80
+ def custom_base_image(self) -> Optional[str]:
81
+ return self._data["custom_base_image"]
82
+
83
+ @custom_base_image.setter
84
+ def custom_base_image(self, value: str):
85
+ self._data["custom_base_image"] = value
86
+
87
+ @property
88
+ def custom_holoscan_sdk(self) -> Optional[str]:
89
+ return self._data["custom_holoscan_sdk"]
90
+
91
+ @custom_holoscan_sdk.setter
92
+ def custom_holoscan_sdk(self, value: str):
93
+ self._data["custom_holoscan_sdk"] = value
94
+
95
+ @property
96
+ def custom_monai_deploy_sdk(self) -> Optional[str]:
97
+ return self._data["custom_monai_deploy_sdk"]
98
+
99
+ @custom_monai_deploy_sdk.setter
100
+ def custom_monai_deploy_sdk(self, value: str):
101
+ self._data["custom_monai_deploy_sdk"] = value
102
+
103
+ @property
104
+ def base_image(self) -> Optional[str]:
105
+ return self._data["base_image"]
106
+
107
+ @base_image.setter
108
+ def base_image(self, value: str):
109
+ self._data["base_image"] = value
110
+
111
+ @property
112
+ def build_image(self) -> Optional[str]:
113
+ return self._data["build_image"]
114
+
115
+ @build_image.setter
116
+ def build_image(self, value: str):
117
+ self._data["build_image"] = value
118
+
119
+ @property
120
+ def holoscan_sdk_file(self) -> Optional[Path]:
121
+ return self._data["holoscan_sdk_file"]
122
+
123
+ @holoscan_sdk_file.setter
124
+ def holoscan_sdk_file(self, value: Path):
125
+ self._data["holoscan_sdk_file"] = value
126
+ if value is not None and hasattr(value, "name"):
127
+ self._data["holoscan_sdk_filename"] = value.name
128
+ elif value is not None:
129
+ self._data["holoscan_sdk_filename"] = value
130
+
131
+ @property
132
+ def monai_deploy_sdk_file(self) -> Optional[Path]:
133
+ return self._data["monai_deploy_sdk_file"]
134
+
135
+ @monai_deploy_sdk_file.setter
136
+ def monai_deploy_sdk_file(self, value: Path):
137
+ self._data["monai_deploy_sdk_file"] = value
138
+ if value is not None and hasattr(value, "name"):
139
+ self._data["monai_deploy_sdk_filename"] = value.name
140
+
141
+ @property
142
+ def version(self) -> str:
143
+ return self._version
144
+
145
+ @property
146
+ def health_probe(self) -> Optional[Path]:
147
+ return self._data.get("health_probe", None)
148
+
149
+ @health_probe.setter
150
+ def health_probe(self, value: Optional[Path]):
151
+ self._data["health_probe"] = value
152
+
153
+ @property
154
+ def platform_arch(self) -> Arch:
155
+ return self._arch
156
+
157
+ @property
158
+ def docker_arch(self) -> str:
159
+ return self._arch.value
160
+
161
+ @property
162
+ def platform(self) -> Platform:
163
+ return self._platform
164
+
165
+ @property
166
+ def platform_config(self) -> PlatformConfiguration:
167
+ return self._platform_config
168
+
169
+ @property
170
+ def to_jinja(self) -> dict[str, Any]:
171
+ return self._data
172
+
173
+ @property
174
+ def same_arch_as_system(self) -> bool:
175
+ return (platform.machine() == "aarch64" and self._arch == Arch.arm64) or (
176
+ platform.machine() == "x86_64" and self._arch == Arch.amd64
177
+ )
178
+
179
+ @property
180
+ def cuda_deb_arch(self) -> str:
181
+ return self._data["cuda_deb_arch"]
182
+
183
+ @property
184
+ def holoscan_deb_arch(self) -> str:
185
+ return self._data["holoscan_deb_arch"]
186
+
187
+ @property
188
+ def target_arch(self) -> str:
189
+ return self._data["target_arch"]
190
+
191
+
192
+ class PlatformBuildResults:
193
+ def __init__(self, parameters: PlatformParameters):
194
+ self._parameters = parameters
195
+ self._docker_tag: Optional[str] = None
196
+ self._tarball_filenaem: Optional[str] = None
197
+ self._succeeded = False
198
+ self._error: Optional[str] = None
199
+
200
+ @property
201
+ def parameters(self) -> PlatformParameters:
202
+ return self._parameters
203
+
204
+ @property
205
+ def error(self) -> Optional[str]:
206
+ return self._error
207
+
208
+ @error.setter
209
+ def error(self, value: Optional[str]):
210
+ self._error = value
211
+
212
+ @property
213
+ def docker_tag(self) -> Optional[str]:
214
+ return self._docker_tag
215
+
216
+ @docker_tag.setter
217
+ def docker_tag(self, value: Optional[str]):
218
+ self._docker_tag = value
219
+
220
+ @property
221
+ def tarball_filenaem(self) -> Optional[str]:
222
+ return self._tarball_filenaem
223
+
224
+ @tarball_filenaem.setter
225
+ def tarball_filenaem(self, value: Optional[str]):
226
+ self._tarball_filenaem = value
227
+
228
+ @property
229
+ def succeeded(self) -> bool:
230
+ return self._succeeded
231
+
232
+ @succeeded.setter
233
+ def succeeded(self, value: bool):
234
+ self._succeeded = value
235
+
236
+
237
+ class PackageBuildParameters:
238
+ """
239
+ Parameters required for building the Docker image with Jinja template.
240
+ """
241
+
242
+ def __init__(self):
243
+ self._logger = logging.getLogger("packager.parameters")
244
+ self._data = {}
245
+ self._data["app_dir"] = DefaultValues.HOLOSCAN_APP_DIR
246
+ self._data["config_file_path"] = DefaultValues.HOLOSCAN_CONFIG_PATH
247
+ self._data["docs_dir"] = DefaultValues.HOLOSCAN_DOCS_DIR
248
+ self._data["logs_dir"] = DefaultValues.HOLOSCAN_LOGS_DIR
249
+ self._data["full_input_path"] = DefaultValues.WORK_DIR / DefaultValues.INPUT_DIR
250
+ self._data["full_output_path"] = DefaultValues.WORK_DIR / DefaultValues.OUTPUT_DIR
251
+ self._data["input_dir"] = DefaultValues.INPUT_DIR
252
+ self._data["models_dir"] = DefaultValues.MODELS_DIR
253
+ self._data["output_dir"] = DefaultValues.OUTPUT_DIR
254
+ self._data["timeout"] = DefaultValues.TIMEOUT
255
+ self._data["working_dir"] = DefaultValues.WORK_DIR
256
+ self._data["app_json"] = DefaultValues.APP_MANIFEST_PATH
257
+ self._data["pkg_json"] = DefaultValues.PKG_MANIFEST_PATH
258
+ self._data["username"] = DefaultValues.USERNAME
259
+ self._data["build_cache"] = DefaultValues.BUILD_CACHE_DIR
260
+ self._data["uid"] = os.getuid()
261
+ self._data["gid"] = os.getgid()
262
+ self._data["tarball_output"] = None
263
+ self._data["cmake_args"] = ""
264
+ self._data["includes"] = []
265
+
266
+ self._data["application_directory"] = None
267
+ self._data["application_type"] = None
268
+ self._data["application"] = None
269
+ self._data["app_config_file_path"] = None
270
+ self._data["command"] = None
271
+ self._data["no_cache"] = False
272
+ self._data["pip_packages"] = None
273
+ self._data["requirements_file_path"] = None
274
+ self._data["holoscan_sdk_version"] = None
275
+ self._data["monai_deploy_app_sdk_version"] = None
276
+ self._data["title"] = None
277
+ self._data["version"] = None
278
+
279
+ @property
280
+ def build_cache(self) -> int:
281
+ return self._data["build_cache"]
282
+
283
+ @build_cache.setter
284
+ def build_cache(self, value: int):
285
+ self._data["build_cache"] = value
286
+
287
+ @property
288
+ def full_input_path(self) -> str:
289
+ return self._data["full_input_path"]
290
+
291
+ @property
292
+ def full_output_path(self) -> str:
293
+ return self._data["full_output_path"]
294
+
295
+ @property
296
+ def docs_dir(self) -> str:
297
+ return self._data["docs_dir"]
298
+
299
+ @property
300
+ def logs_dir(self) -> str:
301
+ return self._data["logs_dir"]
302
+
303
+ @property
304
+ def tarball_output(self) -> int:
305
+ return self._data["tarball_output"]
306
+
307
+ @tarball_output.setter
308
+ def tarball_output(self, value: int):
309
+ self._data["tarball_output"] = value
310
+
311
+ @property
312
+ def cmake_args(self) -> str:
313
+ return self._data["cmake_args"]
314
+
315
+ @cmake_args.setter
316
+ def cmake_args(self, value: str):
317
+ self._data["cmake_args"] = value.strip('"') if value is not None else ""
318
+
319
+ @property
320
+ def gid(self) -> int:
321
+ return self._data["gid"]
322
+
323
+ @gid.setter
324
+ def gid(self, value: int):
325
+ self._data["gid"] = value
326
+
327
+ @property
328
+ def uid(self) -> int:
329
+ return self._data["uid"]
330
+
331
+ @uid.setter
332
+ def uid(self, value: int):
333
+ self._data["uid"] = value
334
+
335
+ @property
336
+ def username(self) -> str:
337
+ return self._data["username"]
338
+
339
+ @username.setter
340
+ def username(self, value: str):
341
+ self._data["username"] = value
342
+
343
+ @property
344
+ def app_manifest_path(self):
345
+ return self._data["app_json"]
346
+
347
+ @property
348
+ def package_manifest_path(self):
349
+ return self._data["pkg_json"]
350
+
351
+ @property
352
+ def title(self):
353
+ return self._data["title"]
354
+
355
+ @title.setter
356
+ def title(self, value):
357
+ self._data["title"] = value
358
+
359
+ @property
360
+ def docs(self) -> Path:
361
+ return self._data.get("docs", None)
362
+
363
+ @docs.setter
364
+ def docs(self, value: Path):
365
+ if value is not None:
366
+ self._data["docs"] = value
367
+
368
+ @property
369
+ def models(self) -> dict[str, Path]:
370
+ return self._data.get("models", None)
371
+
372
+ @models.setter
373
+ def models(self, value: dict[str, Path]):
374
+ if value is not None:
375
+ self._data["models"] = value
376
+
377
+ @property
378
+ def pip_packages(self):
379
+ return self._data["pip_packages"]
380
+
381
+ @pip_packages.setter
382
+ def pip_packages(self, value):
383
+ self._data["pip_packages"] = value
384
+
385
+ @property
386
+ def no_cache(self):
387
+ return self._data["no_cache"]
388
+
389
+ @no_cache.setter
390
+ def no_cache(self, value):
391
+ self._data["no_cache"] = value
392
+
393
+ @property
394
+ def config_file_path(self):
395
+ return self._data["config_file_path"]
396
+
397
+ @property
398
+ def app_config_file_path(self):
399
+ return self._data["app_config_file_path"]
400
+
401
+ @app_config_file_path.setter
402
+ def app_config_file_path(self, value):
403
+ self._data["app_config_file_path"] = value
404
+
405
+ @property
406
+ def app_dir(self):
407
+ return self._data["app_dir"]
408
+
409
+ @property
410
+ def application(self) -> Path:
411
+ return self._data["application"]
412
+
413
+ @application.setter
414
+ def application(self, value: Path):
415
+ self._data["application"] = value
416
+ self._logger.info(f"Application: {self.application}")
417
+ self._application_type = self._detect_application_type()
418
+ self._data["application_type"] = self._application_type.name
419
+ self._logger.info(f"Detected application type: {self.application_type.value}")
420
+ self._data["application_directory"] = (
421
+ self.application
422
+ if os.path.isdir(self.application)
423
+ else Path(os.path.dirname(self.application))
424
+ )
425
+ requirements_file_path = self.application_directory / "requirements.txt"
426
+ if os.path.exists(requirements_file_path):
427
+ self._data["requirements_file_path"] = requirements_file_path
428
+ else:
429
+ self._data["requirements_file_path"] = None
430
+ self._data["command"] = self._set_app_command()
431
+ self._data["command_filename"] = os.path.basename(self.application)
432
+
433
+ @property
434
+ def command_filename(self) -> str:
435
+ return self._data["command_filename"]
436
+
437
+ @property
438
+ def command(self) -> str:
439
+ return self._data["command"]
440
+
441
+ @property
442
+ def application_directory(self) -> Path:
443
+ return self._data["application_directory"]
444
+
445
+ @property
446
+ def requirements_file_path(self) -> Path:
447
+ return self._data["requirements_file_path"]
448
+
449
+ @property
450
+ def version(self) -> str:
451
+ return self._data["version"]
452
+
453
+ @version.setter
454
+ def version(self, value: str):
455
+ self._data["version"] = value
456
+
457
+ @property
458
+ def timeout(self) -> int:
459
+ return self._data["timeout"]
460
+
461
+ @timeout.setter
462
+ def timeout(self, value: int):
463
+ self._data["timeout"] = value
464
+
465
+ @property
466
+ def working_dir(self) -> Path:
467
+ return self._data["working_dir"]
468
+
469
+ @property
470
+ def models_dir(self) -> Path:
471
+ return self._data["models_dir"]
472
+
473
+ @models_dir.setter
474
+ def models_dir(self, value: Path):
475
+ self._data["models_dir"] = value
476
+
477
+ @property
478
+ def input_dir(self) -> str:
479
+ return self._data["input_dir"]
480
+
481
+ @property
482
+ def output_dir(self) -> str:
483
+ return self._data["output_dir"]
484
+
485
+ @property
486
+ def application_type(self) -> ApplicationType:
487
+ return self._application_type
488
+
489
+ @property
490
+ def sdk(self) -> SdkType:
491
+ return self._data["sdk"]
492
+
493
+ @sdk.setter
494
+ def sdk(self, value: SdkType):
495
+ self._data["sdk"] = value
496
+ self._data["sdk_type"] = value.value
497
+
498
+ @property
499
+ def holoscan_sdk_version(self) -> str:
500
+ return self._data["holoscan_sdk_version"]
501
+
502
+ @holoscan_sdk_version.setter
503
+ def holoscan_sdk_version(self, value: str):
504
+ self._data["holoscan_sdk_version"] = value
505
+
506
+ @property
507
+ def monai_deploy_app_sdk_version(self) -> str:
508
+ return self._data["monai_deploy_app_sdk_version"]
509
+
510
+ @monai_deploy_app_sdk_version.setter
511
+ def monai_deploy_app_sdk_version(self, value: str):
512
+ self._data["monai_deploy_app_sdk_version"] = value
513
+
514
+ @property
515
+ def includes(self) -> str:
516
+ return self._data["includes"]
517
+
518
+ @includes.setter
519
+ def includes(self, value: str):
520
+ self._data["includes"] = value
521
+
522
+ @property
523
+ def to_jinja(self) -> dict[str, Any]:
524
+ return self._data
525
+
526
+ def _detect_application_type(self) -> ApplicationType:
527
+ if os.path.isdir(self.application):
528
+ if os.path.exists(self.application / Constants.PYTHON_MAIN_FILE):
529
+ return ApplicationType.PythonModule
530
+ elif os.path.exists(self.application / Constants.CPP_CMAKELIST_FILE):
531
+ return ApplicationType.CppCMake
532
+ elif os.path.isfile(self.application):
533
+ if Path(self.application).suffix == ".py":
534
+ return ApplicationType.PythonFile
535
+ elif os.access(self.application, os.X_OK):
536
+ return ApplicationType.Binary
537
+
538
+ raise UnknownApplicationTypeError(
539
+ f"""\n\nUnable to determine application type. Please ensure the application path
540
+ contains one of the following:
541
+ \t- Python directory/module with '{Constants.PYTHON_MAIN_FILE}'
542
+ \t- Python file
543
+ \t- C++ source directory with '{Constants.CPP_CMAKELIST_FILE}'
544
+ \t- Binary file"""
545
+ )
546
+
547
+ def _set_app_command(self) -> str:
548
+ if self.application_type == ApplicationType.PythonFile:
549
+ return (
550
+ f'["{Constants.PYTHON_EXECUTABLE}", '
551
+ + f'"{os.path.join(self._data["app_dir"], os.path.basename(self.application))}"]'
552
+ )
553
+ elif self.application_type == ApplicationType.PythonModule:
554
+ return f'["{Constants.PYTHON_EXECUTABLE}", "{self._data["app_dir"]}"]'
555
+ elif self.application_type in [ApplicationType.CppCMake, ApplicationType.Binary]:
556
+ return f'["{os.path.join(self._data["app_dir"], os.path.basename(self.application))}"]'
557
+
558
+ raise UnknownApplicationTypeError("Unsupported application type.")