MCPcopy
hub / github.com/celery/celery / _set_with_state

Method _set_with_state

celery/backends/elasticsearch.py:128–142  ·  view source on GitHub ↗
(self, key, value, state)

Source from the content-addressed store, hash-verified

126 )
127
128 def _set_with_state(self, key, value, state):
129 body = {
130 'result': value,
131 '@timestamp': '{}Z'.format(
132 datetime.now(timezone.utc).isoformat()[:-9]
133 ),
134 }
135 try:
136 self._index(
137 id=key,
138 body=body,
139 )
140 except elasticsearch.exceptions.ConflictError:
141 # document already exists, update it
142 self._update(key, body, state)
143
144 def set(self, key, value):
145 return self._set_with_state(key, value, None)

Calls 4

_indexMethod · 0.95
_updateMethod · 0.95
formatMethod · 0.45
nowMethod · 0.45