holoscan.conditions

This module provides a Python API to underlying C++ API Conditions.

holoscan.conditions.BooleanCondition

Boolean condition class.

holoscan.conditions.CountCondition

Count condition class.

holoscan.conditions.DownstreamMessageAffordableCondition

Condition that permits execution when the downstream operator can accept new messages.

holoscan.conditions.MessageAvailableCondition

Condition that permits execution when an upstream message is available.

holoscan.conditions.PeriodicCondition

Condition class to support periodic execution of operators.

class holoscan.conditions.BooleanCondition

Bases: holoscan.gxf._gxf.GXFCondition

Boolean condition class.

Used to control whether an entity is executed.

Attributes

args

The list of arguments associated with the component.

description

YAML formatted string describing the condition.

fragment

Fragment that the condition belongs to.

gxf_cid

The GXF component ID.

gxf_cname

The name of the component.

gxf_context

The GXF context of the component.

gxf_eid

The GXF entity ID.

gxf_typename

The GXF type name of the condition.

id

The identifier of the component.

name

The name of the condition.

spec

Methods

add_arg(*args, **kwargs)

Overloaded function.

check_tick_enabled(self)

Check whether the condition is True.

disable_tick(self)

Set condition to False.

enable_tick(self)

Set condition to True.

gxf_initialize(self)

Initialize the component.

initialize(self)

Initialize the component.

setup(self, spec)

Define the component specification.

__init__(self: holoscan.conditions._conditions.BooleanCondition, fragment: holoscan.core._core.Fragment, enable_tick: bool = True, name: str = 'noname_boolean_condition') → None

Boolean condition.

Parameters
fragmentholoscan.core.Fragment

The fragment the condition will be associated with

enable_tickbool, optional

Boolean value for the condition.

namestr, optional

The name of the condition.

add_arg(*args, **kwargs)

Overloaded function.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None

Add an argument to the component.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the component.

property args

The list of arguments associated with the component.

Returns
arglistholoscan.core.ArgList

check_tick_enabled(self: holoscan.conditions._conditions.BooleanCondition) → bool

Check whether the condition is True.

property description

YAML formatted string describing the condition.

disable_tick(self: holoscan.conditions._conditions.BooleanCondition) → None

Set condition to False.

enable_tick(self: holoscan.conditions._conditions.BooleanCondition) → None

Set condition to True.

property fragment

Fragment that the condition belongs to.

Returns
nameholoscan.core.Fragment

property gxf_cid

The GXF component ID.

property gxf_cname

The name of the component.

property gxf_context

The GXF context of the component.

property gxf_eid

The GXF entity ID.

gxf_initialize(self: holoscan.gxf._gxf.GXFComponent) → None

Initialize the component.

property gxf_typename

The GXF type name of the condition.

Returns
str

The GXF type name of the condition

property id

The identifier of the component.

The identifier is initially set to -1, and will become a valid value when the component is initialized.

With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.

Returns
idint

initialize(self: holoscan.gxf._gxf.GXFCondition) → None

Initialize the component.

property name

The name of the condition.

Returns
namestr

setup(self: holoscan.conditions._conditions.BooleanCondition, spec: holoscan.core._core.ComponentSpec) → None

Define the component specification.

Parameters
specholoscan.core.ComponentSpec

Component specification associated with the condition.

property spec

class holoscan.conditions.CountCondition

Bases: holoscan.gxf._gxf.GXFCondition

Count condition class.

Attributes

args

The list of arguments associated with the component.

count

The execution count associated with the condition

description

YAML formatted string describing the condition.

fragment

Fragment that the condition belongs to.

gxf_cid

The GXF component ID.

gxf_cname

The name of the component.

gxf_context

The GXF context of the component.

gxf_eid

The GXF entity ID.

gxf_typename

The GXF type name of the condition.

id

The identifier of the component.

name

The name of the condition.

spec

Methods

add_arg(*args, **kwargs)

Overloaded function.

gxf_initialize(self)

Initialize the component.

initialize(self)

Initialize the component.

setup(self, arg0)

Define the component specification.

