Skip to content

Control an AiiDA process precisely

Xing Wang edited this page Jun 24, 2024 · 3 revisions

Create a process node

First create a task and save the checkpoint

from aiida import load_profile
from aiida.workflows.arithmetic.multiply_add import MultiplyAddWorkChain
from aiida.orm import Int, load_code

load_profile()
code = load_code("add@localhost")
p = MultiplyAddWorkChain(inputs={"x":Int(1), "y": Int(2), "z": Int(3), "code": code})
p.runner.persister.save_checkpoint(p)

Launch the process

Then, in another script, continue the process

from aiida.manage import get_manager
process_controller = get_manager().get_process_controller()
pk = 4070
process_controller.continue_process(pk)

Becareful, don't run process_controller.continue_process(pk) multiple times.

Interaction with a running process

Pause/play a process