if _cycle_sequences:
for i in range(len(_cycle_sequences)):
if _cycle_sequences[i].contains(worker_id):
return i
return 0
def create_process(
self,
After Change
Return:
last_participation: Index of the last cycle assigned to this worker.
_model = self._models.first(id=model_id)_cycles = self._cycles.query(fl_process_id=_model.fl_process_id)
last = 0
if not len(_cycles):
return last
for cycle in _cycles:
worker_cycle = self._worker_cycle.first(
cycle_id=cycle.id, worker_id=worker_id
)
if worker_cycle and cycle.sequence > last:
last = cycle.sequence
return last
def assign(self, model_id: str, version: str, worker, last_participation: int):