-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into pre-commit-ci-update-config
- Loading branch information
Showing
6 changed files
with
531 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,253 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"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": { | ||
"vscode": { | ||
"languageId": "html" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%%html\n", | ||
"\n", | ||
"<style>\n", | ||
" .output_subarea {\n", | ||
" max-width: none !important;\n", | ||
" }\n", | ||
" .header-tr {\n", | ||
" column-gap: 5px;\n", | ||
" }\n", | ||
" .th {\n", | ||
" padding: 2px 5px;\n", | ||
" font-weight: bold;\n", | ||
" color: #fff;\n", | ||
" text-align: center;\n", | ||
" background-color: #000;\n", | ||
" }\n", | ||
" .tr:hover {\n", | ||
" background-color: #f5f5f5;\n", | ||
" }\n", | ||
" hr {\n", | ||
" border-top: 1px solid #d3d3d3;\n", | ||
" }\n", | ||
"</style>\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ipywidgets as ipw\n", | ||
"\n", | ||
"\n", | ||
"class LoadingWidget(ipw.HBox):\n", | ||
" \"\"\"Widget for displaying a loading spinner.\"\"\"\n", | ||
"\n", | ||
" def __init__(self, message=\"Loading\", **kwargs):\n", | ||
" super().__init__(\n", | ||
" children=[\n", | ||
" ipw.Label(message),\n", | ||
" ipw.HTML(\n", | ||
" value=\"<i class='fa fa-spinner fa-spin fa-2x fa-fw'/>\",\n", | ||
" layout=ipw.Layout(margin=\"12px 0 6px\"),\n", | ||
" ),\n", | ||
" ],\n", | ||
" layout=ipw.Layout(\n", | ||
" justify_content=\"center\",\n", | ||
" align_items=\"center\",\n", | ||
" **kwargs.pop(\"layout\", {}),\n", | ||
" ),\n", | ||
" **kwargs,\n", | ||
" )\n", | ||
" self.add_class(\"loading\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# AiiDAlab code setup\n", | ||
"\n", | ||
"This page provides an interface for creating and managing AiiDA codes on local or remote machines.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<hr>\n", | ||
"\n", | ||
"## Create new code\n", | ||
"\n", | ||
"To create a new AiiDA code for use in a calculation, follow these steps:\n", | ||
"\n", | ||
"#### Quick setup (using [AiiDA resource registry](https://github.com/aiidateam/aiida-resource-registry) recipes)\n", | ||
"\n", | ||
"1. Select the domain of your remote machine\n", | ||
"2. Select the computer recipe\n", | ||
"3. Select the code recipe\n", | ||
"4. Complete the remaining fields (these depend on the combination selected in steps 1-3)\n", | ||
"5. Click **Quick setup**\n", | ||
"\n", | ||
"#### Manual setup (create new resources from scratch)\n", | ||
"\n", | ||
"1. Tick the checkbox above the **Quick setup** button\n", | ||
"2. Follow along with the provided instructions\n", | ||
"\n", | ||
"Newly created codes will be available in the **Available codes** section, as well as in code selectors provided in various apps.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"new_codes_widget_container = ipw.VBox(\n", | ||
" children=[\n", | ||
" LoadingWidget(\"Loading resource setup widget\"),\n", | ||
" ],\n", | ||
")\n", | ||
"display(new_codes_widget_container)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<hr>\n", | ||
"\n", | ||
"## Available codes\n", | ||
"\n", | ||
"Below are the available codes in the AiiDA database. Use the controls to filter the list by label, executable path, and visibility. You can mark individual codes as _hidden_ to exclude them from code selectors used in apps (note that some apps may enforce the inclusion of hidden codes). Click **Unhide all** to include all codes. If codes are deleted from the database, click **Refresh codes** to reflect the change in the list.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"available_codes_widget_container = ipw.VBox(\n", | ||
" children=[\n", | ||
" LoadingWidget(\"Loading available codes\"),\n", | ||
" ],\n", | ||
")\n", | ||
"display(available_codes_widget_container)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ipywidgets as ipw\n", | ||
"from aiidalab_widgets_base.computational_resources import ResourceSetupBaseWidget\n", | ||
"from aiidalab_widgets_base.utils import StatusHTML\n", | ||
"\n", | ||
"setup_message = StatusHTML(clear_after=15)\n", | ||
"\n", | ||
"widget = ResourceSetupBaseWidget()\n", | ||
"ipw.dlink(\n", | ||
" (widget, \"message\"),\n", | ||
" (setup_message, \"message\"),\n", | ||
")\n", | ||
"\n", | ||
"new_codes_widget_container.children = [\n", | ||
" widget,\n", | ||
" setup_message,\n", | ||
"]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from home.code_setup import create_paginated_table, fetch_code_data\n", | ||
"\n", | ||
"output = ipw.Output()\n", | ||
"\n", | ||
"\n", | ||
"def render():\n", | ||
" data = fetch_code_data()\n", | ||
" paginated_table = create_paginated_table(data)\n", | ||
" output.clear_output()\n", | ||
" with output:\n", | ||
" display(paginated_table)\n", | ||
"\n", | ||
"\n", | ||
"refresh_button = ipw.Button(\n", | ||
" description=\"Refresh codes\",\n", | ||
" button_style=\"primary\",\n", | ||
" icon=\"refresh\",\n", | ||
" tooltip=\"Refresh the list of codes\",\n", | ||
" layout=ipw.Layout(width=\"fit-content\"),\n", | ||
")\n", | ||
"refresh_button.on_click(lambda _: render())\n", | ||
"\n", | ||
"available_codes_widget_container.children = [\n", | ||
" refresh_button,\n", | ||
" output,\n", | ||
"]\n", | ||
"\n", | ||
"render()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def on_code_setup_message_change(change):\n", | ||
" if \"created\" in change[\"new\"]:\n", | ||
" render()\n", | ||
"\n", | ||
"\n", | ||
"widget.aiida_code_setup.observe(\n", | ||
" on_code_setup_message_change,\n", | ||
" \"message\",\n", | ||
")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "base", | ||
"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": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "v24.12.1" | ||
__version__ = "v25.01.0" |
Oops, something went wrong.