__init__(self: holoscan.conditions._conditions.CountCondition, fragment: holoscan.core._core.Fragment, count: int = 1, name: str = 'noname_count_condition') → None

Count condition.

Parameters
fragmentholoscan.core.Fragment

The fragment the condition will be associated with

countint

The execution count value used by the condition.

namestr, optional

The name of the condition.

add_arg(*args, **kwargs)

Overloaded function.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None

Add an argument to the component.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the component.

property args

The list of arguments associated with the component.

Returns
arglistholoscan.core.ArgList

property count

The execution count associated with the condition

property description

YAML formatted string describing the condition.

property fragment

Fragment that the condition belongs to.

Returns
nameholoscan.core.Fragment

property gxf_cid

The GXF component ID.

property gxf_cname

The name of the component.

property gxf_context

The GXF context of the component.

property gxf_eid

The GXF entity ID.

gxf_initialize(self: holoscan.gxf._gxf.GXFComponent) → None

Initialize the component.

property gxf_typename

The GXF type name of the condition.

Returns
str

The GXF type name of the condition

property id

The identifier of the component.

The identifier is initially set to -1, and will become a valid value when the component is initialized.

With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.

Returns
idint

initialize(self: holoscan.gxf._gxf.GXFCondition) → None

Initialize the component.

property name

The name of the condition.

Returns
namestr

setup(self: holoscan.conditions._conditions.CountCondition, arg0: holoscan.core._core.ComponentSpec) → None

Define the component specification.

Parameters
specholoscan.core.ComponentSpec

Component specification associated with the condition.

property spec

class holoscan.conditions.DownstreamMessageAffordableCondition

Bases: holoscan.gxf._gxf.GXFCondition

Condition that permits execution when the downstream operator can accept new messages.

Attributes

args

The list of arguments associated with the component.

description

YAML formatted string describing the condition.

fragment

Fragment that the condition belongs to.

gxf_cid

The GXF component ID.

gxf_cname

The name of the component.

gxf_context

The GXF context of the component.

gxf_eid

The GXF entity ID.

gxf_typename

The GXF type name of the condition.

id

The identifier of the component.

min_size

The minimum number of free slots required for the downstream entity's back buffer.

name

The name of the condition.

transmitter

The transmitter associated with the condition.

spec

Methods

add_arg(*args, **kwargs)

Overloaded function.

gxf_initialize(self)

Initialize the component.

initialize(self)

Initialize the condition

setup(self, spec)

Define the component specification.

__init__(self: holoscan.conditions._conditions.DownstreamMessageAffordableCondition, fragment: holoscan.core._core.Fragment, min_size: int = 1, name: str = 'noname_downstream_affordable_condition') → None

Condition that permits execution when the downstream operator can accept new messages.

Parameters
fragmentholoscan.core.Fragment

The fragment the condition will be associated with

min_sizeint

The minimum number of free slots present in the back buffer.

namestr, optional

The name of the condition.

add_arg(*args, **kwargs)

Overloaded function.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None

Add an argument to the component.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the component.

property args

The list of arguments associated with the component.

Returns
arglistholoscan.core.ArgList

property description

YAML formatted string describing the condition.

property fragment

Fragment that the condition belongs to.

Returns
nameholoscan.core.Fragment

property gxf_cid

The GXF component ID.

property gxf_cname

The name of the component.

property gxf_context

The GXF context of the component.

property gxf_eid

The GXF entity ID.

gxf_initialize(self: holoscan.gxf._gxf.GXFComponent) → None

Initialize the component.

property gxf_typename

The GXF type name of the condition.

Returns
str

The GXF type name of the condition

property id

The identifier of the component.

The identifier is initially set to -1, and will become a valid value when the component is initialized.

With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.

Returns
idint

initialize(self: holoscan.conditions._conditions.DownstreamMessageAffordableCondition) → None

Initialize the condition

This method is called only once when the condition is created for the first time, and uses a light-weight initialization.

property min_size

The minimum number of free slots required for the downstream entity’s back buffer.

property name

The name of the condition.

Returns
namestr

