Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/gallery/advanced/autogen/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def add(x, y):
wg3.add_task('workgraph.get_context', name='get_ctx1', key='sum.add1')

wg.show()
wg.to_html()
wg


@task.graph()
Expand Down Expand Up @@ -161,7 +161,7 @@ def internal_add(x, y):
value=add1.outputs.result,
)

wg.to_html()
wg
wg.show()

# %%
Expand Down
18 changes: 9 additions & 9 deletions docs/gallery/advanced/autogen/context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ def AddMultiply(x, y, z):
#
# How do they compare visually?

AddMultiply.build(x=1, y=2, z=3).to_html()
AddMultiply.build(x=1, y=2, z=3)

# %%

wg.to_html()
wg

# %%
# With the context manager approach, we now gain a clear representation of workflow inputs and their connections to tasks.
Expand Down Expand Up @@ -187,7 +187,7 @@ def AddMultiply(x, y, z):
# %%
# Let's see what this looks like visually.

wg.to_html()
wg

# %%
# Again, we see our workflow inputs, this time clearly organized under the ``add`` and ``multiply`` namespaces, with clear connections to each task.
Expand Down Expand Up @@ -279,7 +279,7 @@ def generate_add_multiply_workgraph():
#
# Let's have a look at the graph:

wg.to_html()
wg

# %%
# You can compare this graph against the one generated by the decorator paradigm (see :ref:`here <howto:combine-workgraphs:add-workgraph>`).
Expand Down Expand Up @@ -340,7 +340,7 @@ def generate_add_multiply_workgraph():
# even though it only needs the result from task2.
task3_outputs = add(x=1, y=task1_outputs.result)

wg.to_html()
wg

# %%
# The graph shows the first executed ``add`` task providing its result to the zone,
Expand Down Expand Up @@ -406,7 +406,7 @@ def generate_add_multiply_workgraph():
# From there, only one result is then fed as the input to the last add task (``add2``), and finally, the global workflow outputs.
# Lastly, we can see connections from each ``if_zone``'s special ``_wait`` output socket to the ``_wait`` input socket of the ``add2`` task, which represent the explicit waiting between the tasks as defined by the ``>>`` syntax.

wg.to_html()
wg

# %%
# .. admonition:: Take home message
Expand Down Expand Up @@ -470,7 +470,7 @@ def generate_add_multiply_workgraph():
# Visually, the ``While`` context manager is depicted as a `while zone`, containing all its child tasks.
# The zone simplifies the visualization of the loop structure, as it separates the logic executed within the loop from the one outside.

wg.to_html()
wg

# %%
# .. note::
Expand Down Expand Up @@ -542,7 +542,7 @@ def get_value(data, key):
# %%
# Let's inspect the task graph:

wg.to_html()
wg

# %%
# We can see with the ``Map`` zone the tasks onto which the input data would be mapped.
Expand Down Expand Up @@ -669,7 +669,7 @@ def aggregate_sum(data: spec.dynamic(Any)) -> int:
).result
wg3.outputs.new_sum = new_sum

wg3.to_html()
wg3

# %%
print(f'State of WorkGraph : {wg3.state}')
Expand Down
8 changes: 4 additions & 4 deletions docs/gallery/advanced/autogen/node_graph_programming.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def multiply(x, y):
print(f'Result: {wg.outputs.result.value}')

# Visualize the workgraph
wg.to_html()
wg

# %%
# Conditional logic with the `If Zone` task
Expand Down Expand Up @@ -125,7 +125,7 @@ def multiply(x, y):
assert wg.outputs.result.value == 5

# Visualize the workgraph
wg.to_html()
wg

# %%
# Loops with `While Zone` task
Expand Down Expand Up @@ -170,7 +170,7 @@ def multiply(x, y):
assert wg.outputs.result.value == 15

# Visualize the workgraphs
wg.to_html()
wg

# %%
# Mapping operations with `Map Zone` task
Expand Down Expand Up @@ -234,7 +234,7 @@ def calc_sum(data: spec.dynamic(Any)) -> int:
assert wg.outputs.result.value == 10

# Visualize the workgraph
wg.to_html()
wg

# %%
# Conclusion
Expand Down
5 changes: 1 addition & 4 deletions docs/gallery/autogen/quick_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,9 @@ def AddMultiply(x, y, z):
#
# Let's build the workflow with some input and visualize it:
#
# .. important::
#
# If you are following along in a Jupyter notebook, replace ``wg.to_html()`` with ``wg``.

wg = AddMultiply.build(x=2, y=3, z=4)
wg.to_html()
wg

# %%
# We can see our two tasks, the assignment of the sum to the multiplication task, and the subsequent assignment of the product to the workflow (graph) result.
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery/concept/autogen/task_concept.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def multiply(x, y):


# export the task to html file so that it can be visualized in a browser
add()._task.to_html()
add()._task

# visualize the task in jupyter-notebook
# add()._task
Expand Down Expand Up @@ -83,7 +83,7 @@ def multiply(x, y):

wg = WorkGraph()
norm_task = wg.add_task(NormTask, name='norm1')
norm_task.to_html()
norm_task


######################################################################
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery/concept/autogen/workgraph_concept.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def add(x, y):
wg.add_link(add1.outputs.result, add2.inputs.x)

# Visualize the graph
wg.to_html()
wg

