monai.deploy.core.Condition#
- class monai.deploy.core.Condition(*args, **kwargs)[source]#
Bases:
ConditionBaseBase class representing either a wrapped C++ condition or native Python condition.
Overloaded function.
__init__(self: holoscan.core._core.ConditionBase, arg0: object, arg1: holoscan::Fragment, *args, **kwargs) -> None
Base class representing either a wrapped C++ condition or native Python condition.
Can be initialized with any number of Python positional and keyword arguments.
If a name keyword argument is provided, it must be a str and will be used to set the name of the condition.
If a fragment keyword argument is provided, it must be of type holoscan.core.Fragment (or holoscan.core.Application). A single Fragment object can also be provided positionally instead.
Any other arguments will be cast from a Python argument type to a C++ Arg and stored in
self.args. (For details on how the casting is done, see the py_object_to_arg utility).Parameters#
- *args
Positional arguments.
- **kwargs
Keyword arguments.
Raises#
- RuntimeError
If name kwarg is provided, but is not of str type. If multiple arguments of type Fragment are provided. If any other arguments cannot be converted to Arg type via py_object_to_arg.
__init__(self: holoscan.core._core.ConditionBase, condition: object, subgraph: holoscan::Subgraph, *args, **kwargs) -> None
Methods
__init__(*args, **kwargs)Overloaded function.
add_arg(*args, **kwargs)Overloaded function.
check(timestamp)Default implementation of check.
Default implementation of initialize
on_execute(timestamp)Default implementation of on_execute
receiver(self, port_name)Get the receiver used by an input port of the operator this condition is associated with.
service(self, service_type[, id])Retrieve a registered fragment service through the component's fragment.
setup(spec)Default implementation of setup method.
transmitter(self, port_name)Get the transmitter used by an output port of the operator this condition is associated with.
update_state(timestamp)Default implementation of update_state
Attributes
The list of arguments associated with the component.
Condition type.
YAML formatted string describing the condition.
Fragment that the condition belongs to.
The identifier of the component.
The name of the condition.
spec- class ConditionComponentType(self: holoscan.core._core.ConditionBase.ConditionComponentType, value: int)#
Bases:
pybind11_objectMembers:
NATIVE
GXF
- property name#
- __init__(*args, **kwargs)[source]#
Overloaded function.
__init__(self: holoscan.core._core.ConditionBase, arg0: object, arg1: holoscan::Fragment, *args, **kwargs) -> None
Base class representing either a wrapped C++ condition or native Python condition.
Can be initialized with any number of Python positional and keyword arguments.
If a name keyword argument is provided, it must be a str and will be used to set the name of the condition.
If a fragment keyword argument is provided, it must be of type holoscan.core.Fragment (or holoscan.core.Application). A single Fragment object can also be provided positionally instead.
Any other arguments will be cast from a Python argument type to a C++ Arg and stored in
self.args. (For details on how the casting is done, see the py_object_to_arg utility).Parameters#
- *args
Positional arguments.
- **kwargs
Keyword arguments.
Raises#
- RuntimeError
If name kwarg is provided, but is not of str type. If multiple arguments of type Fragment are provided. If any other arguments cannot be converted to Arg type via py_object_to_arg.
- add_arg(*args, **kwargs)#
Overloaded function.
add_arg(self: holoscan.core._core.ComponentBase, arg: holoscan.core._core.Arg) -> None
Add an argument to the component.
add_arg(self: holoscan.core._core.ComponentBase, 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#
arglist : holoscan.core.ArgList
- check(timestamp)[source]#
Default implementation of check.
- Return type:
tuple[SchedulingStatusType,int|None]
Parameters#
- timestampint
The timestamp at which the check method is called. This method is called by the underlying GXF framework to determine whether an operator is ready to execute.
Returns#
- status_type: SchedulingStatusType
The current status of the operator. See the documentation on native condition creation for explanations of the various status types.
- target_timestamp: int or None
Specifies a specific target timestamp at which the operator is expected to be ready. This should only be provided if relevant (it helps the underlying framework avoid overhead of repeated checks before the target time).
Notes#
The method should return SchedulingStatusType.READY when the desired condition has been met.
The operator will always execute with this default implementation that always execute with this default implementation.
- property condition_type#
Condition type.
holoscan.core.Condition.ConditionComponentType enum representing the type of the condition. The two types currently implemented are NATIVE and GXF.
- property description#
YAML formatted string describing 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#
id : int
- on_execute(timestamp)[source]#
Default implementation of on_execute
Parameters#
- timestampint
The timestamp at which the on_execute method was called.
Notes#
This method is called by the underlying GXF framework immediately after the Operator.compute call for the operator to which the condition has been assigned.
- receiver(self: holoscan.core._core.ConditionBase, port_name: str) Optional[holoscan::Receiver]#
Get the receiver used by an input port of the operator this condition is associated with.
Parameters#
- port_namestr
The name of the input port.
Returns#
- receiverholoscan.resources.Receiver
The receiver used by this input port. Will be None if the port does not exist.
- service(self: object, service_type: type, id: str = '') object#
Retrieve a registered fragment service through the component’s fragment.
This method delegates to the fragment’s service() method to retrieve a previously registered fragment service by its type and optional identifier. Returns
Noneif no fragment service is found with the specified type and identifier.Parameters#
- service_typetype
The type of the fragment service to retrieve. Must be a type that inherits from Resource or FragmentService.
- idstr, optional
The identifier of the fragment service. If empty, retrieves by service type only. For Resources, this would typically be the resource’s name.
Returns#
- object or None
The fragment service instance of the requested type, or
Noneif not found. If the service wraps a Resource and a Resource type is requested, the unwrapped Resource instance is returned.
Raises#
- RuntimeError
If the component has no associated fragment or if the fragment’s service method cannot be accessed.
Notes#
This is a convenience method that internally calls the fragment’s service() method. For services that wrap Resources, the method will automatically unwrap and return the Resource if a Resource type is requested.
- transmitter(self: holoscan.core._core.ConditionBase, port_name: str) Optional[holoscan::Transmitter]#
Get the transmitter used by an output port of the operator this condition is associated with.
Parameters#
- port_namestr
The name of the output port.
Returns#
- transmitterholoscan.resources.Transmitter or None
The transmitter used by this output port. Will be None if the port does not exist.
- update_state(timestamp)[source]#
Default implementation of update_state
Parameters#
- timestampint
The timestamp at which the update_state method was called.
Notes#
This method is always called by the underlying GXF framework immediately before the Condition.check method. In some cases, the Condition.on_execute method may also wish to call this method.