monai.deploy.core.Application¶
- class monai.deploy.core.Application(self: holoscan.core._core.Application, argv: List[str] = []) None [source]¶
Bases:
holoscan.core._core.Application
Application class.
This constructor parses the command line for flags that are recognized by App Driver/Worker, and removes all recognized flags so users can use the remaining flags for their own purposes.
If the arguments are not specified, the arguments are retrieved from
sys.executable
andsys.argv
.The arguments after processing arguments (parsing Holoscan-specific flags and removing them) are accessible through the
argv
attribute.- argvList[str]
The command line arguments to parse. The first item should be the path to the python executable. If not specified,
[sys.executable, *sys.argv]
is used.
>>> from holoscan.core import Application >>> import sys >>> Application().argv == sys.argv True >>> Application([]).argv == sys.argv True >>> Application([sys.executable, *sys.argv]).argv == sys.argv True >>> Application(["python3", "myapp.py", "--driver", "--address=10.0.0.1", "my_arg1"]).argv ['myapp.py', 'my_arg1']
Application class.
This constructor parses the command line for flags that are recognized by App Driver/Worker, and removes all recognized flags so users can use the remaining flags for their own purposes.
If the arguments are not specified, the arguments are retrieved from
sys.executable
andsys.argv
.The arguments after processing arguments (parsing Holoscan-specific flags and removing them) are accessible through the
argv
attribute.- argvList[str]
The command line arguments to parse. The first item should be the path to the python executable. If not specified,
[sys.executable, *sys.argv]
is used.
>>> from holoscan.core import Application >>> import sys >>> Application().argv == sys.argv True >>> Application([]).argv == sys.argv True >>> Application([sys.executable, *sys.argv]).argv == sys.argv True >>> Application(["python3", "myapp.py", "--driver", "--address=10.0.0.1", "my_arg1"]).argv ['myapp.py', 'my_arg1']
Methods
__init__
(self, argv)__init__(self: holoscan.core._core.Application, argv: List[str] = []) -> None
add_flow
(*args, **kwargs)Overloaded function.
add_fragment
(self, frag)Add a fragment to the application.
add_operator
(self, op)Add an operator to the application.
compose
(self)The compose method of the application.
config
(*args, **kwargs)Overloaded function.
config_keys
(self)The set of keys present in the fragment’s configuration file.
from_config
(self, key)Retrieve parameters from the associated configuration.
init_app_context
([runtime_env])Initializes the app context with arguments and well-known environment variables.
kwargs
(self, key)Retrieve a dictionary parameters from the associated configuration.
network_context
(*args, **kwargs)Overloaded function.
run
(self)The run method of the application.
Run the application asynchronously.
scheduler
(*args, **kwargs)Overloaded function.
track
(self, num_start_messages_to_skip, …)The track method of the application.
Attributes
The application associated with the fragment.
The command line arguments after processing flags.
The application’s description.
Get the executor associated with the fragment.
Get the computation graph (Graph node is a Fragment) associated with the application.
Get the computation graph (Graph node is an Operator) associated with the fragment.
The fragment’s name.
The reference to the CLI options.
The application’s version.
- __init__(self: holoscan.core._core.Application, argv: List[str] = []) None [source]¶
__init__(self: holoscan.core._core.Application, argv: List[str] = []) -> None
Application class.
This constructor parses the command line for flags that are recognized by App Driver/Worker, and removes all recognized flags so users can use the remaining flags for their own purposes.
If the arguments are not specified, the arguments are retrieved from
sys.executable
andsys.argv
.The arguments after processing arguments (parsing Holoscan-specific flags and removing them) are accessible through the
argv
attribute.- argvList[str]
The command line arguments to parse. The first item should be the path to the python executable. If not specified,
[sys.executable, *sys.argv]
is used.
>>> from holoscan.core import Application >>> import sys >>> Application().argv == sys.argv True >>> Application([]).argv == sys.argv True >>> Application([sys.executable, *sys.argv]).argv == sys.argv True >>> Application(["python3", "myapp.py", "--driver", "--address=10.0.0.1", "my_arg1"]).argv ['myapp.py', 'my_arg1']
- add_flow(*args, **kwargs)¶
Overloaded function.
add_flow(self: holoscan.core._core.Application, upstream_op: holoscan.core._core.Operator, downstream_op: holoscan.core._core.Operator) -> None
add_flow(self: holoscan.core._core.Application, upstream_op: holoscan.core._core.Operator, downstream_op: holoscan.core._core.Operator, port_pairs: Set[Tuple[str, str]]) -> None
Connect two operators associated with the fragment.
- upstream_opholoscan.core.Operator
Source operator.
- downstream_opholoscan.core.Operator
Destination operator.
- port_pairsSequence of (str, str) tuples
Sequence of ports to connect. The first element of each 2-tuple is a port from upstream_op while the second element is the port of downstream_op to which it connects.
This is an overloaded function. Additional variants exist:
1.) For the Application class there is a variant where the first two arguments are of type holoscan.core.Fragment instead of holoscan.core.Operator. This variant is used in building multi-fragment applications. 2.) There are also variants that omit the port_pairs argument that are applicable when there is only a single output on the upstream operator/fragment and a single input on the downstream operator/fragment.
add_flow(self: holoscan.core._core.Application, upstream_frag: holoscan.core._core.Fragment, downstream_frag: holoscan.core._core.Fragment, port_pairs: Set[Tuple[str, str]]) -> None
- add_fragment(self: holoscan.core._core.Application, frag: holoscan.core._core.Fragment) None ¶
Add a fragment to the application.
- fragholoscan.core.Fragment
The fragment to add.
- add_operator(self: holoscan.core._core.Application, op: holoscan.core._core.Operator) None ¶
Add an operator to the application.
- opholoscan.core.Operator
The operator to add.
- property application¶
The application associated with the fragment.
app : holoscan.core.Application
- property argv¶
The command line arguments after processing flags. This does not include the python executable like sys.argv does.
argv : list of str
- compose(self: holoscan.core._core.Application) None ¶
The compose method of the application.
This method should be called after config, but before run in order to compose the computation graph.
- config(*args, **kwargs)¶
Overloaded function.
config(self: holoscan.core._core.Fragment, config_file: str, prefix: str = ‘’) -> None
Configuration class.
Represents configuration parameters as read from a YAML file.
- configstr or holoscan.core.Config
The path to the configuration file (in YAML format) or a holoscan.core.Config object.
- prefixstr, optional
Prefix path for the` config` file. Only available in the overloaded variant that takes a string for config.
config(self: holoscan.core._core.Fragment, arg0: holoscan.core._core.Config) -> None
config(self: holoscan.core._core.Fragment) -> holoscan.core._core.Config
- config_keys(self: holoscan.core._core.Fragment) Set[str] ¶
The set of keys present in the fragment’s configuration file.
- property description¶
The application’s description.
description : str
- property executor¶
Get the executor associated with the fragment.
- property fragment_graph¶
Get the computation graph (Graph node is a Fragment) associated with the application.
- from_config(self: holoscan.core._core.Fragment, key: str) object ¶
Retrieve parameters from the associated configuration.
- keystr
The key within the configuration file to retrieve. This can also be a specific component of the parameter via syntax ‘key.sub_key’.
- argsholoscan.core.ArgList
An argument list associated with the key.
- property graph¶
Get the computation graph (Graph node is an Operator) associated with the fragment.
- init_app_context(runtime_env=None)¶
Initializes the app context with arguments and well-known environment variables.
The arguments, if passed in, override the attributes set with environment variables.
- Parameters
argv (Optional[List[str]], optional) – arguments passed to the program. Defaults to None.
- Returns
the AppContext object
- Return type
- kwargs(self: holoscan.core._core.Fragment, key: str) dict ¶
Retrieve a dictionary parameters from the associated configuration.
- keystr
The key within the configuration file to retrieve. This can also be a specific component of the parameter via syntax ‘key.sub_key’.
- kwargsdict
A Python dict containing the parameters in the configuration file under the specified key.
- property name¶
The fragment’s name.
name : str
- network_context(*args, **kwargs)¶
Overloaded function.
network_context(self: holoscan.core._core.Fragment, network_context: holoscan.core._core.NetworkContext) -> None
Assign a network context to the Fragment
- network_contextholoscan.core.NetworkContext
A network_context class instance to be used by the underlying GXF executor. If unspecified, no network context will be used.
network_context(self: holoscan.core._core.Fragment) -> holoscan.core._core.NetworkContext
Get the network context to be used by the Fragment
- property options¶
The reference to the CLI options.
options : holoscan.core.CLIOptions
- run(self: holoscan.core._core.Application) None ¶
The run method of the application.
This method runs the computation. It must have first been initialized via config and compose.
- run_async()[source]¶
Run the application asynchronously.
This method is a convenience method that creates a thread pool with one thread and runs the application in that thread. The thread pool is created using concurrent.futures.ThreadPoolExecutor.
future :
concurrent.futures.Future
object
- scheduler(*args, **kwargs)¶
Overloaded function.
scheduler(self: holoscan.core._core.Fragment, scheduler: holoscan.core._core.Scheduler) -> None
Assign a scheduler to the Fragment.
- schedulerholoscan.core.Scheduler
A scheduler class instance to be used by the underlying GXF executor. If unspecified, the default is a holoscan.gxf.GreedyScheduler.
scheduler(self: holoscan.core._core.Fragment) -> holoscan.core._core.Scheduler
Get the scheduler to be used by the Fragment.
- track(self: holoscan.core._core.Fragment, num_start_messages_to_skip: int = 10, num_last_messages_to_discard: int = 10, latency_threshold: int = 0) holoscan::DataFlowTracker ¶
The track method of the application.
This method enables data frame flow tracking and returns a DataFlowTracker object which can be used to display metrics data for profiling an application.
- num_start_messages_to_skipint
The number of messages to skip at the beginning.
- num_last_messages_to_discardint
The number of messages to discard at the end.
- latency_thresholdint
The minimum end-to-end latency in milliseconds to account for in the end-to-end latency metric calculations
- property version¶
The application’s version.
version : str