MCPcopy
hub / github.com/celery/celery / _chord

Class _chord

celery/canvas.py:1950–2365  ·  view source on GitHub ↗

r"""Barrier synchronization primitive. A chord consists of a header and a body. The header is a group of tasks that must complete before the callback is called. A chord is essentially a callback for a group of tasks. The body is applied with the return values of all the header

Source from the content-addressed store, hash-verified

1948
1949@Signature.register_type(name="chord")
1950class _chord(Signature):
1951 r"""Barrier synchronization primitive.
1952
1953 A chord consists of a header and a body.
1954
1955 The header is a group of tasks that must complete before the callback is
1956 called. A chord is essentially a callback for a group of tasks.
1957
1958 The body is applied with the return values of all the header
1959 tasks as a list.
1960
1961 Example:
1962
1963 The chord:
1964
1965 .. code-block:: pycon
1966
1967 >>> res = chord([add.s(2, 2), add.s(4, 4)])(sum_task.s())
1968
1969 is effectively :math:`\Sigma ((2 + 2) + (4 + 4))`:
1970
1971 .. code-block:: pycon
1972
1973 >>> res.get()
1974 12
1975 """
1976
1977 @classmethod
1978 def from_dict(cls, d, app=None):
1979 """Create a chord signature from a dictionary that represents a chord.
1980
1981 Example:
1982 >>> chord_dict = {
1983 "task": "celery.chord",
1984 "args": [],
1985 "kwargs": {
1986 "kwargs": {},
1987 "header": [
1988 {
1989 "task": "add",
1990 "args": [
1991 1,
1992 2
1993 ],
1994 "kwargs": {},
1995 "options": {},
1996 "subtask_type": None,
1997 "immutable": False
1998 },
1999 {
2000 "task": "add",
2001 "args": [
2002 3,
2003 4
2004 ],
2005 "kwargs": {},
2006 "options": {},
2007 "subtask_type": None,

Callers 1

chordFunction · 0.90

Calls 1

getitem_propertyClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…