monai.deploy.core.Fragment

class monai.deploy.core.Fragment(self: holoscan.core._core.Fragment, arg0: object) None[source]

Bases: holoscan.core._core.Fragment

Fragment class.

Fragment class.

Methods

__init__(self, arg0)

__init__(self: holoscan.core._core.Fragment, arg0: object) -> None

add_flow(*args, **kwargs)

Overloaded function.

add_operator(self, op)

Add an operator to the fragment.

compose(self)

The compose method of the Fragment.

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.

kwargs(self, key)

Retrieve a dictionary parameters from the associated configuration.

network_context(*args, **kwargs)

Overloaded function.

run(self)

The run method of the Fragment.

run_async()

Run the fragment asynchronously.

scheduler(*args, **kwargs)

Overloaded function.

track(self, num_start_messages_to_skip, …)

The track method of the application.

Attributes

application

The application associated with the fragment.

executor

Get the executor associated with the fragment.

graph

Get the computation graph (Graph node is an Operator) associated with the fragment.

name

The fragment’s name.

__init__(self: holoscan.core._core.Fragment, arg0: object) None[source]

__init__(self: holoscan.core._core.Fragment, arg0: object) -> None

Fragment class.

add_flow(*args, **kwargs)

Overloaded function.

  1. add_flow(self: holoscan.core._core.Fragment, upstream_op: holoscan.core._core.Operator, downstream_op: holoscan.core._core.Operator) -> None

  2. add_flow(self: holoscan.core._core.Fragment, 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_operator(self: holoscan.core._core.Fragment, op: holoscan.core._core.Operator) None

Add an operator to the fragment.

opholoscan.core.Operator

The operator to add.

property application

The application associated with the fragment.

app : holoscan.core.Application

compose(self: holoscan.core._core.Fragment) None[source]

The compose method of the Fragment.

This method should be called after config, but before run in order to compose the computation graph.

config(*args, **kwargs)

Overloaded function.

  1. 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.

  1. config(self: holoscan.core._core.Fragment, arg0: holoscan.core._core.Config) -> None

  2. 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 executor

Get the executor associated with the fragment.

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.

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.

  1. 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.

  1. network_context(self: holoscan.core._core.Fragment) -> holoscan.core._core.NetworkContext

Get the network context to be used by the Fragment

run(self: holoscan.core._core.Fragment) None

The run method of the Fragment.

This method runs the computation. It must have first been initialized via config and compose.

run_async()[source]

Run the fragment asynchronously.

This method is a convenience method that creates a thread pool with one thread and runs the fragment in that thread. The thread pool is created using concurrent.futures.ThreadPoolExecutor.

future : concurrent.futures.Future object

scheduler(*args, **kwargs)

Overloaded function.

  1. 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.

  1. 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