Skip to content

Submitting a WorkGraph from a WorkChain #770

Description

@edan-bainglass

The docs suggest the following:

class TestWorkChain(WorkChain):
    @classmethod
    def define(cls, spec):
        super().define(spec)
        spec.input_namespace('workgraph', dynamic=True)
        spec.outline(
            cls.run_workgraph,
            cls.results,
        )
        spec.output('sum')
        spec.output('product')

    def run_workgraph(self):
        from aiida_workgraph.engine.workgraph import WorkGraphEngine

        process = self.submit(WorkGraphEngine, **self.inputs.workgraph)  # possible issue
        self.to_context(workgraph_process=process)

    def results(self):
        self.out('sum', self.ctx.workgraph_process.outputs.sum)
        self.out('product', self.ctx.workgraph_process.outputs.product)

But the possible issue I mark is that self.inputs.workgraph may (or does?) carry a process key, which appears to conflict with the one expected by the submit function, for which the example passes the WorkGraphEngine. We may need to assign directly to the workgraph_data key.

Still investigating. Pinging @superstar54 @GeigerJ2

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions