From d13debb42a6e7e6c4313b3f70755135d6d3184e9 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Mon, 1 May 2023 15:02:08 -0700 Subject: [PATCH 01/10] fix bash syntax issue --- easyCampaign/cli-tutorial.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easyCampaign/cli-tutorial.md b/easyCampaign/cli-tutorial.md index 3110b44..2944def 100644 --- a/easyCampaign/cli-tutorial.md +++ b/easyCampaign/cli-tutorial.md @@ -96,7 +96,7 @@ like: ``` # this will take a long time! -for file in transformations/*/*/*.json; do +for file in transformations/**/*.json; do relpath=${file:16} # strip off "transformations/" dirpath=${relpath%.*} # strip off final ".json" openfe quickrun $file -o results/$relpath -d results/$dirpath @@ -112,7 +112,7 @@ computing center. Here is an example of a very simple script that will create and submit a job script for the simplest SLURM use case: ``` -for file in transformations/*/*/*.json; do +for file in transformations/**/*.json; do relpath=${file:16} # strip off "transformations/" dirpath=${relpath%.*} # strip off final ".json" jobpath="transformations/${dirpath}.job" From 9e217daf1e51b8479446692ebbc9fa1aa7775045 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Mon, 1 May 2023 15:59:47 -0700 Subject: [PATCH 02/10] start of notebook for CLI demo --- easyCampaign/Cli Demo.ipynb | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 easyCampaign/Cli Demo.ipynb diff --git a/easyCampaign/Cli Demo.ipynb b/easyCampaign/Cli Demo.ipynb new file mode 100644 index 0000000..9ae16cc --- /dev/null +++ b/easyCampaign/Cli Demo.ipynb @@ -0,0 +1,50 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "785f29f9-889f-43ea-93ed-824de546993b", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "!pip install -q condacolab\n", + "import condacolab\n", + "condacolab.install_from_url(https://github.com/OpenFreeEnergy/ExampleNotebooks/releases/download/april-2023/OpenFEforge-0.7.4-Linux-x86_64.sh)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c23f5c0d-a36e-43f5-9f1e-1e3f3fba80ea", + "metadata": {}, + "outputs": [], + "source": [ + "import condacolab\n", + "condacolab.check()" + ] + } + ], + "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.10.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 589e3ec7b86a834e5eb15b4df5804cbc96ed1f75 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Mon, 1 May 2023 16:00:38 -0700 Subject: [PATCH 03/10] have nbval skip these cells --- easyCampaign/Cli Demo.ipynb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/easyCampaign/Cli Demo.ipynb b/easyCampaign/Cli Demo.ipynb index 9ae16cc..08ba336 100644 --- a/easyCampaign/Cli Demo.ipynb +++ b/easyCampaign/Cli Demo.ipynb @@ -9,6 +9,7 @@ }, "outputs": [], "source": [ + "# NBVAL_SKIP\n", "!pip install -q condacolab\n", "import condacolab\n", "condacolab.install_from_url(https://github.com/OpenFreeEnergy/ExampleNotebooks/releases/download/april-2023/OpenFEforge-0.7.4-Linux-x86_64.sh)" @@ -21,6 +22,7 @@ "metadata": {}, "outputs": [], "source": [ + "# NBVAL_SKIP\n", "import condacolab\n", "condacolab.check()" ] From d40569e65aa0826b8567f7060222a21e8b414a43 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Mon, 1 May 2023 16:03:04 -0700 Subject: [PATCH 04/10] fix syntax --- easyCampaign/Cli Demo.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easyCampaign/Cli Demo.ipynb b/easyCampaign/Cli Demo.ipynb index 08ba336..c1d05a5 100644 --- a/easyCampaign/Cli Demo.ipynb +++ b/easyCampaign/Cli Demo.ipynb @@ -12,7 +12,7 @@ "# NBVAL_SKIP\n", "!pip install -q condacolab\n", "import condacolab\n", - "condacolab.install_from_url(https://github.com/OpenFreeEnergy/ExampleNotebooks/releases/download/april-2023/OpenFEforge-0.7.4-Linux-x86_64.sh)" + "condacolab.install_from_url(\"https://github.com/OpenFreeEnergy/ExampleNotebooks/releases/download/april-2023/OpenFEforge-0.7.4-Linux-x86_64.sh\")" ] }, { From 3972ed1773e11a9f11a33f0fdab0abb55ebfb01b Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Mon, 1 May 2023 16:21:13 -0700 Subject: [PATCH 05/10] This notebooks will give you a shell with openfe --- easyCampaign/Cli Demo.ipynb | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/easyCampaign/Cli Demo.ipynb b/easyCampaign/Cli Demo.ipynb index c1d05a5..eaa5b6c 100644 --- a/easyCampaign/Cli Demo.ipynb +++ b/easyCampaign/Cli Demo.ipynb @@ -26,6 +26,63 @@ "import condacolab\n", "condacolab.check()" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4a9a49bd-4520-4ca6-96e1-378559248ac4", + "metadata": {}, + "outputs": [], + "source": [ + "# NBVAL_SKIP\n", + "from IPython.display import JSON\n", + "from google.colab import output\n", + "from subprocess import getoutput\n", + "import os\n", + "\n", + "def shell(command):\n", + " if command.startswith('cd'):\n", + " path = command.strip().split(maxsplit=1)[1]\n", + " os.chdir(path)\n", + " return JSON([''])\n", + " return JSON([getoutput(command)])\n", + "output.register_callback('shell', shell)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cc0b6da8-b400-4795-8f31-10d00e941449", + "metadata": {}, + "outputs": [], + "source": [ + "# NBVAL_SKIP\n", + "#@title Colab Shell\n", + "%%html\n", + "
\n", + "\n", + "\n", + "\n", + "