diff --git a/init.sh b/init.sh index 01be44491931930eb7b9c575d7d9fd175c8a41aa..e640a7f1acb95632f69aef26fff6d2bfaef346e8 100755 --- a/init.sh +++ b/init.sh @@ -7,13 +7,12 @@ touch $HOME/.maap/auth.ini echo "[auth]" > $HOME/.maap/auth.ini echo "email = $1" >> $HOME/.maap/auth.ini echo "password = $2" >> $HOME/.maap/auth.ini -echo "user_id = $3" >> $HOME/.maap/auth.ini #maap.ini touch $HOME/.maap/maap.ini echo "[maap]" > $HOME/.maap/maap.ini echo "copa_backend_url = https://gravitee-gateway.${MAAP_ENV_TYPE,,}.esa-maap.org/" >> $HOME/.maap/maap.ini -echo "url_token = https://auth.${MAAP_ENV_TYPE,,}.esa-maap.org/${$REALM_NAME}/maap/protocol/openid-connect/token" >> $HOME/.maap/maap.ini +echo "url_token = https://auth.${MAAP_ENV_TYPE,,}.esa-maap.org/realms/${$REALM_NAME}/protocol/openid-connect/token" >> $HOME/.maap/maap.ini echo "client_id = $CLIENT_ID" >> $HOME/.maap/maap.ini echo "url_gravitee_s3 = https://gravitee-gateway.${MAAP_ENV_TYPE,,}.esa-maap.org/s3/" >> $HOME/.maap/maap.ini diff --git a/scalability-s2-jupyter/Notebook_Classification_S2.ipynb b/scalability-s2-jupyter/Notebook_Classification_S2.ipynb index a1182ac8afce49a92d18e4d614b6eaeee5222861..f840cdaf7ddeca43434754d099072d8025cf8cbd 100644 --- a/scalability-s2-jupyter/Notebook_Classification_S2.ipynb +++ b/scalability-s2-jupyter/Notebook_Classification_S2.ipynb @@ -62,8 +62,7 @@ "\n", "#Location of the credentials\n", "email = config['auth']['email']\n", - "password = config['auth']['password']\n", - "user_id = config['auth']['user_id'] " + "password = config['auth']['password']" ] }, { @@ -135,11 +134,11 @@ "metadata": {}, "outputs": [], "source": [ - "def wps_execute(user_id, algo_wps_xml):\n", + "def wps_execute(algo_wps_xml):\n", " \n", " print(\"--- EXECUTE---\")\n", " \n", - " url = copa_backend_url + 'wps?userId=' + user_id\n", + " url = copa_backend_url + 'wps/execute'\n", " tree = ET.parse(algo_wps_xml)\n", " \n", " response = requests.post(url, headers = \\\n", @@ -162,7 +161,7 @@ "jobIds = []\n", "\n", "while i < 6:\n", - " jobId = wps_execute(user_id, read_xml)\n", + " jobId = wps_execute(read_xml)\n", " job.append(jobId)\n", " jobIds.append(jobId)\n", " time.sleep(1)\n", @@ -173,7 +172,7 @@ " \n", " for Id in job:\n", " \n", - " url = copa_backend_url + 'wps/getStatus?userId=' + user_id\n", + " url = copa_backend_url + 'wps/getStatus'\n", " body = { \"jobID\": Id }\n", " response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token}, json = body)\n", " parsed = json.loads(response.text)\n", @@ -198,7 +197,7 @@ "print(\"--- GetStatus---\")\n", "for Id in jobIds: \n", " #FIXME retrieve the id of the user\n", - " url = copa_backend_url + 'wps/getStatus?userId=' + user_id\n", + " url = copa_backend_url + 'wps/getStatus'\n", " body = { \"jobID\": Id }\n", " response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token}, json = body)\n", " parsed = json.loads(response.text)\n", @@ -215,7 +214,7 @@ "print(\"--- GetResult---\")\n", "for Id in jobIds: \n", " #FIXME retrieve the id of the user\n", - " url = copa_backend_url + 'wps/'+ Id +'?userId=' + user_id\n", + " url = copa_backend_url + 'wps/'+ Id\n", " response = requests.get(url, headers = {'Authorization': 'Bearer '+oauth_token})\n", " print(response.text)\n" ] @@ -228,7 +227,7 @@ "source": [ "print(\"--- Delete all jobs---\")\n", "for Id in jobIds: \n", - " url = copa_backend_url + 'wps/dismiss?userId=' + user_id\n", + " url = copa_backend_url + 'wps/dismiss'\n", " body = { \"jobID\": Id }\n", " response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token}, json = body)\n", " parsed = json.loads(response.text)\n", diff --git a/scalability-s2-jupyter/algo_wps.py b/scalability-s2-jupyter/algo_wps.py index 52c5178f3891266b33c86fb3f9c7dc29da6bded3..29dc29371eac425fad6f59d7d806836ab06309aa 100644 --- a/scalability-s2-jupyter/algo_wps.py +++ b/scalability-s2-jupyter/algo_wps.py @@ -7,14 +7,13 @@ import xml.etree.ElementTree as ET oauth_token = os.getenv("BEARER_TOKEN") #oauth_token = 'dc5f6cc4-7a13-4768-add3-0fc460f94abf' copa_backend_url = os.getenv("WPS_URL") -user_id='37275' #copa_backend_url = 'https://gravitee-gateway.val.esa-maap.org/' def wps_execute(): print("--- EXECUTE---") sourceFile = 'read_s2.xml' - url = copa_backend_url + 'wps?userId=' + user_id + url = copa_backend_url + 'wps/execute' #files = {'file': open(sourceFile, 'rb')} tree = ET.parse('read_s2.xml') response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token, 'Content-Type': 'application/xml'}, data=ET.tostring(tree.getroot())) @@ -40,10 +39,10 @@ if sys.argv[1] != "NASA": print("--- GetStatus---") #FIXME retrieve the id of the user - url = copa_backend_url + 'wps/getStatus?userId=' + user_id + url = copa_backend_url + 'wps/getStatus' body = { "jobID": jobId } - #wps = WebProcessingService(copa_backend_url+'wps/getStatus?userId=37275', headers = {'Authorization': 'Bearer '+oauth_token}, json = body) + #wps = WebProcessingService(copa_backend_url+'wps/getStatus', headers = {'Authorization': 'Bearer '+oauth_token}, json = body) response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token}, json = body) print(response.text) @@ -54,7 +53,7 @@ if sys.argv[1] != "NASA": print("--- GetResult---") #FIXME retrieve the id of the user jobId = "5ff74d6a7fb4730001c85d13" - url = copa_backend_url + 'wps/'+ jobId +'?userId=' + user_id + url = copa_backend_url + 'wps/'+ jobId response = requests.get(url, headers = {'Authorization': 'Bearer '+oauth_token}) #xml.etree.ElementTree.dump(tree) diff --git a/wps_notebook/Resample.ipynb b/wps_notebook/Resample.ipynb index 5b912f6c379734076a6fb839a20ea10f503f446b..ef9b1e1fa538e1d465d85236f0bc5040cfd3e319 100644 --- a/wps_notebook/Resample.ipynb +++ b/wps_notebook/Resample.ipynb @@ -54,7 +54,6 @@ "config.read('/projects/.maap/auth.ini')\n", "\n", "#Retrieve auth values\n", - "user_id = config['auth']['user_id']\n", "email = config['auth']['email']\n", "password = config['auth']['password']\n", "#Set env variables\n", @@ -97,7 +96,7 @@ "metadata": {}, "outputs": [], "source": [ - "wps = wpsTB(oauth_token, copa_backend_url, user_id)" + "wps = wpsTB(oauth_token, copa_backend_url)" ] }, { @@ -210,7 +209,7 @@ "source": [ "print(\"--- GetStatus---\")\n", "#FIXME retrieve the id of the user\n", - "url = copa_backend_url + 'wps/getStatus?userId=' + user_id\n", + "url = copa_backend_url + 'wps/getStatus'\n", " \n", "body = { \"jobID\": jobID[0] }\n", "response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token}, json = body)\n", @@ -228,7 +227,7 @@ "source": [ "print(\"--- GetResult---\")\n", "#FIXME retrieve the id of the user\n", - "url = copa_backend_url + 'wps/'+ jobID[0] +'?userId=' + user_id\n", + "url = copa_backend_url + 'wps/'+ jobID[0]\n", "response = requests.get(url, headers = {'Authorization': 'Bearer '+oauth_token})\n", "\n", "print(response.text)" @@ -285,7 +284,7 @@ "outputs": [], "source": [ "print(\"---DeleteJob---\")\n", - "url = copa_backend_url + 'wps/dismiss?userId=' + user_id\n", + "url = copa_backend_url + 'wps/dismiss'\n", "body = { \"jobID\": jobID[0]}\n", "#body = { \"jobID\": '62054cac310b5900011f25f0'}\n", "response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token}, json = body)\n", diff --git a/wps_notebook/Scalability_Demonstration.ipynb b/wps_notebook/Scalability_Demonstration.ipynb index 02621de8d2906226f4e6baabfa0fd873eaca1744..54514fbed92fd1b49cae560ef8e5bac607262101 100644 --- a/wps_notebook/Scalability_Demonstration.ipynb +++ b/wps_notebook/Scalability_Demonstration.ipynb @@ -29,7 +29,6 @@ "config.read('/projects/.maap/auth.ini')\n", "\n", "#Retrieve auth values\n", - "user_id = config['auth']['user_id']\n", "email = config['auth']['email']\n", "password = config['auth']['password']" ] @@ -68,7 +67,7 @@ "metadata": {}, "outputs": [], "source": [ - "wps = wpsTB(oauth_token, copa_backend_url, user_id)" + "wps = wpsTB(oauth_token, copa_backend_url)" ] }, { @@ -119,7 +118,7 @@ "print(\"--- GetStatus---\")\n", "for Id in jobID: \n", " #FIXME retrieve the id of the user\n", - " url = copa_backend_url + 'wps/getStatus?userId=' + user_id\n", + " url = copa_backend_url + 'wps/getStatus'\n", " body = { \"jobID\": Id }\n", " print(Id)\n", " response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token}, json = body)\n", @@ -137,7 +136,7 @@ "print(\"--- GetResult---\")\n", "for Id in jobID: \n", " #FIXME retrieve the id of the user\n", - " url = copa_backend_url + 'wps/'+ Id +'?userId=' + user_id\n", + " url = copa_backend_url + 'wps/'+ Id\n", " response = requests.get(url, headers = {'Authorization': 'Bearer '+oauth_token})\n", " print(response.text)" ] @@ -158,7 +157,7 @@ "#jobID =['62221dcb310b59000170059d','62221c61310b590001700599','62221c8d310b59000170059b']\n", "\n", "for Id in jobID: \n", - " url = copa_backend_url + 'wps/dismiss?userId=' + user_id\n", + " url = copa_backend_url + 'wps/dismiss'\n", " body = { \"jobID\": Id }\n", " response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token}, json = body)\n", " parsed = json.loads(response.text)\n", diff --git a/wps_notebook/Scalability_aksk_biopal_fh.ipynb b/wps_notebook/Scalability_aksk_biopal_fh.ipynb index fb67ca2a892011d1db984b9129eef8a08f6d3da5..fa5c0b70fd3173f65ba70cf4742be73b2a5bafd8 100644 --- a/wps_notebook/Scalability_aksk_biopal_fh.ipynb +++ b/wps_notebook/Scalability_aksk_biopal_fh.ipynb @@ -29,7 +29,6 @@ "config.read('/projects/.maap/auth.ini')\n", "\n", "#Retrieve auth values\n", - "user_id = config['auth']['user_id']\n", "email = config['auth']['email']\n", "password = config['auth']['password']" ] @@ -68,7 +67,7 @@ "metadata": {}, "outputs": [], "source": [ - "wps = wpsTB(oauth_token, copa_backend_url, user_id)" + "wps = wpsTB(oauth_token, copa_backend_url)" ] }, { @@ -119,7 +118,7 @@ "print(\"--- GetStatus---\")\n", "for Id in jobID: \n", " #FIXME retrieve the id of the user\n", - " url = copa_backend_url + 'wps/getStatus?userId=' + user_id\n", + " url = copa_backend_url + 'wps/getStatus'\n", " body = { \"jobID\": Id }\n", " print(Id)\n", " response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token}, json = body)\n", @@ -137,7 +136,7 @@ "print(\"--- GetResult---\")\n", "for Id in jobID: \n", " #FIXME retrieve the id of the user\n", - " url = copa_backend_url + 'wps/'+ Id +'?userId=' + user_id\n", + " url = copa_backend_url + 'wps/'+ Id\n", " response = requests.get(url, headers = {'Authorization': 'Bearer '+oauth_token})\n", " print(response.text)" ] @@ -158,7 +157,7 @@ "print(jobs)\n", "#jobID =['623c840d4f4c630001aca946', '623c840f4f4c630001aca948', '623c84104f4c630001aca94a', '623c84124f4c630001aca94c', '623c84144f4c630001aca94e', '623c84154f4c630001aca950', '623c84174f4c630001aca952', '623c84184f4c630001aca954', '623c841a4f4c630001aca956', '623c841b4f4c630001aca958', '623c841d4f4c630001aca95a', '623c841e4f4c630001aca95c', '623c84204f4c630001aca95e', '623c84214f4c630001aca960', '623c84234f4c630001aca962', '623c84244f4c630001aca964', '623c84264f4c630001aca966', '623c84274f4c630001aca968', '623c84294f4c630001aca96a', '623c842a4f4c630001aca96c', '623c842c4f4c630001aca96e', '623c842d4f4c630001aca970', '623c842f4f4c630001aca972', '623c84304f4c630001aca974', '623c84324f4c630001aca976', '623c84334f4c630001aca978', '623c84354f4c630001aca97a', '623c84364f4c630001aca97c', '623c84384f4c630001aca97e', '623c84394f4c630001aca980', '623c843b4f4c630001aca982', '623c843c4f4c630001aca984', '623c843e4f4c630001aca986', '623c843f4f4c630001aca988', '623c84414f4c630001aca98a', '623c84424f4c630001aca98c', '623c84444f4c630001aca98e', '623c84454f4c630001aca990', '623c84474f4c630001aca992', '623c84484f4c630001aca994', '623c844a4f4c630001aca996', '623c844b4f4c630001aca998', '623c844d4f4c630001aca99a', '623c844e4f4c630001aca99c', '623c84504f4c630001aca99e', '623c84514f4c630001aca9a0', '623c84534f4c630001aca9a2', '623c84554f4c630001aca9a4', '623c84564f4c630001aca9a6', '623c84584f4c630001aca9a8', '623c84594f4c630001aca9aa', '623c845a4f4c630001aca9ac', '623c845c4f4c630001aca9ae', '623c845d4f4c630001aca9b0', '623c845f4f4c630001aca9b2', '623c84604f4c630001aca9b4', '623c84624f4c630001aca9b6', '623c84634f4c630001aca9b8', '623c84654f4c630001aca9ba', '623c84664f4c630001aca9bc', '623c84684f4c630001aca9be', '623c846a4f4c630001aca9c0', '623c846b4f4c630001aca9c2', '623c846d4f4c630001aca9c4', '623c846e4f4c630001aca9c6', '623c84704f4c630001aca9c8', '623c84714f4c630001aca9ca', '623c84734f4c630001aca9cc', '623c84744f4c630001aca9ce', '623c84764f4c630001aca9d0', '623c84774f4c630001aca9d2', '623c84794f4c630001aca9d4', '623c847a4f4c630001aca9d6', '623c847c4f4c630001aca9d8', '623c847d4f4c630001aca9da', '623c847f4f4c630001aca9dc', '623c84804f4c630001aca9de', '623c84824f4c630001aca9e0', '623c84834f4c630001aca9e2', '623c84854f4c630001aca9e4', '623c84864f4c630001aca9e6', '623c84884f4c630001aca9e8', '623c84894f4c630001aca9ea', '623c848b4f4c630001aca9ec', '623c848c4f4c630001aca9ee', '623c848e4f4c630001aca9f0', '623c848f4f4c630001aca9f2', '623c84914f4c630001aca9f4', '623c84924f4c630001aca9f6', '623c84944f4c630001aca9f8', '623c84954f4c630001aca9fa', '623c84974f4c630001aca9fc', '623c84984f4c630001aca9fe', '623c849a4f4c630001acaa00', '623c849b4f4c630001acaa02', '623c849d4f4c630001acaa04', '623c849e4f4c630001acaa06', '623c84a04f4c630001acaa08', '623c84a14f4c630001acaa0a', '623c84a34f4c630001acaa0c']\n", "for Id in jobID: \n", - " url = copa_backend_url + 'wps/dismiss?userId=' + user_id\n", + " url = copa_backend_url + 'wps/dismiss'\n", " body = { \"jobID\": Id }\n", " response = requests.post(url, headers = {'Authorization': 'Bearer '+oauth_token}, json = body)\n", " parsed = json.loads(response.text)\n", diff --git a/wps_notebook/wpsToolsBox.py b/wps_notebook/wpsToolsBox.py index 90a6972d4f6f7a3f78f6a4f06d168caaf6efc59e..6622b08b3dcdf4658294037f9c925b6fd25174de 100644 --- a/wps_notebook/wpsToolsBox.py +++ b/wps_notebook/wpsToolsBox.py @@ -10,11 +10,10 @@ import pandas as pd class wpsTB: - def __init__(self, oauth_token, copa_backend_url, user_id): + def __init__(self, oauth_token, copa_backend_url): self.oauth_token = oauth_token self.copa_backend_url = copa_backend_url - self.user_id = user_id self.wps = WebProcessingService(self.copa_backend_url + 'wps/capabilities', \ headers = {'Authorization': 'Bearer ' + self.oauth_token}, version ="2.0.0") @@ -105,7 +104,7 @@ class wpsTB: while len(job) != 0: for Id in job: - url = self.copa_backend_url + 'wps/getStatus?userId=' + self.user_id + url = self.copa_backend_url + 'wps/getStatus' body = { "jobID": Id } response = requests.post(url, headers = {'Authorization': 'Bearer '+ self.oauth_token}, json = body) parsed = json.loads(response.text) @@ -133,7 +132,7 @@ class wpsTB: print("--- EXECUTE---") - url = self.copa_backend_url + 'wps?userId=' + self.user_id + url = self.copa_backend_url + 'wps/execute' tree = ET.parse(algo_wps_xml) response = requests.post(url, headers = \ @@ -147,7 +146,7 @@ class wpsTB: def wps_result(self, jobId): - url = self.copa_backend_url + 'wps/'+ jobId +'?userId=' + self.user_id + url = self.copa_backend_url + 'wps/'+ jobId response = requests.get(url, headers = {'Authorization': 'Bearer '+ self.oauth_token}) return response diff --git a/wps_notebook/xml_file/wps_subset_data.xml b/wps_notebook/xml_file/wps_subset_data.xml new file mode 100644 index 0000000000000000000000000000000000000000..7f1c121d83d49cc05b4e846ebcf868b731969aca --- /dev/null +++ b/wps_notebook/xml_file/wps_subset_data.xml @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ExecuteRequestType mode="async" response="document" service="WPS" version="2.0.0" xmlns:xlin="http://www.w3.org/1999/xlink" xmlns:wfs="http://www.opengis.net/wfs/2.1" xmlns:sld="http://www.opengis.net/sld/1.2" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:ns8="http://www.opengis.net/se/2.0/core" xmlns:ns13="http://www.opengis.net/gml" xmlns:ns9="http://www.opengis.net/fes/2.1" xmlns:ns12="http://www.opengis.net/ows-context" xmlns:ns11="http://www.opengis.net/se/2.0/raster" xmlns:ns10="http://www.opengis.net/se/2.0/thematic" xmlns:ns16="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" xmlns:ns15="http://www.w3.org/2005/Atom" xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ns14="http://www.w3.org/2001/SMIL20/" xmlns:wms="http://www.opengis.net/wms" xmlns:ns18="http://www.w3.org/2001/SMIL20/Language"> <ows:Identifier>63497b4be479ea0001fc00a8</ows:Identifier> <wps:Input id="filename"> <wps:Data><wps:LiteralValue>test.tiff</wps:LiteralValue></wps:Data> </wps:Input> <wps:Input id="filepath"> <wps:Data><wps:LiteralValue>/projects/data/subset_data/output/</wps:LiteralValue></wps:Data> </wps:Input> <wps:Input id="subsetData"><wps:Data><wps:LiteralValue><![CDATA[http://edav-backend-mwcs.edav:680/wcs?service=WCS&request=GetCoverage&version=2.0.0&coverageId=ESACCI_Biomass_L4_AGB&subdataset=ESACCI_Biomass_L4_AGB_V3_100m_2017&format=image/tiff&scale=1&subset=Lon(-0.6815980044479516,0.7486712199167138)&subset=Lat(47.19825442696252,48.18330763957005)]]></wps:LiteralValue></wps:Data> </wps:Input></ExecuteRequestType> \ No newline at end of file