From beeaa9335cc16a97c893667570a74c3d3fba1f9b Mon Sep 17 00:00:00 2001 From: amit-62 Date: Fri, 5 Aug 2022 00:26:37 +0530 Subject: [PATCH 1/3] added method to open Jupyter --- fri/server/main.py | 15 ++++++++++----- fri/test.py | 9 +++++++-- mkconcore.py | 5 +++++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/fri/server/main.py b/fri/server/main.py index fa09a18..c71a964 100644 --- a/fri/server/main.py +++ b/fri/server/main.py @@ -166,14 +166,19 @@ def getFilesList(dir): concore_path = os.path.abspath(os.path.join(cur_path, '../../')) dir_path = os.path.abspath(os.path.join(concore_path, dir)) res = [] - - if(dir=='concore'): - res = os.listdir(concore_path) - else: - res = os.listdir(dir_path) + res = os.listdir(dir_path) res2 = json.dumps(res) return res2 +@app.route('/openJupyterLab/', methods=['POST']) +def openJupyterLab(): + cur_path = os.getcwd() + concore_path = os.path.abspath(os.path.join(cur_path, '../../')) + p = call(["jupyter", "lab"], cwd=concore_path) + return p + + + if __name__ == "__main__": app.run(host="0.0.0.0") diff --git a/fri/test.py b/fri/test.py index 8384597..286a792 100644 --- a/fri/test.py +++ b/fri/test.py @@ -64,10 +64,14 @@ def destroy(): print(response.text) def getFilesList(): - import requests url = "http://127.0.0.1:5000/getFilesList/test" response = requests.request("POST", url) - print(response.text) + print(response.text) + +def openJupyterLa(): + url = "http://127.0.0.1:5000/openJupyterLab" + response = requests.request("POST", url) + print(response.text) # upload() @@ -77,4 +81,5 @@ def getFilesList(): # debug() # destroy() getFilesList() +# openJupyterLa() diff --git a/mkconcore.py b/mkconcore.py index 4332f23..8937b3c 100644 --- a/mkconcore.py +++ b/mkconcore.py @@ -683,6 +683,8 @@ #start running source in associated dirs (run and debug scripts) if concoretype=="posix": fdebug.write('#!/bin/bash' + "\n") + frun.write('#!/bin/bash' + "\n") + i=0 for node in nodes_dict: @@ -826,6 +828,9 @@ i=i+1 fmaxtime.close() +if concoretype=="posix": + funlock.write('#!/bin/bash' + "\n") + i=0 # 9/12/21 for node in nodes_dict: containername,sourcecode = nodes_dict[node].split(':') From 733963511f283991f616ed9374755e73739c83a7 Mon Sep 17 00:00:00 2001 From: amit-62 Date: Fri, 5 Aug 2022 00:40:31 +0530 Subject: [PATCH 2/3] fixed typos --- fri/test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fri/test.py b/fri/test.py index 286a792..fab03e7 100644 --- a/fri/test.py +++ b/fri/test.py @@ -68,8 +68,8 @@ def getFilesList(): response = requests.request("POST", url) print(response.text) -def openJupyterLa(): - url = "http://127.0.0.1:5000/openJupyterLab" +def openJupyter(): + url = "http://127.0.0.1:5000/openJupyter" response = requests.request("POST", url) print(response.text) @@ -81,5 +81,5 @@ def openJupyterLa(): # debug() # destroy() getFilesList() -# openJupyterLa() +# openJupyter() From e837f8e55f9ab14dea5427c447211baf1b9cf19c Mon Sep 17 00:00:00 2001 From: amit-62 Date: Fri, 5 Aug 2022 00:44:35 +0530 Subject: [PATCH 3/3] fixed typos --- fri/server/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fri/server/main.py b/fri/server/main.py index c71a964..5939f5a 100644 --- a/fri/server/main.py +++ b/fri/server/main.py @@ -171,8 +171,8 @@ def getFilesList(dir): return res2 -@app.route('/openJupyterLab/', methods=['POST']) -def openJupyterLab(): +@app.route('/openJupyter/', methods=['POST']) +def openJupyter(): cur_path = os.getcwd() concore_path = os.path.abspath(os.path.join(cur_path, '../../')) p = call(["jupyter", "lab"], cwd=concore_path)