This is an automated email from the ASF dual-hosted git repository.

dimuthuupe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/master by this push:
     new f7fc547d1b Jupyter image changes
f7fc547d1b is described below

commit f7fc547d1b85064d0ecb51462b03be651df6faa5
Author: Dimuthu Wannipurage <[email protected]>
AuthorDate: Mon Jul 22 05:50:00 2024 -0400

    Jupyter image changes
---
 .../airavata-agent/build-container.sh              |   4 +
 .../airavata-agent/jupyter/Dockerfile              |  14 +-
 .../airavata-agent/jupyter/labconfig/__init__.py   |   0
 .../jupyter/labconfig/airavata_magics.py           | 234 ++++++++++++++
 .../airavata-agent/jupyter/labconfig/bootstrap.sh  |   2 +
 .../airavata-agent/jupyter/magic.ipynb             | 340 ++++++++++++++++++---
 6 files changed, 554 insertions(+), 40 deletions(-)

diff --git a/modules/agent-framework/airavata-agent/build-container.sh 
b/modules/agent-framework/airavata-agent/build-container.sh
new file mode 100755
index 0000000000..411d222405
--- /dev/null
+++ b/modules/agent-framework/airavata-agent/build-container.sh
@@ -0,0 +1,4 @@
+env GOOS=linux GOARCH=amd64 go build
+cp airavata-agent airavata-agent-linux
+docker build --platform linux/x86_64 -t dimuthuupe/airavata-agent .
+docker push dimuthuupe/airavata-agent 
\ No newline at end of file
diff --git a/modules/agent-framework/airavata-agent/jupyter/Dockerfile 
b/modules/agent-framework/airavata-agent/jupyter/Dockerfile
index af6904add9..cd2f044471 100644
--- a/modules/agent-framework/airavata-agent/jupyter/Dockerfile
+++ b/modules/agent-framework/airavata-agent/jupyter/Dockerfile
@@ -4,10 +4,22 @@ RUN apt update
 RUN apt install fuse -y
 RUN pip install notebook
 RUN apt install kmod -y
+RUN apt install git -y
+RUN pip install PyJWT
+RUN pip install --upgrade cybershuttle-tune
+RUN pip install scipy
+RUN pip install numpy
+RUN pip install matplotlib
+
 
 COPY labconfig/jupyter_lab_config.py /jupyter_lab_config.py
+COPY labconfig/airavata_magics.py /airavata_magics.py
+COPY labconfig/__init__.py /__init__.py
+RUN git clone https://github.com/cyber-shuttle/jupyter-notebook-examples 
/home/jupyter-notebook-examples
+COPY labconfig/bootstrap.sh /bootstrap.sh
+RUN chmod +x /bootstrap.sh
 COPY fuse/client /client
 EXPOSE 8888
 WORKDIR /home
 