# %%
# .. note::
Expand Down Expand Up @@ -90,7 +90,7 @@ def add(x, y):
assert wg.outputs.sum2.value == 2 + (2 + 3)

# Visualize the graph with inputs and outputs
wg.to_html()
wg

# %%
# .. note::
Expand Down
6 changes: 3 additions & 3 deletions docs/gallery/howto/autogen/annotate_inputs_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def AddMultiplyInputs(x: int, y: int):


wg = AddMultiplyInputs.build(x=1, y=2)
wg.to_html()
wg

# %%
# Note how the ``x`` input is passed to ``data.x`` (and similarly for ``y``).
Expand Down Expand Up @@ -524,7 +524,7 @@ def AddMultiplyFinal(
'add_multiply2': {'data': {'x': 3, 'y': 4}},
},
)
wg.to_html()
wg

# %%
# In the example above:
Expand Down Expand Up @@ -625,7 +625,7 @@ def UseExclude(
'consume_complex2': {'data': {'pw': {'kpoints': 4, 'parameters': 5}, 'metadata': {}}},
},
)
wg.to_html()
wg

# %%
# In the GUI representation, you can see that the graph has a top-level ``structure`` input,
Expand Down
2 changes: 1 addition & 1 deletion docs/gallery/howto/autogen/combine_workgraphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def AddMultiplyComposed(minimum, maximum, x, y):
# See how we're using `AddMultiply` as a regular task? It's as simple as that!
# This is also clear in when we visualize the workgraph:

wg.to_html()
wg

# %%
# .. tip::
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery/howto/autogen/control-flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def ForLoop(n, m):
return m


ForLoop.build(n=4, m=0).to_html()
ForLoop.build(n=4, m=0)

# %%
# .. important::
Expand Down Expand Up @@ -114,7 +114,7 @@ def WhileLoop(n, m):

wg = WhileLoop.build(n=4, m=0)

wg.to_html()
wg


# %%
Expand Down
2 changes: 1 addition & 1 deletion docs/gallery/howto/autogen/interoperate_with_aiida_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def AiiDAComponentsWorkflow():


wg = AiiDAComponentsWorkflow.build()
wg.to_html()
wg

# %%
# Let's run our ``aiida-core``-powered ``WorkGraph`` and examine the provenance graph:
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery/howto/autogen/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def TimeMonitor(time, x, y):
x=1,
y=2,
)
wg.to_html()
wg

# %%
wg.run()
Expand Down Expand Up @@ -159,7 +159,7 @@ def FileMonitor(x, y, z):


wg = FileMonitor.build(x=1, y=2, z=3)
wg.to_html()
wg

# %%
wg.run()
Expand Down
2 changes: 1 addition & 1 deletion docs/gallery/howto/autogen/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def ParallelSquare(
# Workflow view
# """""""""""""

wg.to_html()
wg

# %%
# Provenance graph
Expand Down
2 changes: 1 addition & 1 deletion docs/gallery/howto/autogen/set_task_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def add_and_multiply(x, y, z):

# Build and visualize the graph
wg = add_and_multiply.build(x=1, y=2, z=3)
wg.to_html()
wg

# %%
# As you can see in the visualization, the task are now labeled "my_add" and "my_multiply" instead of the default function names.
Expand Down
2 changes: 1 addition & 1 deletion docs/gallery/howto/autogen/shelljob.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def ShellAddMultiply(x: int, y: int, z: int) -> int:

# Create a workgraph
wg = ShellAddMultiply.build(2, 3, 4)
wg.to_html()
wg

# %%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def sum_even_workgraph(N: int):

# The `to_html()` method generates an interactive visualization of the graph.
# In a Sphinx-Gallery build, this will be embedded directly in the output.
wg.to_html()
wg

# %%
# Execute the WorkGraph and print the result.
Expand Down
8 changes: 2 additions & 6 deletions docs/gallery/tutorial/autogen/materials_science_ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ def atomization_energy_workflow(molecule_obj: Atoms, atom_obj: Atoms) -> float:
# %%
# You can visualize the planned workflow.
#
# .. note::
#
# If you run in a Jupyter notebook, replace ``wg.to_html()`` with ``wg``.

wg.to_html()
wg


# %%
Expand Down Expand Up @@ -240,7 +236,7 @@ def eos_workflow(atoms: Atoms, scales: list, run_relax: bool = True) -> dict:
# %%
# Next, we build the workgraph with the inputs and visualize it:
wg = eos_workflow.build(atoms=cu, scales=scales)
wg.to_html()
wg

# %%
# Finally, we run the workflow:
Expand Down
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import shutil
from pathlib import Path


sys.path.insert(0, os.path.abspath('../..'))


Expand Down Expand Up @@ -67,6 +66,7 @@
'filename_pattern': '/*',
'examples_dirs': gallery_src_dirs, # in sphinx-gallery doc referred as gallery source
'gallery_dirs': sphinx_src_autogen_dirs, # path to where to gallery puts generated files
'capture_repr': ('_repr_html_', '__repr__'),
}

exclude_patterns = []
Expand Down Expand Up @@ -122,6 +122,8 @@


# Function to copy HTML files


def copy_html_files(app, exception):
"""
Copy all .html files from source to build directory, maintaining the directory structure.
Expand Down