Skip to content

Commit

Permalink
bump 0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ZihengSun committed Jun 21, 2023
1 parent 34af240 commit af5fab4
Show file tree
Hide file tree
Showing 9 changed files with 248 additions and 35 deletions.
227 changes: 220 additions & 7 deletions poetry.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pygeoweaver/sc_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pandas as pd
from pydantic import BaseModel

from . import constants
from pygeoweaver.constants import *
from pygeoweaver.utils import (
download_geoweaver_jar,
get_geoweaver_jar_path,
Expand Down Expand Up @@ -63,9 +63,9 @@ def create_process(lang, description, name, code, owner="111111", confidential=F
)
data_json = process.json()
r = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/add/process",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/add/process",
data=data_json,
headers=constants.COMMON_API_HEADER,
headers=COMMON_API_HEADER,
)
if check_ipython() and r.ok:
df = pd.DataFrame(json.loads(data_json).items(), columns=["Key", "Value"])
Expand Down Expand Up @@ -133,9 +133,9 @@ def create_workflow(
)
data_json = workflow.json()
r = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/add/workflow",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/add/workflow",
data=data_json,
headers=constants.COMMON_API_HEADER,
headers=COMMON_API_HEADER,
)
if check_ipython():
return pd.DataFrame(json.loads(data_json).items(), columns=["Key", "Value"])
Expand Down
4 changes: 2 additions & 2 deletions pygeoweaver/sc_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import subprocess

import requests
from . import constants
from pygeoweaver.constants import *

from pygeoweaver.utils import (
download_geoweaver_jar,
Expand Down Expand Up @@ -65,7 +65,7 @@ def detail_host(host_id):

def get_process_code(process_id):
r = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/detail",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/detail",
data={"type": "process", "id": process_id},
).json()
return r["code"]
8 changes: 4 additions & 4 deletions pygeoweaver/sc_find.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import requests
from . import constants
from pygeoweaver.constants import *
import pandas as pd


def get_process_by_name(process_name):
response = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/list", data={"type": "process"}
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/list", data={"type": "process"}
)
process_list = response.json()

Expand All @@ -22,7 +22,7 @@ def get_process_by_name(process_name):

def get_process_by_id(process_id):
response = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/list", data={"type": "process"}
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/list", data={"type": "process"}
)
process_list = response.json()

Expand All @@ -39,7 +39,7 @@ def get_process_by_id(process_id):

def get_process_by_language(language):
response = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/list", data={"type": "process"}
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/list", data={"type": "process"}
)
process_list = response.json()

Expand Down
6 changes: 3 additions & 3 deletions pygeoweaver/sc_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pandas as pd
import requests

from . import constants
from pygeoweaver.constants import *
from pygeoweaver.utils import (
download_geoweaver_jar,
get_geoweaver_jar_path,
Expand Down Expand Up @@ -35,7 +35,7 @@ def get_process_history(process_id):
download_geoweaver_jar()
try:
r = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/logs",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/logs",
data={"type": "process", "id": process_id},
).json()
df = pd.DataFrame(r)
Expand All @@ -59,7 +59,7 @@ def get_workflow_history(workflow_id):
raise Exception("please pass `workflow_id` as a parameter to the function.")
try:
r = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/logs",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/logs",
data={"type": "workflow", "id": workflow_id},
).json()
df = pd.DataFrame(r)
Expand Down
4 changes: 2 additions & 2 deletions pygeoweaver/sc_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import requests
import subprocess
from . import constants
from pygeoweaver.constants import *
from pygeoweaver.utils import (
download_geoweaver_jar,
get_geoweaver_jar_path,
Expand Down Expand Up @@ -34,7 +34,7 @@ def list_processes_in_workflow(workflow_id):
download_geoweaver_jar()
payload = {"id": workflow_id, "type": "workflow"}
r = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/detail", data=payload
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/detail", data=payload
)
nodes = json.loads(r.json()["nodes"])
result = [
Expand Down
6 changes: 3 additions & 3 deletions pygeoweaver/sc_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
get_java_bin_path,
get_root_dir,
)
from . import constants
from pygeoweaver.constants import *


def run_process(
Expand Down Expand Up @@ -42,12 +42,12 @@ def run_process(
context = f.read()
f.close()
details = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/detail",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/detail",
data={"type": "process", "id": process_id},
).json()
details["code"] = context
requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/edit/process",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/edit/process",
data=json.dumps(details),
headers={"Content-Type": "application/json"},
)
Expand Down
10 changes: 5 additions & 5 deletions pygeoweaver/sc_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import requests
import typing

from . import constants
from pygeoweaver.constants import *
from pygeoweaver.utils import (
download_geoweaver_jar,
copy_files,
Expand All @@ -18,7 +18,7 @@ def sync(process_id: str, local_path: typing.Union[str, os.PathLike], direction:
if not local_path:
raise Exception("Sync path not found.")
r = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/detail",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/detail",
data={"type": "process", "id": process_id},
).json()
code = r["code"]
Expand All @@ -40,14 +40,14 @@ def sync(process_id: str, local_path: typing.Union[str, os.PathLike], direction:
if not local_path:
raise Exception("Sync path not found.")
process_prev_state = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/detail",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/detail",
data={"type": "process", "id": process_id},
).json()
with open(local_path, "r") as f:
f_content = f.read()
process_prev_state["code"] = f_content
requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/edit/process",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/edit/process",
data=json.dumps(process_prev_state),
headers={"Content-Type": "application/json"},
)
Expand All @@ -61,7 +61,7 @@ def sync_workflow(workflow_id: str, sync_to_path: typing.Union[str, os.PathLike]
download_geoweaver_jar()
# download workflow
r = requests.post(
f"{constants.GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/downloadworkflow",
f"{GEOWEAVER_DEFAULT_ENDPOINT_URL}/web/downloadworkflow",
data={"id": workflow_id, "option": "workflowwithprocesscodeallhistory"},
).text
filename = r.rsplit("/")[-1]
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"

[project]
name = "pygeoweaver"
version = "0.7.1"
version = "0.7.2"
authors = [
{ name="Geoweaver team", email="[email protected]" },
]
description = "This is a wrapper package of the Geoweaver app."
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.7,<4"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
Expand All @@ -22,14 +22,14 @@ classifiers = [

[tool.poetry]
name = "pygeoweaver"
version = "0.7.1"
version = "0.7.2"
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"
python = ">=3.7,<4"
setuptools = ">=61.0"
requests = "2.28.2"
pydantic = "1.10.9"
Expand Down

0 comments on commit af5fab4

Please sign in to comment.