Skip to content

Commit 4c93e9f

Browse files
committed
we in code set pending and running states for tasks, now we also unset them immediately in code as needed
1 parent 6914436 commit 4c93e9f

File tree

1 file changed

+5
-4
lines changed
  • src/gazeMapper/GUI/_impl

1 file changed

+5
-4
lines changed

src/gazeMapper/GUI/_impl/gui.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,7 @@ def _update_jobs_and_process_pool(self):
477477
# set pending and running states since these are not stored in the states file
478478
for job_id in self.job_scheduler.jobs:
479479
job_state = self.job_scheduler.jobs[job_id].get_state()
480-
if job_state in [process_pool.State.Pending, process_pool.State.Running]:
481-
self._update_job_states_impl(self.job_scheduler.jobs[job_id].user_data, job_state)
480+
self._update_job_states_impl(self.job_scheduler.jobs[job_id].user_data, job_state)
482481

483482
# if there are no jobs left, clean up process pool
484483
self.process_pool.cleanup_if_no_jobs()
@@ -499,9 +498,11 @@ def _update_job_states_impl(self, job: utils.JobInfo, job_state: process_pool.St
499498
rec = sess.recordings.get(job.recording,None)
500499
if rec is None:
501500
return
502-
rec.state[job.action] = job_state
501+
if job_state!= rec.state[job.action] and (job_state in [process_pool.State.Pending, process_pool.State.Running] or rec.state[job.action] in [process_pool.State.Pending, process_pool.State.Running]):
502+
rec.state[job.action] = job_state
503503
else:
504-
sess.state[job.action] = job_state
504+
if job_state!= sess.state[job.action] and (job_state in [process_pool.State.Pending, process_pool.State.Running] or sess.state[job.action] in [process_pool.State.Pending, process_pool.State.Running]):
505+
sess.state[job.action] = job_state
505506

506507
def _action_done_callback(self, future: process_pool.ProcessFuture, job_id: int, job: utils.JobInfo, state: process_pool.State):
507508
# if process failed, notify error

0 commit comments

Comments
 (0)