-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into musicode
- Loading branch information
Showing
11 changed files
with
157 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
# https://docs.readthedocs.io/en/stable/config-file/v2.html | ||
# https://blog.readthedocs.com/migrate-configuration-v2/ | ||
version: 2 | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.11" | ||
sphinx: | ||
configuration: doc/source/conf.py | ||
python: | ||
install: | ||
- requirements: requirements.txt | ||
install: | ||
- requirements: requirements-mupif.txt | ||
- requirements: requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,9 +23,6 @@ Wireguard VPN | |
============== | ||
|
||
|
||
REST API | ||
========= | ||
|
||
Database | ||
--------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
REST API | ||
########## | ||
|
||
MupifDB | ||
======== | ||
|
||
.. openapi:: mupifdb-rest-api.openapi.json | ||
:exclude: /EDM/ | ||
|
||
Entity Data Model (EDM) | ||
======================== | ||
|
||
.. openapi:: mupifdb-rest-api.openapi.json | ||
:include: /EDM/ | ||
|
||
|
||
Demonstration | ||
--------------- | ||
|
||
.. toctree:: | ||
|
||
04-dms-data.ipynb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import fastapi | ||
import pymongo | ||
import Pyro5.api | ||
import mupif as mp | ||
import os | ||
|
||
app = fastapi.FastAPI(openapi_tags=[{'name':'Stats'}]) | ||
|
||
mongoClient = pymongo.MongoClient("mongodb://localhost:27017") | ||
|
||
|
||
|
||
@app.get("/status2/", tags=["Stats"]) | ||
def get_status2(): | ||
ns = None | ||
try: | ||
ns = mp.pyroutil.connectNameserver(); | ||
nameserverStatus = 'OK' | ||
except: | ||
nameserverStatus = 'Failed' | ||
|
||
# get Scheduler status | ||
schedulerStatus = 'Failed' | ||
query = ns.yplookup(meta_any={"type:scheduler"}) | ||
try: | ||
for name, (uri, metadata) in query.items(): | ||
s = Pyro5.api.Proxy(uri) | ||
st = s.getStatistics() | ||
schedulerStatus = 'OK' | ||
except Exception as e: | ||
print(str(e)) | ||
|
||
# get DMS status | ||
if mongoClient: DMSStatus = 'OK' | ||
else: DMSStatus = 'Failed' | ||
|
||
return {'nameserver': nameserverStatus, 'dms': DMSStatus, 'scheduler': schedulerStatus, 'name':os.environ["MUPIF_VPN_NAME"]} | ||
|
||
|
||
@app.get("/scheduler-status2/", tags=["Stats"]) | ||
def get_scheduler_status2(): | ||
ns = mp.pyroutil.connectNameserver(); | ||
return mp.monitor.schedulerInfo(ns) | ||
|
||
@app.get("/ns-status2/", tags=["Stats"]) | ||
def get_ns_status2(): | ||
ns = mp.pyroutil.connectNameserver(); | ||
return mp.monitor.nsInfo(ns) | ||
|
||
@app.get("/vpn-status2/", tags=["Stats"]) | ||
def get_vpn_status2(): | ||
return mp.monitor.vpnInfo(hidePriv=False) | ||
|
||
@app.get("/jobmans-status2/", tags=["Stats"]) | ||
def get_jobmans_status2(): | ||
ns = mp.pyroutil.connectNameserver(); | ||
return mp.monitor.jobmanInfo(ns) | ||
|
||
|
||
if __name__ == '__main__': | ||
import uvicorn | ||
uvicorn.run('safeapi:app', host='0.0.0.0', port=8081, reload=True) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mupif @ git+https://github.com/mupif/mupif@master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters