Fixed GET response

parent 751372ec
FROM python:3
LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
#ENV http_proxy http://proxy.uni-klu.ac.at:3128/
#ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update
......
......@@ -35,4 +35,4 @@ else:
# start app
if __name__ == '__main__':
app.run(host='0.0.0.0', port=30424, debug=False, ssl_context=context) #<-- IF running locally comment ss_context
app.run(host='0.0.0.0', port=5000, debug=False, ssl_context=context) #<-- IF running locally comment ss_context
......@@ -13,14 +13,14 @@ if os.path.exists(modules_path):
def last(use_case: str):
#FORWARD TO GPU SERVER WITH IP AND PORT
url = f'https://{network_constants.FEDERATED_TRAINING_HOSTNAME}:{network_constants.FEDERATED_TRAINING_REST_PORT}/api/Developers/use_case/{use_case}/last_train:'
url = f'https://{network_constants.FEDERATED_TRAINING_HOSTNAME}:{network_constants.FEDERATED_TRAINING_REST_PORT}/api/Developers/use_case/{use_case}/last_train'
response = requests.get(
url,
verify = False,
proxies = { "http":None, "https":None }
)
return response
return json.loads(response.text)
def upload_and_train(use_case: str, developer_id: int):
......@@ -30,7 +30,7 @@ def upload_and_train(use_case: str, developer_id: int):
#data = {'use_case' : use_case,
# 'developer_id' : developer_id}
url = f'https://{network_constants.FEDERATED_TRAINING_HOSTNAME}:{network_constants.FEDERATED_TRAINING_REST_PORT}/api/Developers/use_cases/{use_case}/developer_id/{developer_id}/upload_and_train:'
url = f'https://{network_constants.FEDERATED_TRAINING_HOSTNAME}:{network_constants.FEDERATED_TRAINING_REST_PORT}/api/Developers/use_cases/{use_case}/developer_id/{developer_id}/upload_and_train'
#url= 'gpu3.itec.aau.at/home/itec/bogdan/Articonf/smart/tools/federated-training/app/routes/developers'
response = requests.post(
url,
......@@ -40,7 +40,7 @@ def upload_and_train(use_case: str, developer_id: int):
#data = data
)
return response
return json.loads(response.text)
#upload_and_train("text_processing",1)
......
......@@ -15,7 +15,7 @@ def last(use_case: str):
verify = False,
proxies = { "http":None, "https":None }
)
return response
return json.loads(response.text)
def upload_and_train(use_case: str):
......@@ -29,7 +29,7 @@ def upload_and_train(use_case: str):
files= request.files
)
return response
return json.loads(response.text)
#last("text_processing")
......
......@@ -15,7 +15,7 @@ def check_article(use_case: str,data_entry: str):
verify = False,
proxies = { "http":None, "https":None }
)
return response
return json.loads(response.text)
......
......@@ -31,7 +31,7 @@ paths:
responses:
'200':
description: "Successful Request"
'404':
'400':
description: "Use case train session data does not exist"
/Owners/use_cases/{use_case}/upload_and_train:
post:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,7 +3,7 @@ import os
from flask import Response, request
import pandas as pd
import sys
from os.path import dirname, abspath
modules_path = './'
if os.path.exists(modules_path):
sys.path.insert(1, modules_path)
......@@ -31,10 +31,14 @@ def upload_and_train(use_case: str, developer_id: int):
#COPY THE NEW DB TO THE FOLDER
#TODO IMPLEMENT HERE
#file_dict = request.files
#db_File_True = file_dict["dataset_file1"]
#db_File_False = file_dict["dataset_file2"]
app_path = dirname(dirname(abspath(__file__)))
file_dict = request.files
db_File_True = file_dict["dataset_file1"]
db_File_False = file_dict["dataset_file2"]
true_csv_path = os.path.join(app_path+"/"+use_case_path+"db/", "True.csv")
false_csv_path = os.path.join(app_path+"/"+use_case_path+"db/", "False.csv")
db_File_True.save(true_csv_path)
db_File_False.save(false_csv_path)
#THEN start processing
last_train_metrics = main_proc.start_processing(use_case,developer_id)
print("## Last train metrics")
......
......@@ -5,7 +5,8 @@ import shutil
from flask import Response, request
import pandas as pd
def last(use_case: str):
def last(use_case: str):
print("ENTERED ROUTES LAST")
csv_path = './processing/'+use_case+'/ledger.csv'
try:
df = pd.read_csv(csv_path)
......@@ -18,6 +19,8 @@ def last(use_case: str):
print(e)
return Response(status=400, response="Trained model data doesn't exist")
def test_respons_funct(metricsJson):
return Response(status=200, response=metricsJson)
def upload_and_train(use_case: str):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment