Skip to main content

apply_target

Wraps the base apply_target function to execute a target callable with specified arguments, keyword arguments, and optional callbacks while providing the current process ID.

def apply_target(
target: callable,
args: tuple,
kwargs: dict,
callback: callable,
accept_callback: callable,
getpid: callable
) - > Any

Executes a target function with provided arguments and handles lifecycle callbacks within the execution context.

Parameters

NameTypeDescription
targetcallableThe function or task to be executed.
argstuplePositional arguments to pass to the target function.
kwargsdictKeyword arguments to pass to the target function.
callbackcallableA function to be executed upon successful completion of the target.
accept_callbackcallableA function to be executed when the target is accepted for processing.
getpidcallableA function that returns the process identifier for the current execution context.

Returns

TypeDescription
AnyThe result of the underlying base target application logic.