Read ``.batch.p``, advance the state machine, persist the result, publish any new sub-batch, and fire progress events. Sync CLI batches (``driver="cli"``) are never advanced here — their state machine is owned by the CLI process. This method short-circuits
(self, jid, new_returns, now=None)
| 342 | # ------------------------------------------------------------------ |
| 343 | |
| 344 | def _progress_one(self, jid, new_returns, now=None): |
| 345 | """ |
| 346 | Read ``.batch.p``, advance the state machine, persist the |
| 347 | result, publish any new sub-batch, and fire progress events. |
| 348 | |
| 349 | Sync CLI batches (``driver="cli"``) are never advanced here |
| 350 | — their state machine is owned by the CLI process. This |
| 351 | method short-circuits if it's called for one anyway (e.g. |
| 352 | defensive callers, or a leftover entry in the active index). |
| 353 | """ |
| 354 | state = salt.utils.batch_state.read_batch_state(jid, self.opts) |
| 355 | if state is None: |
| 356 | log.warning( |
| 357 | "Batch %s has no readable .batch.p; retiring from active set", |
| 358 | jid, |
| 359 | ) |
| 360 | self._retire(jid) |
| 361 | return |
| 362 | if state.get("driver") == "cli": |
| 363 | return |
| 364 | if state.get("halted"): |
| 365 | self._retire(jid) |
| 366 | return |
| 367 | |
| 368 | action = salt.utils.batch_state.progress_batch(state, new_returns, now=now) |
| 369 | |
| 370 | if action.publish: |
| 371 | self._publish_sub_batch(state, action.publish) |
| 372 | |
| 373 | salt.utils.batch_state.write_batch_state(jid, state, self.opts) |
| 374 | |
| 375 | if action.publish or action.finished_minions or action.timed_out_minions: |
| 376 | if self.output is not None: |
| 377 | self.output.on_batch_progress(state) |
| 378 | |
| 379 | if salt.utils.batch_state.is_batch_done(state): |
| 380 | if self.output is not None: |
| 381 | self.output.on_batch_done(state) |
| 382 | self._retire(jid) |
| 383 | |
| 384 | def _tick(self, now=None): |
| 385 | """ |