Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync #1

Merged
merged 32 commits into from
Apr 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fdade0d
Merge pull request #3 from ESIPFed/main
ZihengSun Apr 3, 2023
6be3ecb
fix server
ZihengSun Apr 3, 2023
59e91aa
Update run_workflow.py
ZihengSun Apr 3, 2023
e4845ab
working
ZihengSun Apr 11, 2023
5e242d5
ignore pyc
ZihengSun Apr 11, 2023
9a5b53c
do not expose utils.py directly to import
gokulprathin8 Apr 15, 2023
339db33
do not expose utils.py directly to import
gokulprathin8 Apr 15, 2023
b5eaa71
remove .idea files
gokulprathin8 Apr 15, 2023
0bfe09c
fix import structure
gokulprathin8 Apr 15, 2023
3593325
fix typo
gokulprathin8 Apr 15, 2023
f6c79e3
updated example.ipynb
gokulprathin8 Apr 15, 2023
c20e1df
refactor
gokulprathin8 Apr 15, 2023
5046fe3
fix run process
gokulprathin8 Apr 15, 2023
62b411f
fix run workflow
gokulprathin8 Apr 15, 2023
ee087ee
history doesn't need three
ZihengSun Apr 16, 2023
8090aa0
Merge branch 'main' into feat/poetry
ZihengSun Apr 16, 2023
289208d
clean up __init__
ZihengSun Apr 16, 2023
f60de55
Merge branch 'feat/poetry' of https://github.com/gokulprathin8/pygeow…
ZihengSun Apr 16, 2023
eebff7a
update ignore
ZihengSun Apr 16, 2023
41e54da
Merge pull request #4 from gokulprathin8/feat/poetry
ZihengSun Apr 16, 2023
dda9df1
refactor and remove duplication
ZihengSun Apr 16, 2023
3619434
test if publish workflow works
ZihengSun Apr 16, 2023
6bca5ce
no test pypi
ZihengSun Apr 16, 2023
71ee639
trusted publish
ZihengSun Apr 16, 2023
a0ca64d
resolve requests dependency
gokulprathin8 Apr 16, 2023
29744d7
Merge pull request #5 from gokulprathin8/deps/requests
ZihengSun Apr 16, 2023
e33dba5
move to test
ZihengSun Apr 16, 2023
44fb7d7
bump version
ZihengSun Apr 16, 2023
826357e
trust publish
ZihengSun Apr 16, 2023
4169903
test tags
ZihengSun Apr 16, 2023
05248dd
Update pyproject.toml
ZihengSun Apr 16, 2023
2566850
Update pyproject.toml
ZihengSun Apr 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
do not expose utils.py directly to import
  • Loading branch information
gokulprathin8 committed Apr 15, 2023
commit 9a5b53ca3af4654cbf046e44da844509b2a3398e
36 changes: 36 additions & 0 deletions example.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from pygeoweaver import utils"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
23 changes: 23 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions pygeoweaver/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# export only the specified functions

__all__ = [
'detail_host',
'detail_process',
'detail_workflow',
'export_workflow',
'history_process',
'history_workflow',
'import_workflow',
'list_hosts',
'list_workflows',
'list_processes',
'server'
]
9 changes: 5 additions & 4 deletions pygeoweaver/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
from pygeoweaver.list_workflows import list_workflows
from pygeoweaver.server import start, stop


def main():
# start geoweaver
#start()
# start()
# stop geoweaver
# stop()
# list resources
#list_hosts()
#list_processes()
#list_workflows()
# list_hosts()
# list_processes()
# list_workflows()
# show history
show_process_history("gfvnp8a7rgh")

Expand Down
3 changes: 2 additions & 1 deletion pygeoweaver/list_workflows.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import subprocess
from pygeoweaver.utils import download_geoweaver_jar, get_geoweaver_jar_path, get_root_dir


def list_workflows():
download_geoweaver_jar()
subprocess.run(["java", "-jar", get_geoweaver_jar_path(), "list", "--workflow"], cwd=f"{get_root_dir()}/")
subprocess.run(["java", "-jar", get_geoweaver_jar_path(), "list", "--workflow"], cwd=f"{get_root_dir()}/")
15 changes: 10 additions & 5 deletions pygeoweaver/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,40 @@
import subprocess
import requests


def get_home_dir():
return os.path.expanduser('~')


def get_root_dir():
head, tail = os.path.split(__file__)
return head


def get_geoweaver_jar_path():
return f"{get_home_dir()}/geoweaver.jar"


def check_geoweaver_jar():
return os.path.isfile(get_geoweaver_jar_path())


def download_geoweaver_jar(overwrite=False):
if check_geoweaver_jar():
if overwrite:
os.remove(get_geoweaver_jar_path())
else:
subprocess.run(["chmod", "+x", get_geoweaver_jar_path()], cwd=f"{get_root_dir()}/")
return

geoweaver_url = "https://github.com/ESIPFed/Geoweaver/releases/download/latest/geoweaver.jar"
r = requests.get(geoweaver_url)
with open(get_geoweaver_jar_path(),'wb') as f:

with open(get_geoweaver_jar_path(), 'wb') as f:
f.write(r.content)

if check_geoweaver_jar():
print("Geoweaver.jar is downloaded")

else:
raise RuntimeError("Fail to download geoweaver.jar")
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,16 @@ classifiers = [
[project.urls]
"Homepage" = "https://github.com/ESIPFed/pygeoweaver"

[tool.poetry]
name = "pygeoweaver"
version = "0.6.0"
description = "This is a wrapper package of the Geoweaver app."
authors = ["Geoweaver team <[email protected]>"]
readme = "README.md"
homepage = "https://github.com/ESIPFed/pygeoweaver"

[tool.poetry.dependencies]
python = ">=3.7"
setuptools = ">=61.0"

[tool.poetry.scripts]