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
fix server
  • Loading branch information
ZihengSun committed Apr 3, 2023
commit 6be3ecb9317b1c9c5a83c9daedae37873170fcbb
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/*
dist/*
*egg-info*
File renamed without changes.
14 changes: 14 additions & 0 deletions pygeoweaver/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
The main function of pygeoweaver
To run in CLI mode.
"""
from server import start, stop

def main():
# start geoweaver
#start()
# stop geoweaver
stop()

if __name__ == "__main__":
main()
13 changes: 6 additions & 7 deletions pygeoweaver/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import os
import subprocess
from utils import get_root_dir

"""
This module provides function to start and stop Geoweaver server.
Expand All @@ -17,16 +18,14 @@ def download_geoweaver():

def start():
print("start Geoweaver instance..")
result = subprocess.run(['start.sh'], capture_output=True, text=True)
print(result.stdout)
print(result.stderr)
result = subprocess.run(['./start.sh'], cwd=f"{get_root_dir()}/")



def stop():
print("stop Geoweaver instance..")
result = subprocess.run(['stop.sh'], capture_output=True, text=True)
print(result.stdout)
print(result.stderr)
result = subprocess.run(['./stop.sh'], cwd=f"{get_root_dir()}/", shell=True)




Expand Down
14 changes: 8 additions & 6 deletions pygeoweaver/start.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/bin/bash

echo "Stop running Geoweaver if any.."
pkill -f geoweaver

FILE=~/geoweaver.jar
if [ -f "$FILE" ]; then
echo "$FILE exists. Skip downloading.."
else
echo "Downloading the latest geoweaver.jar to user home directory"
cd ~ && curl -OL https://github.com/ESIPFed/Geoweaver/releases/download/latest/geoweaver.jar
echo "$FILE exists. Remove.."
rm -f $FILE
fi

echo "Stop running Geoweaver if any.."
kill $(ps aux | grep 'geoweaver.jar' | awk '{print $2}')
echo "Downloading the latest geoweaver.jar to user home directory"
cd ~ && curl -OL https://github.com/ESIPFed/Geoweaver/releases/download/latest/geoweaver.jar

echo "Start Geoweaver.."
nohup java -jar ~/geoweaver.jar > ~/geoweaver.log &
Expand All @@ -23,6 +24,7 @@ do
((counter++))
done

cat ~/geoweaver.log
if [ $counter == 20 ] ; then
echo "Error: Geoweaver is not up"
exit 1
Expand Down
12 changes: 10 additions & 2 deletions pygeoweaver/stop.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash



echo "Stop running Geoweaver if any.."
pkill -f geoweaver
STATUS=$(curl -s -o /dev/null -w "%{http_code}\n" "http:https://localhost:8070/Geoweaver")
if [ $STATUS != 302 ]; then
echo "Stopped."
exit 0
else
echo "Error: unable to stop."
exit 1
fi

6 changes: 6 additions & 0 deletions pygeoweaver/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os

def get_root_dir():
print(os.path.basename(__file__))
head, tail = os.path.split(__file__)
return head
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[build-system]
requires = [

]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "pygeoweaver"
version = "0.0.1"
version = "0.6.0"
authors = [
{ name="Geoweaver team", email="[email protected]" },
]
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.