-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add job list page #657
Merged
superstar54
merged 14 commits into
aiidalab:main
from
superstar54:feature/add_search_result_page
Apr 24, 2024
Merged
Add job list page #657
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e2da83a
add job_list.ipynb
superstar54 d653121
add delete.ipynb
superstar54 212c9b2
support load process from url
superstar54 e9bd367
Merge branch 'main' into feature/add_search_result_page
superstar54 20f68a9
Merge branch 'main' into feature/add_search_result_page
superstar54 6e57bc5
Merge branch 'main' into feature/add_search_result_page
superstar54 45ccf4b
add search function
superstar54 79c10fc
Merge branch 'main' into feature/add_search_result_page
superstar54 afe3f8c
Merge branch 'main' into feature/add_search_result_page
superstar54 9268eb4
Merge branch 'main' into feature/add_search_result_page
superstar54 d915f75
make the search job code a class
superstar54 c6af1f3
add confirmation and explanation
superstar54 04b670d
check linked QEApp jobs before deletion
superstar54 402faa4
update warning message
superstar54 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# AiiDAlab QauntumESPRESSO App" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import urllib.parse as urlparse\n", | ||
"\n", | ||
"from aiida import load_profile\n", | ||
"from aiida.tools import delete_nodes\n", | ||
"\n", | ||
"url = urlparse.urlsplit(jupyter_notebook_url) # noqa F821\n", | ||
"query = urlparse.parse_qs(url.query)\n", | ||
"pk = int(query['pk'][0])\n", | ||
"\n", | ||
"\n", | ||
"def delete_node(pk):\n", | ||
" load_profile()\n", | ||
" ## delete the group\n", | ||
" _, was_deleted = delete_nodes([pk], dry_run=False)\n", | ||
"\n", | ||
" if was_deleted:\n", | ||
"\n", | ||
" print(f'Node {pk} deleted.')\n", | ||
"\n", | ||
"# Ask for confirmation\n", | ||
"if input(f'Do you really want to delete node {pk}? [y/N] ').strip().lower() == 'y':\n", | ||
" delete_node(pk)\n", | ||
"else:\n", | ||
" print('Deletion aborted.')" | ||
] | ||
} | ||
], | ||
"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": 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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# AiiDAlab QauntumESPRESSO App\n", | ||
superstar54 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"\n", | ||
"## Job List\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ipywidgets as ipw\n", | ||
"from aiida import load_profile\n", | ||
"from aiida.tools.query.calculation import CalculationQueryBuilder\n", | ||
"\n", | ||
"load_profile()\n", | ||
"\n", | ||
"\n", | ||
"process_label = \"QeAppWorkChain\"\n", | ||
"projections = [\"pk\", \"ctime\", \"state\", \"label\"]\n", | ||
"\n", | ||
"\n", | ||
"def query_data():\n", | ||
" builder = CalculationQueryBuilder()\n", | ||
" filters = builder.get_filters(\n", | ||
" process_label=process_label,\n", | ||
" )\n", | ||
" query_set = builder.get_query_set(\n", | ||
" filters=filters,\n", | ||
" order_by={\"ctime\": \"desc\"},\n", | ||
" )\n", | ||
" projected = builder.get_projected(\n", | ||
" query_set,\n", | ||
" projections=projections,\n", | ||
" )\n", | ||
" return projected\n", | ||
"\n", | ||
"\n", | ||
"table = ipw.HTML()\n", | ||
"\n", | ||
"table.value = \"\"\"\n", | ||
" <style>\n", | ||
" .df { border: none; }\n", | ||
" .df tbody tr:nth-child(odd) { background-color: #e5e7e9; }\n", | ||
" .df tbody tr:nth-child(odd):hover { background-color: #f5b7b1; }\n", | ||
" .df tbody tr:nth-child(even):hover { background-color: #f5b7b1; }\n", | ||
" .df tbody td { min-width: 80px; text-align: center; border: none }\n", | ||
" .df th { text-align: center; border: none; border-bottom: 1px solid black;}\n", | ||
" </style>\n", | ||
" \"\"\"\n", | ||
"\n", | ||
"# use pandas to create a dataframe from the query data\n", | ||
"import pandas as pd\n", | ||
"\n", | ||
"df = pd.DataFrame(query_data()[1:], columns=projections)\n", | ||
"\n", | ||
"# add a column to the dataframe with a button to delete the archive\n", | ||
"for index, row in df.iterrows():\n", | ||
" pk = row['pk']\n", | ||
" df.at[index, \"formula\"] = row['label'].split(\"structure\")[-0]\n", | ||
" df.at[index, \"relaxed\"] = \"is relaxed\" in row['label']\n", | ||
" df.at[index, \"properties\"] = row['label'].split(\"properties on\")[-1]\n", | ||
" df.at[index, 'Delete'] = f\"\"\"<a href=\"./delete.ipynb?pk={pk}\" target=\"_blank\">Delete</a>\"\"\"\n", | ||
" df.at[index, 'Inspect'] = f\"\"\"<a href=\"./qe.ipynb?pk={pk}\" target=\"_blank\">Inspect</a>\"\"\"\n", | ||
"\n", | ||
"# delete the label column\n", | ||
"df = df.drop(columns=['label'])\n", | ||
"\n", | ||
"table.value += df.to_html(classes=\"df\", escape=False, index=False)\n", | ||
"table" | ||
] | ||
} | ||
], | ||
"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": 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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also It might be a good idea to display the number nodes associated, so the person know what nodes or workchains are being deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I display the number of nodes to be deleted.