-ENTRYPOINT ["jupyter", "lab", "--config=/jupyter_lab_config.py", 
"--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root", 
"--NotebookApp.token=''"]
+ENTRYPOINT ["sh", "/bootstrap.sh"]
diff --git 
a/modules/agent-framework/airavata-agent/jupyter/labconfig/__init__.py 
b/modules/agent-framework/airavata-agent/jupyter/labconfig/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git 
a/modules/agent-framework/airavata-agent/jupyter/labconfig/airavata_magics.py 
b/modules/agent-framework/airavata-agent/jupyter/labconfig/airavata_magics.py
new file mode 100644
index 0000000000..c3cf49c204
--- /dev/null
+++ 
b/modules/agent-framework/airavata-agent/jupyter/labconfig/airavata_magics.py
@@ -0,0 +1,234 @@
+from IPython.core.magic import register_cell_magic
+from IPython.core.magic import register_line_magic
+
+from IPython.display import display, Image
+import base64
+import requests
+import json
+import jwt
+import time
+from pathlib import Path
+import os
+
+current_agent_info = None
+
+EXPLICIT_TOKEN_FILE = (
+        Path(os.path.expanduser("~")) / "csagent" / "token" / "keys.json"
+)
+
+def read_explicit_token_file():
+    if not EXPLICIT_TOKEN_FILE.exists():
+        return None
+    else:
+        with open(EXPLICIT_TOKEN_FILE, "r") as f:
+            return json.load(f)
+
+def get_access_token():
+    expl_token_data = read_explicit_token_file()
+    if expl_token_data:
+        return expl_token_data["access_token"]
+
+def get_agent_status():
+    global current_agent_info
+
+    if not current_agent_info:
+        print("No agent was scheduled yet. Please run %init_remote 
cluster=<cluster> cpu=<cpu> memory=<memory mb> queue=<queue> walltime=<walltime 
minutes>")
+        return
+
+    url = 'http://scigap02.sciencegateways.iu.edu:18880/api/v1/agent/' + 
current_agent_info['agentId']
+    response = requests.get(url)
+    if response.status_code == 202:
+        return response.json()
+    else:
+        print('Invalid response reveived. Status code:', response.status_code)
+        print('Response:', response.text)
+
+def submit_agent_job(experiment_name, cluster, queue, cpus, memory, wallTime, 
access_token, gateway_id='testdrive'):
+
+    global current_agent_info
+    # URL to which the POST request will be sent
+    url = 'http://scigap02.sciencegateways.iu.edu:18880/api/v1/exp/launch'
+
+    # Data to be sent in the POST request
+    data = {
+        'experimentName': experiment_name,
+        'remoteCluster': cluster,
+        'cpuCount': cpus,
+        'nodeCount': 1,
+        'memory': memory,
+        'wallTime': wallTime,
+        'queue': queue
+    }
+
+    # Convert the data to JSON format
+    json_data = json.dumps(data)
+
+    decode = jwt.decode(access_token, options={"verify_signature": False})
+    user_id = decode['preferred_username']
+    claimsMap = {
+        "userName": user_id,
+        "gatewayID": gateway_id
+    }
+
+    # Headers
+    headers = {
+        'Content-Type': 'application/json',
+        'Authorization': 'Bearer ' + access_token,
+        'X-Claims': json.dumps(claimsMap)
+    }
+
+    # Send the POST request
+    response = requests.post(url, headers=headers, data=json_data)
+
+    # Check if the request was successful
+    if response.status_code == 200:
+        # Parse the JSON response
+        response_data = response.json()
+        print('Response:', response_data)
+        current_agent_info = response_data
+    else:
+        print('Failed to send POST request. Status code:', 
response.status_code)
+        print('Response:', response.text)
+
+def terminate_agent(access_token, gateway_id='testdrive'):
+
+    global current_agent_info
+
+    expId = current_agent_info['experimentId']
+    url = 'http://scigap02.sciencegateways.iu.edu:18880/api/v1/exp/terminate/' 
+ expId
+
+    decode = jwt.decode(access_token, options={"verify_signature": False})
+    user_id = decode['preferred_username']
+    claimsMap = {
+        "userName": user_id,
+        "gatewayID": gateway_id
+    }
+
+    # Headers
+    headers = {
+        'Content-Type': 'application/json',
+        'Authorization': 'Bearer ' + access_token,
+        'X-Claims': json.dumps(claimsMap)
+    }
+
+    # Send the POST request
+    response = requests.get(url, headers=headers)
+
+    if response.status_code == 200:
+        # Parse the JSON response
+        response_data = response.json()
+        print('Agent terminated:', response_data)
+        current_agent_info = None
+    else:
+        print('Failed to send termination request. Status code:', 
response.status_code)
+        print('Response:', response.text)
+
+
+@register_cell_magic
+def run_remote(line, cell):
+
+    global current_agent_info
+    if not current_agent_info:
+        print("No agent was scheduled yet. Please run %init_remote 
cluster=<cluster> cpu=<cpu> memory=<memory mb> queue=<queue> walltime=<walltime 
minutes>")
+
+    url = 
'http://scigap02.sciencegateways.iu.edu:18880/api/v1/agent/executejupyterrequest'
+
+    data = {
+        "sessionId": "session1",
+        "keepAlive": True,
+        "code": cell,
+        "agentId": current_agent_info["agentId"]
+    }
+
+    json_data = json.dumps(data)
+    response = requests.post(url, headers={'Content-Type': 
'application/json'}, data=json_data)
+    execution_resp = response.json()
+    execution_id = execution_resp["executionId"]
+    error = execution_resp["error"]
+    if error:
+        print("Cell execution failed. Error: " + error)
+    if execution_id:
+        while True:
+            url = 
"http://scigap02.sciencegateways.iu.edu:18880/api/v1/agent/executejupyterresponse/";
 + execution_id
+            response = requests.get(url, headers={'Accept': 
'application/json'})
+            json_response = response.json()
+            #print(json_response)
+            if json_response['available']:
+                result_str = json_response['responseString']
+                result = json.loads(result_str)
+                if 'result' in result:
+                    print(result['result'])
+                elif 'error' in result:
+                    print(result['error']['ename'])
+                    print(result['error']['evalue'])
+                    print(result['error']['traceback'])
+                elif 'display' in result:
+                    display_obj = result['display']
+                    if 'data' in display_obj:
+                        data_obj = display_obj['data']
+                        if 'image/png' in data_obj:
+                            image_data = data_obj['image/png']
+                            display(Image(data=base64.b64decode(image_data), 
format='png'))
+                break
+            time.sleep(1)
+
+@register_line_magic
+def init_remote(line):
+
+    if current_agent_info:
+        status = get_agent_status()
+        if status:
+            if status['agentUp']:
+                print("An agent is already running. Please terminate it first 
by running %terminate_remote")
+                return
+            else:
+                print("An agent was scheduled. Please terminate it first by 
running %terminate_remote")
+                return
+
+    access_token = get_access_token()
+    pairs = line.split()
+
+    # Initialize variable to store the cluster value
+    cluster_value = None
+    memory_value = None
+    cpu_value = None
+    queue_value = None
+    walltime_value = None
+
+    # Iterate through the pairs to find the cluster value
+    for pair in pairs:
+        if pair.startswith("cluster="):
+            cluster_value = pair.split("=")[1]
+        if pair.startswith("cpu="):
+            cpu_value = pair.split("=")[1]
+        if pair.startswith("memory="):
+            memory_value = pair.split("=")[1]
+        if pair.startswith("queue="):
+            queue_value = pair.split("=")[1]
+        if pair.startswith("walltime="):
+            walltime_value = pair.split("=")[1]
+
+    submit_agent_job('CS Agent', cluster_value, queue_value, cpu_value, 
memory_value, walltime_value, access_token)
+
+@register_line_magic
+def status_remote(line):
+    status = get_agent_status()
+    if status:
+        if status['agentUp']:
+            print("Agent", status['agentId'], 'is running')
+        else:
+            print("Agent", status['agentId'], 'is still prepairing. Please 
wait')
+
+@register_line_magic
+def terminate_remote(line):
+    global current_agent_info
+    access_token = get_access_token()
+    if current_agent_info:
+        terminate_agent(access_token)
+
+
+def load_ipython_extension(ipython):
+    ipython.register_magic_function(init_remote)
+    ipython.register_magic_function(status_remote)
+    ipython.register_magic_function(terminate_remote)
+    ipython.register_magic_function(run_remote)
diff --git 
a/modules/agent-framework/airavata-agent/jupyter/labconfig/bootstrap.sh 
b/modules/agent-framework/airavata-agent/jupyter/labconfig/bootstrap.sh
new file mode 100644
index 0000000000..754a6e8f52
--- /dev/null
+++ b/modules/agent-framework/airavata-agent/jupyter/labconfig/bootstrap.sh
@@ -0,0 +1,2 @@
+cd /home/jupyter-notebook-examples && git pull && cd -
+jupyter lab --config=/jupyter_lab_config.py --ip=0.0.0.0 --port=8888 
--no-browser --allow-root --NotebookApp.token=''
\ No newline at end of file
diff --git a/modules/agent-framework/airavata-agent/jupyter/magic.ipynb 
b/modules/agent-framework/airavata-agent/jupyter/magic.ipynb
index c667375f30..d03b63d029 100644
--- a/modules/agent-framework/airavata-agent/jupyter/magic.ipynb
+++ b/modules/agent-framework/airavata-agent/jupyter/magic.ipynb
@@ -18,23 +18,208 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 53,
+   "execution_count": 2,
+   "id": "9350833b-5c79-4b7e-9a27-db44db26e98f",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "current_agent_info = None"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 54,
+   "id": "eca0c9a6-4771-44b9-94c7-cf931bff4e83",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "{'agentId': 'agent_ba91240a-3e3d-4f15-8aac-207ba7f36b8b',\n",
+       " 'experimentId': 'CS_Agent_7c607c7f-c1af-485f-b883-3eff3f54e89e'}"
+      ]
+     },
+     "execution_count": 54,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "current_agent_info"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 115,
+   "id": "d3ef593b-7bdb-4228-9422-3f12cf4c14fd",
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Collecting pyjwt\n",
+      "  Obtaining dependency information for pyjwt from 
https://files.pythonhosted.org/packages/2b/4f/e04a8067c7c96c364cef7ef73906504e2f40d690811c021e1a1901473a19/PyJWT-2.8.0-py3-none-any.whl.metadata\n";,
+      "  Using cached PyJWT-2.8.0-py3-none-any.whl.metadata (4.2 kB)\n",
+      "Using cached PyJWT-2.8.0-py3-none-any.whl (22 kB)\n",
+      "Installing collected packages: pyjwt\n",
+      "Successfully installed pyjwt-2.8.0\n",
+      "\n",
+      
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m
 A new release of pip is available: 
\u001b[0m\u001b[31;49m23.2.1\u001b[0m\u001b[39;49m -> 
\u001b[0m\u001b[32;49m24.1.2\u001b[0m\n",
+      
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m
 To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
+     ]
+    }
+   ],
+   "source": [
+    "! pip install pyjwt"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 99,
    "id": "c5c591cb-7f0f-47ab-a9fa-4700161439c2",
    "metadata": {},
    "outputs": [],
    "source": [
+    "from IPython.core.magic import register_cell_magic\n",
+    "from IPython.core.magic import register_line_magic\n",
+    "\n",
     "from IPython.display import display, Image\n",
     "import base64\n",
+    "import requests\n",
+    "import json\n",
+    "import jwt\n",
+    "import time\n",
+    "from pathlib import Path\n",
+    "\n",
+    "current_agent_info = None\n",
+    "\n",
+    "EXPLICIT_TOKEN_FILE = (\n",
+    "    Path(os.path.expanduser(\"~\")) / \"csagent\" / \"token\" / 
\"keys.json\"\n",
+    ")\n",
+    "\n",
+    "def read_explicit_token_file():\n",
+    "    if not EXPLICIT_TOKEN_FILE.exists():\n",
+    "        return None\n",
+    "    else:\n",
+    "        with open(EXPLICIT_TOKEN_FILE, \"r\") as f:\n",
+    "            return json.load(f)\n",
+    "\n",
+    "def get_access_token():\n",
+    "    expl_token_data = read_explicit_token_file()\n",
+    "    if expl_token_data:\n",
+    "        return expl_token_data[\"access_token\"]\n",
+    "    \n",
+    "def get_agent_status():\n",
+    "    global current_agent_info\n",
+    "    \n",
+    "    if not current_agent_info:\n",
+    "        print(\"No agent was scheduled yet. Please run %init_remote 
cluster=<cluster> cpu=<cpu> memory=<memory mb> queue=<queue> walltime=<walltime 
minutes>\")\n",
+    "        return\n",
+    "        \n",
+    "    url = 'http://scigap02.sciencegateways.iu.edu:18880/api/v1/agent/' + 
current_agent_info['agentId']\n",
+    "    response = requests.get(url)\n",
+    "    if response.status_code == 202:\n",
+    "        return response.json()\n",
+    "    else:\n",
+    "        print('Invalid response reveived. Status code:', 
response.status_code)\n",
+    "        print('Response:', response.text)\n",
+    "    \n",
+    "def submit_agent_job(experiment_name, cluster, queue, cpus, memory, 
wallTime, access_token, gateway_id='testdrive'):\n",
+    "\n",
+    "    global current_agent_info\n",
+    "    # URL to which the POST request will be sent\n",
+    "    url = 
'http://scigap02.sciencegateways.iu.edu:18880/api/v1/exp/launch'\n",
+    "\n",
+    "    # Data to be sent in the POST request\n",
+    "    data = {\n",
+    "        'experimentName': experiment_name,\n",
+    "        'remoteCluster': cluster,\n",
+    "        'cpuCount': cpus,\n",
+    "        'nodeCount': 1,\n",
+    "        'memory': memory,\n",
+    "        'wallTime': wallTime,\n",
+    "        'queue': queue\n",
+    "    }\n",
+    "    \n",
+    "    # Convert the data to JSON format\n",
+    "    json_data = json.dumps(data)\n",
+    "\n",
+    "    decode = jwt.decode(access_token, options={\"verify_signature\": 
False})\n",
+    "    user_id = decode['preferred_username']\n",
+    "    claimsMap = {\n",
+    "        \"userName\": user_id,\n",
+    "        \"gatewayID\": gateway_id\n",
+    "    }\n",
+    "    \n",
+    "    # Headers\n",
+    "    headers = {\n",
+    "        'Content-Type': 'application/json',\n",
+    "        'Authorization': 'Bearer ' + access_token,\n",
+    "        'X-Claims': json.dumps(claimsMap)\n",
+    "    }\n",
+    "    \n",
+    "    # Send the POST request\n",
+    "    response = requests.post(url, headers=headers, data=json_data)\n",
+    "    \n",
+    "    # Check if the request was successful\n",
+    "    if response.status_code == 200:\n",
+    "        # Parse the JSON response\n",
+    "        response_data = response.json()\n",
+    "        print('Response:', response_data)\n",
+    "        current_agent_info = response_data\n",
+    "    else:\n",
+    "        print('Failed to send POST request. Status code:', 
response.status_code)\n",
+    "        print('Response:', response.text)\n",
+    "\n",
+    "def terminate_agent(access_token, gateway_id='testdrive'):\n",
+    "\n",
+    "    global current_agent_info\n",
+    "    \n",
+    "    expId = current_agent_info['experimentId']\n",
+    "    url = 
'http://scigap02.sciencegateways.iu.edu:18880/api/v1/exp/terminate/' + expId\n",
+    "\n",
+    "    decode = jwt.decode(access_token, options={\"verify_signature\": 
False})\n",
+    "    user_id = decode['preferred_username']\n",
+    "    claimsMap = {\n",
+    "        \"userName\": user_id,\n",
+    "        \"gatewayID\": gateway_id\n",
+    "    }\n",
+    "    \n",
+    "    # Headers\n",
+    "    headers = {\n",
+    "        'Content-Type': 'application/json',\n",
+    "        'Authorization': 'Bearer ' + access_token,\n",
+    "        'X-Claims': json.dumps(claimsMap)\n",
+    "    }\n",
+    "    \n",
+    "    # Send the POST request\n",
+    "    response = requests.get(url, headers=headers)\n",
+    "\n",
+    "    if response.status_code == 200:\n",
+    "        # Parse the JSON response\n",
+    "        response_data = response.json()\n",
+    "        print('Agent terminated:', response_data)\n",
+    "        current_agent_info = None\n",
+    "    else:\n",
+    "        print('Failed to send termination request. Status code:', 
response.status_code)\n",
+    "        print('Response:', response.text)\n",
+    "\n",
     "\n",
     "@register_cell_magic\n",
     "def run_remote(line, cell):\n",
-    "    url = 
'http://scigap02.sciencegateways.iu.edu:18880/api/v1/agent/executejupyterrequest'\n",
     "\n",
+    "    global current_agent_info\n",
+    "    if not current_agent_info:\n",
+    "        print(\"No agent was scheduled yet. Please run %init_remote 
cluster=<cluster> cpu=<cpu> memory=<memory mb> queue=<queue> walltime=<walltime 
minutes>\")\n",
+    "\n",
+    "    url = 
'http://scigap02.sciencegateways.iu.edu:18880/api/v1/agent/executejupyterrequest'\n",
+    "    \n",
     "    data = {\n",
     "        \"sessionId\": \"session1\",\n",
     "        \"keepAlive\": True,\n",
     "        \"code\": cell,\n",
-    "        \"agentId\": \"agent1991\"\n",
+    "        \"agentId\": current_agent_info[\"agentId\"]\n",
     "    }\n",
     "\n",
     "    json_data = json.dumps(data)    \n",
@@ -71,32 +256,62 @@
     "\n",
     "@register_line_magic\n",
     "def init_remote(line):\n",
-    "    print(f\"Your input: {line}\")\n",
+    "\n",
+    "    if current_agent_info:\n",
+    "        status = get_agent_status()\n",
+    "        if status:\n",
+    "            if status['agentUp']:\n",
+    "                print(\"An agent is already running. Please terminate it 
first by running %terminate_remote\")\n",
+    "                return\n",
+    "            else:\n",
+    "                print(\"An agent was scheduled. Please terminate it first 
by running %terminate_remote\")\n",
+    "                return\n",
+    "                \n",
+    "    access_token = get_access_token()\n",
     "    pairs = line.split()\n",
     "\n",
     "    # Initialize variable to store the cluster value\n",
     "    cluster_value = None\n",
+    "    memory_value = None\n",
+    "    cpu_value = None\n",
+    "    queue_value = None\n",
+    "    walltime_value = None\n",
     "    \n",
     "    # Iterate through the pairs to find the cluster value\n",
     "    for pair in pairs:\n",
     "        if pair.startswith(\"cluster=\"):\n",
     "            cluster_value = pair.split(\"=\")[1]\n",
-    "            break\n",
+    "        if pair.startswith(\"cpu=\"):\n",
+    "            cpu_value = pair.split(\"=\")[1]\n",
+    "        if pair.startswith(\"memory=\"):\n",
+    "            memory_value = pair.split(\"=\")[1]\n",
+    "        if pair.startswith(\"queue=\"):\n",
+    "            queue_value = pair.split(\"=\")[1]\n",
+    "        if pair.startswith(\"walltime=\"):\n",
+    "            walltime_value = pair.split(\"=\")[1]\n",
     "    \n",
-    "    # Print the cluster value\n",
-    "    if cluster_value:\n",
-    "        print(f\"Cluster value: {cluster_value}\")\n",
+    "    submit_agent_job('CS Agent', cluster_value, queue_value, cpu_value, 
memory_value, walltime_value, access_token)\n",
     "\n",
