diff --git a/aiida_workgraph/collection.py b/aiida_workgraph/collection.py index dd859e3a..7af02e10 100644 --- a/aiida_workgraph/collection.py +++ b/aiida_workgraph/collection.py @@ -92,7 +92,6 @@ def new( # build the socket on the fly if the identifier is a callable if callable(identifier): - print("identifier is callable", identifier) identifier = build_socket_from_AiiDA(identifier) # Call the original new method return super().new(identifier, name, **kwargs) diff --git a/aiida_workgraph/engine/workgraph.py b/aiida_workgraph/engine/workgraph.py index a25e41f7..1de8c292 100644 --- a/aiida_workgraph/engine/workgraph.py +++ b/aiida_workgraph/engine/workgraph.py @@ -87,7 +87,6 @@ def define(cls, spec: WorkChainSpec) -> None: spec.outputs.dynamic = True - spec.output_namespace("new_data", dynamic=True) spec.output( "execution_count", valid_type=orm.Int, @@ -481,7 +480,7 @@ def setup(self) -> None: self.init_ctx(wgdata) # self.ctx._msgs = [] - self.ctx._execution_count = 0 + self.ctx._execution_count = 1 # init task results self.set_task_results() # data not to be persisted, because they are not serializable @@ -667,7 +666,6 @@ def kill_task(self, name: str) -> None: self.logger.error(f"Error in killing task {name}: {e}") def continue_workgraph(self) -> None: - print("Continue workgraph.") self.report("Continue workgraph.") # self.update_workgraph_from_base() task_to_run = [] @@ -1499,7 +1497,8 @@ def finalize(self) -> t.Optional[ExitCode]: ) self.out_many(group_outputs) # output the new data - self.out("new_data", self.ctx._new_data) + if self.ctx._new_data: + self.out("new_data", self.ctx._new_data) self.out("execution_count", orm.Int(self.ctx._execution_count).store()) self.report("Finalize workgraph.") for _, task in self.ctx._tasks.items(): diff --git a/tests/test_while.py b/tests/test_while.py index c47ab75d..ba8254c6 100644 --- a/tests/test_while.py +++ b/tests/test_while.py @@ -104,7 +104,7 @@ def test_while_workgraph(decorated_add, decorated_multiply, decorated_compare): add1.set_context({"result": "n"}) wg.add_link(multiply1.outputs["result"], add1.inputs["x"]) wg.submit(wait=True, timeout=100) - assert wg.execution_count == 3 + assert wg.execution_count == 4 assert wg.tasks["add1"].outputs["result"].value == 29