setup(self: holoscan.conditions._conditions.DownstreamMessageAffordableCondition, spec: holoscan.core._core.ComponentSpec) → None

Define the component specification.

Parameters
specholoscan.core.ComponentSpec

Component specification associated with the condition.

property spec

property transmitter

The transmitter associated with the condition.

class holoscan.conditions.MessageAvailableCondition

Bases: holoscan.gxf._gxf.GXFCondition

Condition that permits execution when an upstream message is available.

Executed when the associated receiver queue has at least a certain number of elements. The receiver is specified using the receiver parameter of the scheduling term. The minimum number of messages that permits the execution of the entity is specified by min_size. An optional parameter for this scheduling term is front_stage_max_size, the maximum front stage message count. If this parameter is set, the scheduling term will only allow execution if the number of messages in the queue does not exceed this count. It can be used for operators which do not consume all messages from the queue.

Attributes

args

The list of arguments associated with the component.

description

YAML formatted string describing the condition.

fragment

Fragment that the condition belongs to.

front_stage_max_size

Threshold for the number of front stage messages.

gxf_cid

The GXF component ID.

gxf_cname

The name of the component.

gxf_context

The GXF context of the component.

gxf_eid

The GXF entity ID.

gxf_typename

The GXF type name of the condition.

id

The identifier of the component.

min_size

The total number of messages over a set of input channels needed to permit execution.

name

The name of the condition.

receiver

The receiver associated with the condition.

spec

Methods

add_arg(*args, **kwargs)

Overloaded function.

gxf_initialize(self)

Initialize the component.

initialize(self)

Initialize the condition

setup(self, arg0)

Define the component specification.

__init__(self: holoscan.conditions._conditions.MessageAvailableCondition, fragment: holoscan.core._core.Fragment, min_size: int = 1, front_stage_max_size: int = 1, name: str = 'noname_message_available_condition') → None

Condition that permits execution when an upstream message is available.

Parameters
fragmentholoscan.core.Fragment

The fragment the condition will be associated with

min_sizeint

The total number of messages over a set of input channels needed to permit execution.

front_stage_max_sizeint

Threshold for the number of front stage messages. Execution is only allowed if the number of front stage messages does not exceed this count.

namestr, optional

The name of the condition.

add_arg(*args, **kwargs)

Overloaded function.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None

Add an argument to the component.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the component.

property args

The list of arguments associated with the component.

Returns
arglistholoscan.core.ArgList

property description

YAML formatted string describing the condition.

property fragment

Fragment that the condition belongs to.

Returns
nameholoscan.core.Fragment

property front_stage_max_size

Threshold for the number of front stage messages. Execution is only allowed if the number of front stage messages does not exceed this count.

property gxf_cid

The GXF component ID.

property gxf_cname

The name of the component.

property gxf_context

The GXF context of the component.

property gxf_eid

The GXF entity ID.

gxf_initialize(self: holoscan.gxf._gxf.GXFComponent) → None

Initialize the component.

property gxf_typename

The GXF type name of the condition.

Returns
str

The GXF type name of the condition

property id

The identifier of the component.

The identifier is initially set to -1, and will become a valid value when the component is initialized.

With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.

Returns
idint

initialize(self: holoscan.conditions._conditions.MessageAvailableCondition) → None

Initialize the condition

This method is called only once when the condition is created for the first time, and uses a light-weight initialization.

property min_size

The total number of messages over a set of input channels needed to permit execution.

property name

The name of the condition.

Returns
namestr

property receiver

The receiver associated with the condition.

setup(self: holoscan.conditions._conditions.MessageAvailableCondition, arg0: holoscan.core._core.ComponentSpec) → None

Define the component specification.

Parameters
specholoscan.core.ComponentSpec

Component specification associated with the condition.

property spec

class holoscan.conditions.PeriodicCondition

Bases: holoscan.gxf._gxf.GXFCondition

Condition class to support periodic execution of operators. The recess (pause) period indicates the minimum amount of time that must elapse before the compute() method can be executed again. The recess period can be specified as an integer value in nanoseconds.

For example: 1000 for 1 microsecond 1000000 for 1 millisecond, and 10000000000 for 1 second.

