master: fix race condition in interactive args supply

Closes #2375
pull/2389/head
Sébastien Bourdeauducq 2024-04-02 16:10:00 +08:00
parent fddff13842
commit 5f49e582c8
1 changed files with 2 additions and 2 deletions

View File

@ -133,7 +133,7 @@ class InteractiveArgDB:
def supply(self, rid, values):
# quick sanity checks
if rid not in self.futures:
if rid not in self.futures or self.futures[rid].done():
raise ValueError("no experiment with this RID is "
"waiting for interactive arguments")
if {i[0] for i in self.pending.raw_view[rid]["arglist_desc"]} != set(values.keys()):
@ -141,7 +141,7 @@ class InteractiveArgDB:
self.futures[rid].set_result(values)
def cancel(self, rid):
if rid not in self.futures:
if rid not in self.futures or self.futures[rid].done():
raise ValueError("no experiment with this RID is "
"waiting for interactive arguments")
self.futures[rid].set_result(None)