Skip to content

Commit

Permalink
Merge pull request #3 from ZihengSun/main
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
ZihengSun authored Apr 18, 2023
2 parents df5aa8c + 894d9f2 commit ee241f8
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ dist/*
*/*.pyc
.idea/
*/__pycache__/*
*.pyc
*.pyc
*.ipynb
6 changes: 4 additions & 2 deletions pygeoweaver/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -37,6 +37,8 @@ def main():

# reset localhost password for Geoweaver
# reset_password()
ui()
helpwith()


if __name__ == "__main__":
Expand Down
16 changes: 16 additions & 0 deletions pygeoweaver/sc_help.py
Original file line number Diff line number Diff line change
@@ -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()}/")
2 changes: 2 additions & 0 deletions pygeoweaver/sc_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +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
16 changes: 15 additions & 1 deletion pygeoweaver/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
import requests
import platform

from IPython import get_ipython
from IPython.display import IFrame


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":
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('~')

Expand All @@ -28,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)

Expand All @@ -47,4 +61,4 @@ def checkOS():
elif platform.system() == "Darwin":
return 2
elif platform == "Windows":
return 3
return 3
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]" },
]
Expand Down

0 comments on commit ee241f8

Please sign in to comment.