The recess (pause) period can also be specified as a datetime.timedelta object representing a duration. (see https://docs.python.org/3/library/datetime.html#timedelta-objects)

For example: datetime.timedelta(minutes=1), datetime.timedelta(seconds=1), datetime.timedelta(milliseconds=1) and datetime.timedelta(microseconds=1). Supported argument names are: weeks| days | hours | minutes | seconds | millisecons | microseconds This requires import datetime.

Attributes

args

The list of arguments associated with the component.

description

YAML formatted string describing the condition.

fragment

Fragment that the condition belongs to.

gxf_cid

The GXF component ID.

gxf_cname

The name of the component.

gxf_context

The GXF context of the component.

gxf_eid

The GXF entity ID.

gxf_typename

The GXF type name of the condition.

id

The identifier of the component.

name

The name of the condition.

spec

Methods

add_arg(*args, **kwargs)

Overloaded function.

gxf_initialize(self)

Initialize the component.

initialize(self)

Initialize the component.

last_run_timestamp(self)

Gets the integer representing the last run time stamp.

recess_period(*args, **kwargs)

Overloaded function.

recess_period_ns(self)

Gets the recess (pause) period value in nanoseconds.

setup(self, arg0)

Define the component specification.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: holoscan.conditions._conditions.PeriodicCondition, fragment: holoscan.core._core.Fragment, recess_period: int, name: str = ‘noname_periodic_condition’) -> None

  2. __init__(self: holoscan.conditions._conditions.PeriodicCondition, fragment: holoscan.core._core.Fragment, recess_period: datetime.timedelta, name: str = ‘noname_periodic_condition’) -> None

Condition class to support periodic execution of operators.

Parameters
fragmentholoscan.core.Fragment

The fragment the condition will be associated with

recess_periodint or datetime.timedelta

The recess (pause) period value used by the condition. If an integer is provided, the units are in nanoseconds.

namestr, optional

The name of the condition.

add_arg(*args, **kwargs)

Overloaded function.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None

Add an argument to the component.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the component.

property args

The list of arguments associated with the component.

Returns
arglistholoscan.core.ArgList

property description

YAML formatted string describing the condition.

property fragment

Fragment that the condition belongs to.

Returns
nameholoscan.core.Fragment

property gxf_cid

The GXF component ID.

property gxf_cname

The name of the component.

property gxf_context

The GXF context of the component.

property gxf_eid

The GXF entity ID.

gxf_initialize(self: holoscan.gxf._gxf.GXFComponent) → None

Initialize the component.

property gxf_typename

The GXF type name of the condition.

Returns
str

The GXF type name of the condition

property id

The identifier of the component.

The identifier is initially set to -1, and will become a valid value when the component is initialized.

With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.

Returns
idint

initialize(self: holoscan.gxf._gxf.GXFCondition) → None

Initialize the component.

last_run_timestamp(self: holoscan.conditions._conditions.PeriodicCondition) → int

Gets the integer representing the last run time stamp.

property name

The name of the condition.

Returns
namestr

recess_period(*args, **kwargs)

Overloaded function.

  1. recess_period(self: holoscan.conditions._conditions.PeriodicCondition, arg0: int) -> None

Sets the recess (pause) period associated with the condition. The recess period can be specified as an integer value in nanoseconds or a datetime.timedelta object representing a duration.

  1. recess_period(self: holoscan.conditions._conditions.PeriodicCondition, arg0: datetime.timedelta) -> None

Sets the recess (pause) period associated with the condition. The recess period can be specified as an integer value in nanoseconds or a datetime.timedelta object representing a duration.

recess_period_ns(self: holoscan.conditions._conditions.PeriodicCondition) → int

Gets the recess (pause) period value in nanoseconds.

setup(self: holoscan.conditions._conditions.PeriodicCondition, arg0: holoscan.core._core.ComponentSpec) → None

Define the component specification.

Parameters
specholoscan.core.ComponentSpec

Component specification associated with the condition.

property spec

© Copyright 2022-2023, NVIDIA. Last updated on Sep 13, 2023.