|
|
@@ -63,13 +63,16 @@ def ipc(func: Run[Action]) -> Run[Action]:
|
|
|
):
|
|
|
rval = func(self, context)
|
|
|
|
|
|
+ annotation = self.__pydantic_fields__["outputs"].annotation
|
|
|
+ assert annotation is not None
|
|
|
+
|
|
|
outdata = dotenv_values(output.name)
|
|
|
if self.outputs is not None:
|
|
|
+ annotation = self.outputs.__class__
|
|
|
outdata = vars(self.outputs) | outdata
|
|
|
|
|
|
- annotation = self.__pydantic_fields__["outputs"].annotation
|
|
|
- assert annotation is not None
|
|
|
self.outputs = annotation(**outdata)
|
|
|
+ _log_outputs(self)
|
|
|
|
|
|
return rval
|
|
|
|
|
|
@@ -153,14 +156,29 @@ def preamble(func: Run[Action]):
|
|
|
def wrapper(self: Action, context: Context) -> Status:
|
|
|
with logging_group(self, "Run %s", self.name):
|
|
|
_log_inputs(self)
|
|
|
- return func(self, context)
|
|
|
+ try:
|
|
|
+ return func(self, context)
|
|
|
+ finally:
|
|
|
+ _log_outputs(self)
|
|
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
|
def _log_inputs(self: Action) -> None:
|
|
|
inputs = [(k, v) for k, v in vars(self.inputs).items() if v is not None and v != ""]
|
|
|
- if inputs:
|
|
|
- self.logger.info("with:")
|
|
|
- for key, value in inputs:
|
|
|
- self.logger.info(" %s: %s", key, value)
|
|
|
+ if not inputs:
|
|
|
+ return
|
|
|
+
|
|
|
+ self.logger.info("with:")
|
|
|
+ for key, value in inputs:
|
|
|
+ self.logger.info(" %s: %s", key, value)
|
|
|
+
|
|
|
+
|
|
|
+def _log_outputs(self: Action) -> None:
|
|
|
+ outputs = [(k, v) for k, v in vars(self.outputs).items() if v is not None and v != ""]
|
|
|
+ if not outputs:
|
|
|
+ return
|
|
|
+
|
|
|
+ self.logger.debug("outputs:")
|
|
|
+ for key, value in outputs:
|
|
|
+ self.logger.debug(" %s: %s", key, value)
|