Skip to main content

CallableSignature

Celery Signature interface.

Attributes

AttributeTypeDescription
namestringThe string name of the task associated with this signature.
typeAnyThe concrete task class or type instance this signature represents.
appCelery.appThe Celery application instance bound to this signature.
idstringThe unique task identifier assigned to this signature.
taskAnyThe actual task function or object that this signature wraps.
argslistA list of positional arguments to be passed to the task during execution.
kwargsdictA dictionary of keyword arguments to be passed to the task during execution.
optionsdictA dictionary of execution options such as routing, countdowns, or expiration settings.
subtask_typestringThe specific type of subtask this signature represents, such as a group or chain.
chord_sizeintegerThe number of tasks in the chord if this signature is part of a chord header.
immutablebooleanA boolean flag indicating whether the signature's arguments are protected from modification by callbacks.

Methods


name()

@classmethod
def name() - > string

Retrieves the name of the task associated with this signature.

Returns

TypeDescription
stringThe registered name of the Celery task

type()

@classmethod
def type() - > object

Retrieves the task type or class instance for this signature.

Returns

TypeDescription
objectThe task instance or type associated with the signature

app()

@classmethod
def app() - > object

Retrieves the Celery application instance bound to this signature.

Returns

TypeDescription
objectThe Celery app instance used for task execution context

id()

@classmethod
def id() - > string

Retrieves the unique identifier assigned to this task signature.

Returns

TypeDescription
stringThe UUID string representing the task identity

task()

@classmethod
def task() - > object

Retrieves the actual task implementation linked to this signature.

Returns

TypeDescription
objectThe callable task object

args()

@classmethod
def args() - > tuple

Retrieves the positional arguments defined for the task call.

Returns

TypeDescription
tupleA tuple of positional arguments to be passed to the task

kwargs()

@classmethod
def kwargs() - > dict

Retrieves the keyword arguments defined for the task call.

Returns

TypeDescription
dictA dictionary of keyword arguments to be passed to the task

options()

@classmethod
def options() - > dict

Retrieves the execution options such as countdown, eta, or queue settings.

Returns

TypeDescription
dictA dictionary containing task execution configuration

subtask_type()

@classmethod
def subtask_type() - > string

Retrieves the specific type of subtask if this signature is part of a complex workflow.

Returns

TypeDescription
stringThe subtask type identifier, such as 'chain' or 'group'

chord_size()

@classmethod
def chord_size() - > integer

Retrieves the number of tasks in the chord if this signature is a chord header.

Returns

TypeDescription
integerThe count of tasks expected to complete before the callback

immutable()

@classmethod
def immutable() - > boolean

Indicates whether the signature's arguments are protected from being modified by previous tasks in a chain.

Returns

TypeDescription
booleanTrue if the signature is immutable, False otherwise

clone()

@classmethod
def clone(
args: tuple = None,
kwargs: dict = None
) - > object

Creates a copy of the signature with optional overrides for arguments.

Parameters

NameTypeDescription
argstuple = NonePositional arguments to prepend to the existing arguments
kwargsdict = NoneKeyword arguments to merge with existing ones

Returns

TypeDescription
objectA new signature instance with the merged arguments

freeze()

@classmethod
def freeze(
id: string = None,
group_id: string = None,
chord: object = None,
root_id: string = None,
group_index: integer = None
) - > object

Finalizes the signature by assigning a concrete task ID and other workflow identifiers.

Parameters

NameTypeDescription
idstring = NoneThe specific task UUID to assign
group_idstring = NoneThe ID of the group this task belongs to
chordobject = NoneThe chord callback signature if applicable
root_idstring = NoneThe ID of the root task in the workflow
group_indexinteger = NoneThe position of the task within a group

Returns

TypeDescription
objectAn AsyncResult instance representing the future result of the task

set()

@classmethod
def set(
immutable: boolean = None,
**options: dict
) - > object

Updates the execution options or immutability status of the signature.

Parameters

NameTypeDescription
immutableboolean = NoneWhether to prevent argument modification in chains
**optionsdictArbitrary execution options like 'queue', 'countdown', or 'priority'

Returns

TypeDescription
objectThe signature instance with updated options for chaining

@classmethod
def link(
callback: object
) - > object

Appends a callback task to be executed upon successful completion of this task.

Parameters

NameTypeDescription
callbackobjectThe signature of the task to execute on success

Returns

TypeDescription
objectThe signature instance for chaining

@classmethod
def link_error(
errback: object
) - > object

Appends an error handler task to be executed if this task fails.

Parameters

NameTypeDescription
errbackobjectThe signature of the task to execute on failure

Returns

TypeDescription
objectThe signature instance for chaining