8.16. Clara Pipeline Callbacks
The Clara Pipeline Driver is a event based workflow. The set and ordering of the workflow’s event is referred to as the operator life-cycle. The operator life-cycle consists of the following three event as ordered below.
For each event, application (operator) code is allowed to register a callback handler with the driver. Callback handler registration happens as part of the Nvidia.Clara.Pipeline.Driver
constructor. Application code can ignore an event by passing a null
pointer, instead of a delegate, to the constructor.
see also: driver
Prepare
Called before stage inputs are ready.
Application code should perform any pre-execute setup or preparation work possible.
Payload inputs and outputs are not yet available.
Execute
Called after prepare once stage inputs are ready.
Application code should perform all core pipeline operator work during this event.
Payload inputs and outputs are available during this event.
Cleanup
Called after execute before the driver’s stage life-cycle terminates.
Application code should perform any post-execute clean-up work.
Payload inputs and outputs are no longer available.
Provided by application code to the driver when calling Nvidia.Clara.Pipeline.Driver
constructor, and called by the driver once driver initialization has completed. Application code is expected to perform any preparation or setup steps necessary when this delegate is called.
Providing a preparation delegate to the driver is optional. When no delegate is provided, the driver will move directly from initialization to waiting for inputs for execution.
see also: Clara Pipeline Driver
Parameters
driver
type:
Nvidia.Clara.Pipeline.IDriver
Reference to the
IDriver
instance calling the delegate.
Return
Returns zero if successful; otherwise a non-zero value.
delegate bool DriverPrepareDelegate(IDriver driver);
Provided by application code to the driver when calling Nvidia.Clara.Pipeline.Driver
constructor, and called by the driver once inputs are ready for consumption. Application code will be provided an Nvidia.Clara.Pipeline.IPayload
reference which can be used to obtain information about the payload.
Providing an execution delegate to the driver is optional. When no delegate is provided, the driver will move directly from waiting for inputs to clean-up.
see also: Clara Pipeline Driver
Parameters
driver
type:
Nvidia.Clara.Pipeline.IDriver
Reference to the
IDriver
instance calling the delegate.payload
type:
Nvidia.Clara.Pipeline.IPayload
Reference to the current stage’s payload.
Return
Returns zero if successful; otherwise a non-zero value.
delegate bool DriverExecuteDelegate(IDriver driver, IPayload payload);
Provided by application code to the driver when calling Nvidia.Clara.Pipeline.Driver
constructor, and called by the driver after execution is complete and internal driver clean up has completed. The application is expected to perform any clean or finalization steps during this callback event.
Providing a clean-up delegate to the driver is optional. When no delegate is provided, the driver will move directly from clean-up to internal finalization.
see also: Clara Pipeline Driver
Parameters
driver
type:
Nvidia.Clara.Pipeline.IDriver
Reference to the
IDriver
instance calling the delegate.
Return
Returns zero if successful; otherwise a non-zero value.
delegate bool DriverCleanupDelegate(IDriver driver);
Provided by application code to the driver when calling Nvidia.Clara.Pipeline.Driver
constructor, and called by the driver when any noteworthy event happens. This includes internal errors.
Providing a notification delegate to the driver is optional. When no delegate is provided, the driver will be unable to notify application code of any internal errors or critical state changes.
see also: Clara Pipeline Driver
Parameters
driver
type:
Nvidia.Clara.Pipeline.IDriver
Reference to the
IDriver
instance calling the delegate.result
type:
System.Int32
The result, or return code, of the event which generated the notification.
message
type:
System.String
The detailed message of the event which generated the notification.
isFatal
type:
System.Boolean
Boolean indicating if the event which generated the notification is fatal to the current stage or not.
Return
delegate void DriverNotification(IDriver driver, int result, string message, bool isFatal);