holoscan-cli 2.9.0__py3-none-any.whl → 3.8.0__py3-none-any.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.
@@ -19,10 +19,10 @@ from argparse import ArgumentParser, _SubParsersAction
19
19
  from packaging.version import Version
20
20
 
21
21
  from ..common.argparse_types import (
22
+ valid_host_ip,
22
23
  valid_dir_path,
23
24
  valid_existing_dir_path,
24
25
  valid_existing_path,
25
- valid_platform_config,
26
26
  valid_platforms,
27
27
  valid_sdk_type,
28
28
  )
@@ -44,6 +44,14 @@ def create_package_parser(
44
44
  help="Holoscan application path: Python application directory with __main__.py, "
45
45
  "Python file, C++ source directory with CMakeLists.txt, or path to an executable.",
46
46
  )
47
+
48
+ parser.add_argument(
49
+ "--add",
50
+ action="append",
51
+ dest="additional_libs",
52
+ type=valid_existing_dir_path,
53
+ help="include additional library files, python files into the application directory.",
54
+ )
47
55
  parser.add_argument(
48
56
  "--config",
49
57
  "-c",
@@ -51,6 +59,14 @@ def create_package_parser(
51
59
  type=valid_existing_path,
52
60
  help="Holoscan application configuration file (.yaml)",
53
61
  )
62
+ parser.add_argument(
63
+ "--cuda",
64
+ type=int,
65
+ default=13,
66
+ choices=[12, 13],
67
+ help="set the version of the CUDA that is used to build the application. "
68
+ "Valid values: 12, 13. (default: 13)",
69
+ )
54
70
  parser.add_argument(
55
71
  "--docs",
56
72
  "-d",
@@ -70,19 +86,6 @@ def create_package_parser(
70
86
  help="target platform(s) for the build output separated by comma. "
71
87
  f"Valid values: {str.join(', ', SDK.PLATFORMS)}.",
72
88
  )
73
- parser.add_argument(
74
- "--platform-config",
75
- type=valid_platform_config,
76
- help="target platform configuration for the build output. "
77
- f"Valid values: {str.join(', ', SDK.PLATFORM_CONFIGS)}.",
78
- )
79
- parser.add_argument(
80
- "--add",
81
- action="append",
82
- dest="additional_libs",
83
- type=valid_existing_dir_path,
84
- help="include additional library files, python files into the application directory.",
85
- )
86
89
  parser.add_argument(
87
90
  "--timeout", type=int, help="override default application timeout"
88
91
  )
@@ -91,6 +94,13 @@ def create_package_parser(
91
94
  )
92
95
 
93
96
  advanced_group = parser.add_argument_group(title="advanced build options")
97
+ advanced_group.add_argument(
98
+ "--add-host",
99
+ action="append",
100
+ dest="add_hosts",
101
+ type=valid_host_ip,
102
+ help="Add a custom host-to-IP mapping (format: host:ip).",
103
+ )
94
104
  advanced_group.add_argument(
95
105
  "--base-image",
96
106
  type=str,
@@ -101,13 +111,6 @@ def create_package_parser(
101
111
  type=str,
102
112
  help="container image name for building the C++ application.",
103
113
  )
104
- advanced_group.add_argument(
105
- "--includes",
106
- nargs="*",
107
- default=[],
108
- choices=["debug", "holoviz", "torch", "onnx"],
109
- help="additional packages to include in the container.",
110
- )
111
114
  advanced_group.add_argument(
112
115
  "--build-cache",
113
116
  type=valid_dir_path,
@@ -126,6 +129,18 @@ def create_package_parser(
126
129
  "If not specified, the packager downloads "
127
130
  "the SDK file from the internet based on the SDK version.",
128
131
  )
132
+ advanced_group.add_argument(
133
+ "--includes",
134
+ nargs="*",
135
+ default=[],
136
+ choices=["debug", "holoviz", "torch", "onnx"],
137
+ help="additional packages to include in the container.",
138
+ )
139
+ advanced_group.add_argument(
140
+ "--input-data",
141
+ type=valid_dir_path,
142
+ help="sample input data to be embedded in the container.",
143
+ )
129
144
  advanced_group.add_argument(
130
145
  "--monai-deploy-sdk-file",
131
146
  type=valid_existing_path,
@@ -146,18 +161,18 @@ def create_package_parser(
146
161
  help="SDK for building the application: Holoscan or MONAI-Deploy. "
147
162
  f"Valid values: {str.join(', ', SDK.SDKS)}.",
148
163
  )
149
- advanced_group.add_argument(
150
- "--source",
151
- type=str,
152
- help="override Debian package, build container image and run container image from a "
153
- "JSON formatted file or a secured web server (HTTPS).",
154
- )
155
164
  advanced_group.add_argument(
156
165
  "--sdk-version",
157
166
  type=Version,
158
167
  help="set the version of the SDK that is used to build and package the application. "
159
168
  "If not specified, the packager attempts to detect the installed version.",
160
169
  )
170
+ advanced_group.add_argument(
171
+ "--source",
172
+ type=str,
173
+ help="override Debian package, build container image and run container image from a "
174
+ "JSON formatted file or a secured web server (HTTPS).",
175
+ )
161
176
 
162
177
  output_group = parser.add_argument_group(title="output options")
163
178
  output_group.add_argument(
@@ -103,7 +103,7 @@ def _package_application(args: Namespace):
103
103
  f"""\nPlatform: {result.parameters.platform.value}/{result.parameters.platform_config.value}
104
104
  Status: Succeeded
105
105
  Docker Tag: {result.docker_tag if result.docker_tag is not None else "N/A"}
106
- Tarball: {result.tarball_filenaem}""" # noqa: E501
106
+ Tarball: {result.tarball_filename}""" # noqa: E501
107
107
  )
108
108
  else:
109
109
  print(
@@ -16,7 +16,7 @@ import logging
16
16
  import os
17
17
  import platform
18
18
  from pathlib import Path
19
- from typing import Any, Optional
19
+ from typing import Any, List, Optional
20
20
 
21
21
  from ..common.constants import SDK, Constants, DefaultValues
22
22
  from ..common.dockerutils import parse_docker_image_name_and_tag
@@ -34,14 +34,16 @@ class PlatformParameters:
34
34
  def __init__(
35
35
  self,
36
36
  platform: Platform,
37
- platform_config: PlatformConfiguration,
38
37
  tag: str,
39
38
  version: str,
39
+ cuda_version: int = 13,
40
40
  ) -> None:
41
41
  self._logger = logging.getLogger("platform.parameters")
42
- self._platform: Platform = platform
43
- self._platform_config: PlatformConfiguration = platform_config
44
- self._arch: Arch = SDK.PLATFORM_MAPPINGS[platform]
42
+ self._platform = SDK.INTERNAL_PLATFORM_MAPPINGS[platform][0]
43
+ self._platform_config: PlatformConfiguration = SDK.INTERNAL_PLATFORM_MAPPINGS[
44
+ platform
45
+ ][1]
46
+ self._arch: Arch = SDK.PLATFORM_ARCH_MAPPINGS[platform]
45
47
  self._tag_prefix: Optional[str]
46
48
  self._version: Optional[str]
47
49
 
@@ -66,6 +68,7 @@ class PlatformParameters:
66
68
  self._data["custom_base_image"] = False
67
69
  self._data["custom_holoscan_sdk"] = False
68
70
  self._data["custom_monai_deploy_sdk"] = False
71
+ self._data["cuda_version"] = cuda_version
69
72
  self._data["target_arch"] = "aarch64" if self._arch == Arch.arm64 else "x86_64"
70
73
  self._data["cuda_deb_arch"] = "sbsa" if self._arch == Arch.arm64 else "x86_64"
71
74
  self._data["holoscan_deb_arch"] = (
@@ -127,6 +130,10 @@ class PlatformParameters:
127
130
  def build_image(self, value: str):
128
131
  self._data["build_image"] = value
129
132
 
133
+ @property
134
+ def cuda_version(self) -> int:
135
+ return self._data["cuda_version"]
136
+
130
137
  @property
131
138
  def holoscan_sdk_file(self) -> Optional[Path]:
132
139
  return self._data["holoscan_sdk_file"]
@@ -204,7 +211,7 @@ class PlatformBuildResults:
204
211
  def __init__(self, parameters: PlatformParameters):
205
212
  self._parameters = parameters
206
213
  self._docker_tag: Optional[str] = None
207
- self._tarball_filenaem: Optional[str] = None
214
+ self._tarball_filename: Optional[str] = None
208
215
  self._succeeded = False
209
216
  self._error: Optional[str] = None
210
217
 
@@ -229,12 +236,12 @@ class PlatformBuildResults:
229
236
  self._docker_tag = value
230
237
 
231
238
  @property
232
- def tarball_filenaem(self) -> Optional[str]:
233
- return self._tarball_filenaem
239
+ def tarball_filename(self) -> Optional[str]:
240
+ return self._tarball_filename
234
241
 
235
- @tarball_filenaem.setter
236
- def tarball_filenaem(self, value: Optional[str]):
237
- self._tarball_filenaem = value
242
+ @tarball_filename.setter
243
+ def tarball_filename(self, value: Optional[str]):
244
+ self._tarball_filename = value
238
245
 
239
246
  @property
240
247
  def succeeded(self) -> bool:
@@ -276,8 +283,9 @@ class PackageBuildParameters:
276
283
  self._data["tarball_output"] = None
277
284
  self._data["cmake_args"] = ""
278
285
  self._data["includes"] = []
286
+ self._data["input_data"] = None
279
287
  self._data["additional_lib_paths"] = ""
280
-
288
+ self._data["add_hosts"] = []
281
289
  self._data["application_directory"] = None
282
290
  self._data["application_type"] = None
283
291
  self._data["application"] = None
@@ -528,6 +536,14 @@ class PackageBuildParameters:
528
536
  def monai_deploy_app_sdk_version(self, value: str):
529
537
  self._data["monai_deploy_app_sdk_version"] = value
530
538
 
539
+ @property
540
+ def add_hosts(self) -> List[str]:
541
+ return self._data["add_hosts"]
542
+
543
+ @add_hosts.setter
544
+ def add_hosts(self, value: List[str]):
545
+ self._data["add_hosts"] = value
546
+
531
547
  @property
532
548
  def includes(self) -> str:
533
549
  return self._data["includes"]
@@ -536,6 +552,14 @@ class PackageBuildParameters:
536
552
  def includes(self, value: str):
537
553
  self._data["includes"] = value
538
554
 
555
+ @property
556
+ def input_data(self) -> Path:
557
+ return self._data["input_data"]
558
+
559
+ @input_data.setter
560
+ def input_data(self, value: Path):
561
+ self._data["input_data"] = value
562
+
539
563
  @property
540
564
  def additional_lib_paths(self) -> str:
541
565
  """
@@ -76,10 +76,8 @@ class Platform:
76
76
 
77
77
  platforms = []
78
78
  for platform in args.platform:
79
- platform_config = args.platform_config
80
-
81
79
  platform_parameters = PlatformParameters(
82
- platform, platform_config, args.tag, version
80
+ platform, args.tag, version, args.cuda
83
81
  )
84
82
 
85
83
  (
@@ -94,6 +92,7 @@ class Platform:
94
92
  holoscan_sdk_version,
95
93
  application_type,
96
94
  args.build_image,
95
+ platform_parameters.cuda_version,
97
96
  )
98
97
 
99
98
  (
@@ -191,7 +190,10 @@ class Platform:
191
190
  f"""No base image found for the selected configuration:
192
191
  Platform: {platform_parameters.platform}
193
192
  Configuration: {platform_parameters.platform_config}
194
- Version: {sdk_version}"""
193
+ Version: {sdk_version}
194
+ CUDA Version: {platform_parameters.cuda_version}
195
+ Try to use a different CUDA version with '--cuda' option.
196
+ """
195
197
  ) from ex
196
198
 
197
199
  def _find_build_image(
@@ -200,6 +202,7 @@ class Platform:
200
202
  sdk_version: str,
201
203
  application_type: ApplicationType,
202
204
  build_image: Optional[str] = None,
205
+ cuda_version: int = 13,
203
206
  ) -> Optional[str]:
204
207
  """
205
208
  Ensure user provided build image exists or locate the build image to use based on the
@@ -210,6 +213,7 @@ class Platform:
210
213
  sdk_version (str): SDK version
211
214
  application_type (ApplicationType): application type
212
215
  build_image (Optional[str]): user provided build image
216
+ cuda_version (int): CUDA version
213
217
 
214
218
  Returns:
215
219
  (str): build image for building the image based on the given platform and SDK version.
@@ -233,6 +237,8 @@ class Platform:
233
237
  f"\n Platform: {platform_parameters.platform.value}"
234
238
  f"\n Configuration: {platform_parameters.platform_config.value}"
235
239
  f"\n Version: {sdk_version}"
240
+ f"\n CUDA Version: {cuda_version}"
241
+ "\n Try to use a different CUDA version with '--cuda' option."
236
242
  ) from ex
237
243
  else:
238
244
  return None