MCPcopy
hub / github.com/celery/celery / send_event

Method send_event

celery/app/task.py:923–947  ·  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

921 return xstarmap(self.s(), it, app=self.app)
922
923 def send_event(self, type_, retry=True, retry_policy=None, **fields):
924 """Send monitoring event message.
925
926 This can be used to add custom event types in :pypi:`Flower`
927 and other monitors.
928
929 Arguments:
930 type_ (str): Type of event, e.g. ``"task-failed"``.
931
932 Keyword Arguments:
933 retry (bool): Retry sending the message
934 if the connection is lost. Default is taken from the
935 :setting:`task_publish_retry` setting.
936 retry_policy (Mapping): Retry settings. Default is taken
937 from the :setting:`task_publish_retry_policy` setting.
938 **fields (Any): Map containing information about the event.
939 Must be JSON serializable.
940 """
941 req = self.request
942 if retry_policy is None:
943 retry_policy = self.app.conf.task_publish_retry_policy
944 with self.app.events.default_dispatcher(hostname=req.hostname) as d:
945 return d.send(
946 type_,
947 uuid=req.id, retry=retry, retry_policy=retry_policy, **fields)
948
949 def replace(self, sig):
950 """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