From 517ffcb1c5ce32f281589432cde1d58588fa83e0 Mon Sep 17 00:00:00 2001 From: Clark Zhiwen Shi <110199757+Clarkszw@users.noreply.github.com> Date: Sat, 19 Aug 2023 09:05:57 +0200 Subject: [PATCH] Docs: Add links about "entry point" and "plugin" to tutorial (#6095) The tutorial was missing an explanation of where the entry point for the workflow came from, and how users can write their own plugins and make them available via an entry point. --------- Co-authored-by: Leopold Talirz Co-authored-by: Jusong Yu --- docs/source/intro/tutorial.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/source/intro/tutorial.md b/docs/source/intro/tutorial.md index 2be668e1d2..e50da6613c 100644 --- a/docs/source/intro/tutorial.md +++ b/docs/source/intro/tutorial.md @@ -501,11 +501,12 @@ class MultiplyAddWorkChain(WorkChain): ``` :::{note} -Besides WorkChain's, workflows can also be implemented as *work functions*. +Besides WorkChain's, workflows can also be implemented as {ref}`work functions `. These are ideal for workflows that are not very computationally intensive and can be easily implemented in a Python function. ::: Let's run the `WorkChain` above! + Start up the `verdi shell` and load the `MultiplyAddWorkChain` using the `WorkflowFactory`: ```{code-cell} ipython3 @@ -513,10 +514,13 @@ from aiida import plugins MultiplyAddWorkChain = plugins.WorkflowFactory('core.arithmetic.multiply_add') ``` -The `WorkflowFactory` is a useful and robust tool for loading workflows based on their *entry point*, e.g. `'core.arithmetic.multiply_add'` in this case. +The `WorkflowFactory` loads workflows based on their {ref}`entry point `, e.g. `'core.arithmetic.multiply_add'` in this case. +The entry point mechanism allows AiiDA to automatically discover workflows provided by `aiida-core` and {ref}`AiiDA plugins `, and display them to the user, e.g. via `verdi plugin list aiida.workflows`. Pass the entry point as an argument to display detailed information, e.g. via `verdi plugin list aiida.workflows core.arithmetic.multiply_add`. + Similar to a `CalcJob`, the `WorkChain` input can be set up using a builder: ```{code-cell} ipython3 +from aiida import orm builder = MultiplyAddWorkChain.get_builder() builder.code = orm.load_code(label='add') builder.x = orm.Int(2) @@ -528,6 +532,7 @@ builder Once the `WorkChain` input has been set up, we run it with the AiiDA engine: ```{code-cell} ipython3 +from aiida import engine engine.run(builder) ```