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