forked from retoor/devplacepy
Code Farm: per-plot auto-replant pause and crop-lock check; community sync and node work
Continuous Delivery could never be turned off once a crop was planted. Add a one-shot per-plot "stop after harvest" flag (POST /game/plot/stop, Devii tool game_plot_stop, game_plots.stop_after_harvest), cleared by the next plant, autoreplant claim or Refactor. Autoreplant now also respects crop locks through the shared _crop_lock predicate. Plan and measurements in happyplanting.md. Also includes the pending community sync, node network and related work in the tree; the full suite passed (4999) with all of it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,25 +5,28 @@ from __future__ import annotations
|
||||
from collections import Counter
|
||||
|
||||
from devplacepy.schemas.sync import SyncBatchOut, SyncRecordResultOut
|
||||
from devplacepy.services.sync.pending import PendingQueue
|
||||
from devplacepy.services.sync.processors import PROCESSORS
|
||||
from devplacepy.services.sync.records import SyncBatchForm
|
||||
from devplacepy.services.sync.spec import STATUSES
|
||||
|
||||
|
||||
class BatchRunner:
|
||||
def __init__(self, kind: str, *, request=None):
|
||||
def __init__(self, kind: str, *, request=None, humanize: bool = False):
|
||||
self.kind = kind
|
||||
self.request = request
|
||||
self.humanize = humanize
|
||||
|
||||
def run(self, data: SyncBatchForm) -> SyncBatchOut:
|
||||
processor = PROCESSORS[self.kind](
|
||||
data.origin, dry_run=data.dry_run, request=self.request
|
||||
data.origin, dry_run=data.dry_run, request=self.request, humanize=self.humanize
|
||||
)
|
||||
results = [
|
||||
SyncRecordResultOut(**vars(processor.process(index, raw)))
|
||||
for index, raw in enumerate(data.records)
|
||||
]
|
||||
tally = Counter(result.status for result in results)
|
||||
released = {} if data.dry_run else dict(PendingQueue().release(data.origin))
|
||||
return SyncBatchOut(
|
||||
origin=data.origin,
|
||||
kind=self.kind,
|
||||
@@ -31,4 +34,5 @@ class BatchRunner:
|
||||
total=len(results),
|
||||
counts={status: tally.get(status, 0) for status in STATUSES},
|
||||
results=results,
|
||||
released=released,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user