MCPcopy
hub / github.com/celery/celery / apply

Method apply

celery/bootsteps.py:186–212  ·  view source on GitHub ↗

Apply the steps in this blueprint to an object. This will apply the ``__init__`` and ``include`` methods of each step, with the object as argument:: step = Step(obj) ... step.include(obj) For :class:`StartStopStep` the services created

(self, parent, **kwargs)

Source from the content-addressed store, hash-verified

184 pass
185
186 def apply(self, parent, **kwargs):
187 """Apply the steps in this blueprint to an object.
188
189 This will apply the ``__init__`` and ``include`` methods
190 of each step, with the object as argument::
191
192 step = Step(obj)
193 ...
194 step.include(obj)
195
196 For :class:`StartStopStep` the services created
197 will also be added to the objects ``steps`` attribute.
198 """
199 self._debug('Preparing bootsteps.')
200 order = self.order = []
201 steps = self.steps = self.claim_steps()
202
203 self._debug('Building graph...')
204 for S in self._finalize_steps(steps):
205 step = S(parent, **kwargs)
206 steps[step.name] = step
207 order.append(step)
208 self._debug('New boot order: {%s}',
209 ', '.join(s.alias for s in self.order))
210 for step in order:
211 step.include(parent)
212 return self
213
214 def connect_with(self, other):
215 self.graph.adjacent.update(other.graph.adjacent)

Callers 1

test_connect_withMethod · 0.95

Calls 5

_debugMethod · 0.95
claim_stepsMethod · 0.95
_finalize_stepsMethod · 0.95
joinMethod · 0.45
includeMethod · 0.45

Tested by 1

test_connect_withMethod · 0.76