-    "    \n",
+    "@register_line_magic\n",
+    "def status_remote(line):\n",
+    "    status = get_agent_status()\n",
+    "    if status:\n",
+    "        if status['agentUp']:\n",
+    "            print(\"Agent\", status['agentId'], 'is running')\n",
+    "        else:\n",
+    "            print(\"Agent\", status['agentId'], 'is still prepairing. 
Please wait')\n",
     "\n",
     "@register_line_magic\n",
     "def terminate_remote(line):\n",
-    "    print(f\"Your input: {line}\")"
+    "    global current_agent_info\n",
+    "    access_token = get_access_token()\n",
+    "    if current_agent_info:\n",
+    "        terminate_agent(access_token)"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 51,
+   "execution_count": 117,
    "id": "9e969c05-fbf9-4eca-9b83-d1c62429a13b",
    "metadata": {},
    "outputs": [
@@ -104,18 +319,36 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "Your input: cluster=jetstream cpu=2 memory=2GB\n",
-      "Cluster value: jetstream\n"
+      "Your input: cluster=expanse cpu=2 memory=2024 queue=shared 
walltime=60\n",
+      "Response: {'agentId': 'agent_e26bfeb7-f76a-4166-9a21-af76d0a713d4', 
'experimentId': 'CS_Agent_dcdd52d1-b5c9-4318-b08f-450fa625e671'}\n"
+     ]
+    }
+   ],
+   "source": [
+    "%init_remote cluster=expanse cpu=2 memory=2024 queue=shared walltime=60"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 118,
+   "id": "fee186a2-a196-4092-ad43-1e3d8b035ac7",
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Agent agent_e26bfeb7-f76a-4166-9a21-af76d0a713d4 is running\n"
      ]
     }
    ],
    "source": [
-    "%init_remote cluster=jetstream cpu=2 memory=2GB queue=shared walltime=60"
+    "%status_remote"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 59,
+   "execution_count": 119,
    "id": "4e60d84a-2a81-4b04-9dcb-dea48c4228b8",
    "metadata": {},
    "outputs": [
@@ -137,7 +370,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 60,
+   "execution_count": 120,
    "id": "ebd549f1-3a5d-47e3-876d-beb91d971ac2",
    "metadata": {},
    "outputs": [
@@ -174,7 +407,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 57,
+   "execution_count": 121,
    "id": "a946bee5-384b-4883-9753-e5d2bf162d39",
    "metadata": {},
    "outputs": [
@@ -182,33 +415,61 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "Requirement already satisfied: matplotlib in 
/usr/local/lib/python3.12/site-packages (3.9.1)\n",
-      "Requirement already satisfied: contourpy>=1.0.1 in 
/usr/local/lib/python3.12/site-packages (from matplotlib) (1.2.1)\n",
-      "Requirement already satisfied: cycler>=0.10 in 
/usr/local/lib/python3.12/site-packages (from matplotlib) (0.12.1)\n",
-      "Requirement already satisfied: fonttools>=4.22.0 in 
/usr/local/lib/python3.12/site-packages (from matplotlib) (4.53.1)\n",
-      "Requirement already satisfied: kiwisolver>=1.3.1 in 
/usr/local/lib/python3.12/site-packages (from matplotlib) (1.4.5)\n",
-      "Requirement already satisfied: numpy>=1.23 in 
/usr/local/lib/python3.12/site-packages (from matplotlib) (2.0.0)\n",
-      "Requirement already satisfied: packaging>=20.0 in 
/usr/local/lib/python3.12/site-packages (from matplotlib) (24.1)\n",
-      "Requirement already satisfied: pillow>=8 in 
/usr/local/lib/python3.12/site-packages (from matplotlib) (10.4.0)\n",
-      "Requirement already satisfied: pyparsing>=2.3.1 in 
/usr/local/lib/python3.12/site-packages (from matplotlib) (3.1.2)\n",
-      "Requirement already satisfied: python-dateutil>=2.7 in 
/usr/local/lib/python3.12/site-packages (from matplotlib) (2.9.0.post0)\n",
-      "Requirement already satisfied: six>=1.5 in 
/usr/local/lib/python3.12/site-packages (from python-dateutil>=2.7->matplotlib) 
(1.16.0)\n",
-      "\u001b[33mWARNING: Running pip as the 'root' user can result in broken 
permissions and conflicting behaviour with the system package manager. It is 
recommended to use a virtual environment instead: 
https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n";,
-      "\u001b[0m\n",
-      
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m
 A new release of pip is available: 
\u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> 
\u001b[0m\u001b[32;49m24.1.2\u001b[0m\n",
-      
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m
 To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
+      "total 412\n",
+      "drwxr-x--- 22 scigap uot111     42 Jul 20 23:52 .\n",
+      "drwxr-xr-x  1 scigap uot111     60 Jul 21 15:38 ..\n",
+      "-rw-------  1 scigap uot111   1908 Jul 19 11:48 .Xauthority\n",
+      "-rw-------  1 scigap uot111  20517 Jul 20 23:52 .bash_history\n",
+      "-rw-r--r--  1 scigap uot111     18 Nov  8  2019 .bash_logout\n",
+      "-rw-r--r--  1 scigap uot111    141 Nov  8  2019 .bash_profile\n",
+      "-rw-r--r--  1 scigap uot111   1227 Sep 20  2023 .bashrc\n",
+      "drwx------  7 scigap uot111      7 Jun  6 14:05 .cache\n",
+      "drwxrwsr-x  4 scigap uot111      5 Jun  9  2023 .conda\n",
+      "drwxr-xr-x  3 scigap uot111      3 Sep  7  2022 .config\n",
+      "drwx------  3 scigap uot111      3 Jun  6 12:17 .dbus\n",
+      "-rw-r--r--  1 scigap uot111    334 May 11  2019 .emacs\n",
+      "-rw-r--r--  1 scigap uot111     18 Sep 20  2023 .gitconfig\n",
+      "drwxr-xr-x  3 scigap uot111      3 Jul 19 15:53 .ipython\n",
+      "-rw-r--r--  1 scigap uot111    172 Apr 23  2020 .kshrc\n",
+      "-rw-------  1 scigap uot111     38 Jun 23 12:39 .lesshst\n",
+      "drwxr-xr-x  3 scigap uot111      3 May 15  2023 .lmod.d\n",
+      "drwx------  5 scigap uot111      5 Jun  6 12:56 .local\n",
+      "-rw-------  1 scigap uot111     21 Jul 19 12:33 .python_history\n",
+      "drwx------  2 scigap uot111      2 Jun 10 16:53 .screen\n",
+      "drwx------  4 scigap uot111      5 Jun 13 18:06 .singularity\n",
+      "drwx------  2 scigap uot111     11 Jul 19 11:56 .ssh\n",
+      "drwxr-xr-x  2 scigap uot111      3 Mar 31  2023 .vim\n",
+      "-rw-------  1 scigap uot111  39749 Jul 20 16:03 .viminfo\n",
+      "drwxr-xr-x  2 scigap uot111      3 Jun 17 17:32 .vnc\n",
+      "-rw-r--r--  1 scigap uot111    658 Mar 20  2020 .zshrc\n",
+      "drwxr-xr-x  6 scigap uot111      7 Jun  9  2023 AllenTest\n",
+      "drwxr-xr-x  3 scigap uot111      6 Oct 24  2022 NAMD_Test\n",
+      "drwxr-xr-x  9 scigap uot111     22 Jul 20 15:10 NeuroTest\n",
+      "drwxr-xr-x  3 scigap uot111      6 Jul  1 12:34 Neuron\n",
+      "lrwxrwxrwx  1 scigap uic151     55 Jun  6 12:54 containers -> 
/expanse/lustre/scratch/scigap/temp_project/containers/\n",
+      "lrwxrwxrwx  1 scigap uic151     52 Jun 11 08:01 dcdfiles -> 
/expanse/lustre/scratch/scigap/temp_project/dcdfiles\n",
+      "drwxr-xr-x  2 scigap uot111      2 Oct 21  2022 devseagrid-workdirs\n",
+      "drwxr-xr-x  5 scigap uot111      5 Sep  7  2022 eht-codes\n",
+      "lrwxrwxrwx  1 scigap uot111     52 Sep  7  2022 eht-workdirs -> 
/expanse/lustre/projects/ind123/scigap/eht-workdirs/\n",
+      "lrwxrwxrwx  1 scigap uot111     55 Nov  8  2023 md-workdirs -> 
/expanse/lustre/scratch/scigap/temp_project/md-workdirs\n",
+      "drwxr-xr-x  2 scigap uot111      4 Mar 25 04:26 mpi-class-tests\n",
+      "lrwxrwxrwx  1 scigap uot111     58 Nov  8  2023 neuro-workdirs -> 
/expanse/lustre/scratch/scigap/temp_project/neuro-workdirs\n",
+      "-rw-------  1 scigap uot111    808 Jun 13 14:35 nohup.out\n",
+      "lrwxrwxrwx  1 scigap uot111     38 Jun 17 12:06 projects -> 
/expanse/lustre/projects/ind123/scigap\n",
+      "drwxr-xr-x  3 scigap uot111      3 Oct 24  2022 scratch\n",
+      "-rw-r--r--  1 scigap uot111 349923 Jun 17 16:20 vnchelp\n",
       "\n"
      ]
     }
    ],
    "source": [
     "%%run_remote\n",
-    "!pip3 install matplotlib\n"
+    "!ls -al "
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 38,
+   "execution_count": 97,
    "id": "01b350f1-dc56-4434-86c1-0ff024cc589d",
    "metadata": {},
    "outputs": [
@@ -216,22 +477,23 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "Requirement already satisfied: numpy in 
./jupyter/venv/lib/python3.11/site-packages (2.0.0)\n",
+      "Defaulting to user installation because normal site-packages is not 
writeable\n",
+      "Requirement already satisfied: numpy in 
./.local/lib/python3.12/site-packages (2.0.0)\n",
       "\n",
-      
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m
 A new release of pip is available: 
\u001b[0m\u001b[31;49m23.2.1\u001b[0m\u001b[39;49m -> 
\u001b[0m\u001b[32;49m24.1.2\u001b[0m\n",
+      
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m
 A new release of pip is available: 
\u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> 
\u001b[0m\u001b[32;49m24.1.2\u001b[0m\n",
       
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m
 To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
       "\n"
      ]
     }
    ],
    "source": [
-    "%%run_remote cluster=jetstream cpu=2 memory=2GB\n",
+    "%%run_remote\n",
     "!pip install numpy"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 43,
+   "execution_count": 122,
    "id": "4acff051-2148-45d6-bb4e-c3cabb1a162c",
    "metadata": {},
    "outputs": [
@@ -239,7 +501,7 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "Your input: \n"
+      "Agent terminated: {'experimentId': 
'CS_Agent_dcdd52d1-b5c9-4318-b08f-450fa625e671', 'terminated': True}\n"
      ]
     }
    ],

Reply via email to