Skip to content
Open
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
149 changes: 149 additions & 0 deletions process.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Inspecting AiiDA processes"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%javascript\n",
"\n",
"IPython.OutputArea.prototype._should_scroll = function(lines) {\n",
" return false;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from aiida import load_profile\n",
"\n",
"load_profile();"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import urllib.parse as urlparse\n",
"\n",
"from aiida.orm import load_node\n",
"from aiidalab_widgets_base import (\n",
" ProcessCallStackWidget,\n",
" ProcessFollowerWidget,\n",
" ProcessInputsWidget,\n",
" ProcessOutputsWidget,\n",
" ProcessReportWidget,\n",
" ProgressBarWidget,\n",
" RunningCalcJobOutputWidget,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"url = urlparse.urlsplit(jupyter_notebook_url) # noqa: F821\n",
"url_dict = urlparse.parse_qs(url.query)\n",
"if \"id\" in url_dict:\n",
" pk = int(url_dict[\"id\"][0])\n",
" process = load_node(pk)\n",
"else:\n",
" process = None"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Process inputs."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display(ProcessInputsWidget(process))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Process outputs."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"display(ProcessOutputsWidget(process))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"follower = ProcessFollowerWidget(\n",
" process,\n",
" followers=[\n",
" ProgressBarWidget(),\n",
" ProcessReportWidget(),\n",
" ProcessCallStackWidget(),\n",
" RunningCalcJobOutputWidget(),\n",
" ],\n",
" path_to_root=\"../../\",\n",
" update_interval=2,\n",
")\n",
"display(follower)\n",
"follower.follow(detach=True)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
},
"vscode": {
"interpreter": {
"hash": "d4d1e4263499bec80672ea0156c357c1ee493ec2b1c70f0acce89fc37c4a6abe"
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}
149 changes: 149 additions & 0 deletions process_list.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Listing AiiDA processes"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%javascript\n",
"\n",
"IPython.OutputArea.prototype._should_scroll = function(lines) {\n",
" return false;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from aiida import load_profile\n",
"\n",
"load_profile();"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as ipw\n",
"from aiidalab_widgets_base import ProcessListWidget\n",
"from plumpy import ProcessState\n",
"from traitlets import dlink"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"process_list = ProcessListWidget(path_to_root=\"../../\")\n",
"\n",
"past_days_widget = ipw.IntText(value=7, description=\"Past days:\")\n",
"dlink((past_days_widget, \"value\"), (process_list, \"past_days\"))\n",
"\n",
"\n",
"all_days_checkbox = ipw.Checkbox(description=\"All days\", value=False)\n",
"dlink((all_days_checkbox, \"value\"), (past_days_widget, \"disabled\"))\n",
"dlink(\n",
" (all_days_checkbox, \"value\"),\n",
" (process_list, \"past_days\"),\n",
" transform=lambda v: -1 if v else past_days_widget.value,\n",
")\n",
"\n",
"incoming_node_widget = ipw.Text(\n",
" description=\"Incoming node:\", style={\"description_width\": \"initial\"}\n",
")\n",
"dlink((incoming_node_widget, \"value\"), (process_list, \"incoming_node\"))\n",
"\n",
"\n",
"outgoing_node_widget = ipw.Text(\n",
" description=\"Outgoing node:\", style={\"description_width\": \"initial\"}\n",
")\n",
"dlink((outgoing_node_widget, \"value\"), (process_list, \"outgoing_node\"))\n",
"\n",
"\n",
"available_states = [state.value for state in ProcessState]\n",
"process_state_widget = ipw.SelectMultiple(\n",
" options=available_states,\n",
" value=available_states,\n",
" description=\"Process State:\",\n",
" style={\"description_width\": \"initial\"},\n",
" disabled=False,\n",
")\n",
"dlink((process_state_widget, \"value\"), (process_list, \"process_states\"))\n",
"\n",
"process_label_widget = ipw.Text(\n",
" description=\"Process label:\", style={\"description_width\": \"initial\"}\n",
")\n",
"dlink((process_label_widget, \"value\"), (process_list, \"process_label\"))\n",
"\n",
"description_contains_widget = ipw.Text(\n",
" description=\"Description contains:\", style={\"description_width\": \"initial\"}\n",
")\n",
"dlink((description_contains_widget, \"value\"), (process_list, \"description_contains\"))\n",
"\n",
"display(\n",
" ipw.HBox(\n",
" [\n",
" ipw.VBox([past_days_widget, process_state_widget]),\n",
" ipw.VBox(\n",
" [\n",
" all_days_checkbox,\n",
" incoming_node_widget,\n",
" outgoing_node_widget,\n",
" process_label_widget,\n",
" description_contains_widget,\n",
" ],\n",
" layout={\"margin\": \"0px 0px 0px 40px\"},\n",
" ),\n",
" ]\n",
" ),\n",
" process_list,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"process_list.start_autoupdate(update_interval=30)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 4
}