Skip to content

Commit 8eeac67

Browse files
committed
fix: Fix analysis loop bug
Signed-off-by: ClProsser <clemens.prosser@gmail.com>
1 parent 9bcb32a commit 8eeac67

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

embark/workers/orchestrator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _reset(self):
152152
analysis.duration = str(analysis.scan_time)
153153
analysis.save()
154154
self._remove_worker(worker)
155-
worker_soft_reset_task.delay(worker.id, only_reset=True)
155+
worker_soft_reset_task.delay(worker.id, True)
156156

157157
for worker_ip, worker in all_workers.items():
158158
self.free_workers[worker_ip] = worker

embark/workers/tasks.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ def monitor_worker_and_fetch_logs(worker_id) -> None:
341341
analysis.save()
342342

343343
if not ssh_failed:
344-
worker_soft_reset_task(worker.id)
344+
orchestrator.remove_worker(worker)
345+
346+
worker_soft_reset_task(worker.id, True)
345347
process_update_queue(worker)
346348

347-
if not worker.status == Worker.ConfigStatus.CONFIGURED:
348-
orchestrator.remove_worker(worker)
349-
if orchestrator.is_busy(worker):
350-
orchestrator.release_worker(worker)
349+
if worker.status == Worker.ConfigStatus.CONFIGURED:
350+
orchestrator.add_worker(worker)
351351

352352
orchestrator.assign_tasks()
353353

@@ -600,9 +600,6 @@ def worker_soft_reset_task(worker_id, only_reset=False):
600600
Removes the worker from the orchestrator, reassigns the analysis if needed,
601601
connects via SSH to the worker and performs the soft reset, and re-adds the worker to the orchestrator.
602602
603-
Removes the worker from the orchestrator, reassigns the analysis if needed,
604-
connects via SSH to the worker and performs the soft reset, and re-adds the worker to the orchestrator.
605-
606603
:param worker_id: ID of worker to soft reset
607604
:param only_reset: If True, only performs the reset without reassigning the analysis or removing the worker from the orchestrator.
608605
"""
@@ -658,7 +655,7 @@ def worker_hard_reset_task(worker_id):
658655
orchestrator = get_orchestrator()
659656
orchestrator.remove_worker(worker, False)
660657

661-
worker_soft_reset_task(worker_id)
658+
worker_soft_reset_task(worker_id, True)
662659

663660
ssh_client = None
664661
try:

0 commit comments

Comments
 (0)