fix interactive args cancellation

This commit is contained in:
Simon Renblad 2024-03-22 17:30:56 +08:00
parent 13a36bf911
commit 3ed21a3b60
3 changed files with 7 additions and 5 deletions

View File

@ -350,6 +350,7 @@ class HasEnvironment:
yield namespace yield namespace
del namespace.setattr_argument del namespace.setattr_argument
argdict = self.__argument_mgr.get_interactive(interactive_arglist, title) argdict = self.__argument_mgr.get_interactive(interactive_arglist, title)
if argdict is not None:
for key, value in argdict.items(): for key, value in argdict.items():
setattr(namespace, key, value) setattr(namespace, key, value)

View File

@ -144,4 +144,4 @@ class InteractiveArgDB:
if rid not in self.futures: if rid not in self.futures:
raise ValueError("no experiment with this RID is " raise ValueError("no experiment with this RID is "
"waiting for interactive arguments") "waiting for interactive arguments")
self.futures[rid].cancel() self.futures[rid].set_result(None)

View File

@ -222,6 +222,7 @@ class ArgumentManager(ProcessArgumentManager):
arglist_desc = [(k, p.describe(), g, t) arglist_desc = [(k, p.describe(), g, t)
for k, p, g, t in interactive_arglist] for k, p, g, t in interactive_arglist]
arguments = ArgumentManager._get_interactive(arglist_desc, title) arguments = ArgumentManager._get_interactive(arglist_desc, title)
if arguments is not None:
for key, processor, _, _ in interactive_arglist: for key, processor, _, _ in interactive_arglist:
arguments[key] = processor.process(arguments[key]) arguments[key] = processor.process(arguments[key])
return arguments return arguments