MCPcopy Create free account
hub / github.com/celery/celery / send_event

Method send_event

celery/app/task.py:1100–1124  ·  view source on GitHub ↗

Send monitoring event message. This can be used to add custom event types in :pypi:`Flower` and other monitors. Arguments: type_ (str): Type of event, e.g. ``"task-failed"``. Keyword Arguments: retry (bool): Retry sending the message

(self, type_, retry=True, retry_policy=None, **fields)

Source from the content-addressed store, hash-verified

1098 return xstarmap(self.s(), it, app=self.app)
1099
1100 def send_event(self, type_, retry=True, retry_policy=None, **fields):
1101 """Send monitoring event message.
1102
1103 This can be used to add custom event types in :pypi:`Flower`
1104 and other monitors.
1105
1106 Arguments:
1107 type_ (str): Type of event, e.g. ``"task-failed"``.
1108
1109 Keyword Arguments:
1110 retry (bool): Retry sending the message
1111 if the connection is lost. Default is taken from the
1112 :setting:`task_publish_retry` setting.
1113 retry_policy (Mapping): Retry settings. Default is taken
1114 from the :setting:`task_publish_retry_policy` setting.
1115 **fields (Any): Map containing information about the event.
1116 Must be JSON serializable.
1117 """
1118 req = self.request
1119 if retry_policy is None:
1120 retry_policy = self.app.conf.task_publish_retry_policy
1121 with self.app.events.default_dispatcher(hostname=req.hostname) as d:
1122 return d.send(
1123 type_,
1124 uuid=req.id, retry=retry, retry_policy=retry_policy, **fields)
1125
1126 def replace(self, sig):
1127 """Replace this task, with a new task inheriting the task id.

Callers 3

test_send_eventMethod · 0.45
test_send_eventMethod · 0.45

Calls 2

default_dispatcherMethod · 0.80
sendMethod · 0.45

Tested by 3

test_send_eventMethod · 0.36
test_send_eventMethod · 0.36