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,8 +350,9 @@ class HasEnvironment:
yield namespace
del namespace.setattr_argument
argdict = self.__argument_mgr.get_interactive(interactive_arglist, title)
for key, value in argdict.items():
setattr(namespace, key, value)
if argdict is not None:
for key, value in argdict.items():
setattr(namespace, key, value)
def get_device_db(self):
"""Returns the full contents of the device database."""

View File

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

View File

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