From 0c942b91fae8217b934adfeaca2ca96aa551d671 Mon Sep 17 00:00:00 2001 From: Gokul Prathin Date: Tue, 18 Apr 2023 16:17:10 -0400 Subject: [PATCH 1/6] feat/webui --- pygeoweaver/sc_interface.py | 1 + pygeoweaver/utils.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pygeoweaver/sc_interface.py b/pygeoweaver/sc_interface.py index b9032c5..2986eb8 100644 --- a/pygeoweaver/sc_interface.py +++ b/pygeoweaver/sc_interface.py @@ -10,3 +10,4 @@ from pygeoweaver.sc_run import * from pygeoweaver.server import * from pygeoweaver.sc_resetpassword import * +from pygeoweaver.utils import show_web_ui diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index 1a0d323..6adcd72 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -3,6 +3,19 @@ import requests import platform +from IPython import get_ipython +from IPython.display import IFrame + + +def show_web_ui(): + shell_type = str(get_ipython().__class__.__module__) + print(shell_type) + if shell_type == "google.colab._shell" or shell_type == "ipykernel.zmqshell": + return IFrame(src="http://localhost:8070/Geoweaver/", width='100%', height='500px') + else: + print('Web UI for python bindings can be only used for Colab / Jupyter / Interactive Python shell') + + def get_home_dir(): return os.path.expanduser('~') @@ -47,4 +60,4 @@ def checkOS(): elif platform.system() == "Darwin": return 2 elif platform == "Windows": - return 3 \ No newline at end of file + return 3 From 26ed3c56568af105abd9454cf3a6280e1158e48a Mon Sep 17 00:00:00 2001 From: Gokul Prathin Date: Tue, 18 Apr 2023 16:18:49 -0400 Subject: [PATCH 2/6] check if geoweaver is initialized --- pygeoweaver/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index 6adcd72..e3f0816 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -8,6 +8,7 @@ def show_web_ui(): + download_geoweaver_jar() # check if geoweaver is initialized shell_type = str(get_ipython().__class__.__module__) print(shell_type) if shell_type == "google.colab._shell" or shell_type == "ipykernel.zmqshell": From c86ee1658bd91bc941a97a42b7d604ea7bc5fe5b Mon Sep 17 00:00:00 2001 From: Gokul Prathin Date: Tue, 18 Apr 2023 16:19:23 -0400 Subject: [PATCH 3/6] cleanup --- pygeoweaver/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index e3f0816..ffe6161 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -10,7 +10,6 @@ def show_web_ui(): download_geoweaver_jar() # check if geoweaver is initialized shell_type = str(get_ipython().__class__.__module__) - print(shell_type) if shell_type == "google.colab._shell" or shell_type == "ipykernel.zmqshell": return IFrame(src="http://localhost:8070/Geoweaver/", width='100%', height='500px') else: From 93e80d96975ba0dc4b60f30ec237878f895b9759 Mon Sep 17 00:00:00 2001 From: Ziheng Sun Date: Tue, 18 Apr 2023 18:59:21 -0400 Subject: [PATCH 4/6] just ui --- pygeoweaver/sc_interface.py | 2 +- pygeoweaver/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pygeoweaver/sc_interface.py b/pygeoweaver/sc_interface.py index 2986eb8..b3617f5 100644 --- a/pygeoweaver/sc_interface.py +++ b/pygeoweaver/sc_interface.py @@ -10,4 +10,4 @@ from pygeoweaver.sc_run import * from pygeoweaver.server import * from pygeoweaver.sc_resetpassword import * -from pygeoweaver.utils import show_web_ui +from pygeoweaver.utils import ui diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index ffe6161..2c25f2f 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -7,7 +7,7 @@ from IPython.display import IFrame -def show_web_ui(): +def ui(): download_geoweaver_jar() # check if geoweaver is initialized shell_type = str(get_ipython().__class__.__module__) if shell_type == "google.colab._shell" or shell_type == "ipykernel.zmqshell": From adf5d5b68f03f0b2df38656a3dc29b7f3af588e1 Mon Sep 17 00:00:00 2001 From: Ziheng Sun Date: Tue, 18 Apr 2023 19:01:39 -0400 Subject: [PATCH 5/6] Update .gitignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 14edd43..742065a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,3 @@ dist/* */*.pyc .idea/ */__pycache__/* -*.pyc -*.pyc From 894d9f2ce61b87c300d2f91d9f586b74ecf68b60 Mon Sep 17 00:00:00 2001 From: Ziheng Sun Date: Tue, 18 Apr 2023 19:56:20 -0400 Subject: [PATCH 6/6] add help and ui --- .gitignore | 1 + pygeoweaver/__main__.py | 6 ++++-- pygeoweaver/sc_help.py | 16 ++++++++++++++++ pygeoweaver/sc_interface.py | 1 + pygeoweaver/utils.py | 1 + pyproject.toml | 2 +- 6 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 pygeoweaver/sc_help.py diff --git a/.gitignore b/.gitignore index 742065a..528b7b9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ dist/* */*.pyc .idea/ */__pycache__/* +*.ipynb diff --git a/pygeoweaver/__main__.py b/pygeoweaver/__main__.py index f9dc7db..3cab4d5 100644 --- a/pygeoweaver/__main__.py +++ b/pygeoweaver/__main__.py @@ -4,11 +4,11 @@ """ from pygeoweaver import detail_host, detail_process, detail_workflow, export_workflow, \ show_history, import_workflow, list_hosts, list_processes, list_workflows, \ - start, stop, reset_password, run_process, run_worklfow + start, stop, reset_password, run_process, run_worklfow, helpwith, ui def main(): # start geoweaver - start() + # start() # stop geoweaver # stop() # list resources @@ -37,6 +37,8 @@ def main(): # reset localhost password for Geoweaver # reset_password() + ui() + helpwith() if __name__ == "__main__": diff --git a/pygeoweaver/sc_help.py b/pygeoweaver/sc_help.py new file mode 100644 index 0000000..7ad58d0 --- /dev/null +++ b/pygeoweaver/sc_help.py @@ -0,0 +1,16 @@ + + +import subprocess +from pygeoweaver.utils import get_geoweaver_jar_path, get_root_dir + + +def helpwith(command_list: list=[], ): + target_cmd_args = ["java", "-jar", get_geoweaver_jar_path()] + if len(command_list) > 0: + for i in range(len(command_list)-1): + target_cmd_args.append(command_list[i]) + target_cmd_args.append("help") + target_cmd_args.append(command_list[-1]) + else: + target_cmd_args.append("help") + subprocess.run(target_cmd_args, cwd=f"{get_root_dir()}/") \ No newline at end of file diff --git a/pygeoweaver/sc_interface.py b/pygeoweaver/sc_interface.py index b3617f5..0c3758a 100644 --- a/pygeoweaver/sc_interface.py +++ b/pygeoweaver/sc_interface.py @@ -10,4 +10,5 @@ from pygeoweaver.sc_run import * from pygeoweaver.server import * from pygeoweaver.sc_resetpassword import * +from pygeoweaver.sc_help import * from pygeoweaver.utils import ui diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index 2c25f2f..a8f4877 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -41,6 +41,7 @@ def download_geoweaver_jar(overwrite=False): subprocess.run(["chmod", "+x", get_geoweaver_jar_path()], cwd=f"{get_root_dir()}/") return + print("Downloading latest version of Geoweaver...") geoweaver_url = "https://github.com/ESIPFed/Geoweaver/releases/download/latest/geoweaver.jar" r = requests.get(geoweaver_url) diff --git a/pyproject.toml b/pyproject.toml index 81ebbed..36d2aeb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pygeoweaver" -version = "0.6.4" +version = "0.6.5" authors = [ { name="Geoweaver team", email="geoweaver.app@gmail.com" }, ]