Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
59c1cd55
Commit
59c1cd55
authored
Jun 25, 2021
by
Bogdan Mihai (ARTICONF student)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed GET response
parent
751372ec
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
44932 additions
and
17 deletions
+44932
-17
Dockerfile
...ticipation-hub/federated-learning-microservice/Dockerfile
+2
-2
main.py
...icipation-hub/federated-learning-microservice/app/main.py
+1
-1
developers.py
.../federated-learning-microservice/app/routes/developers.py
+4
-4
owners.py
...-hub/federated-learning-microservice/app/routes/owners.py
+2
-2
users.py
...n-hub/federated-learning-microservice/app/routes/users.py
+1
-1
routes.yml
tools/federated-training/app/configs/routes.yml
+1
-1
False.csv
...ated-training/app/processing/text_processing/db/False.csv
+0
-0
Fake.csv
...ated-training/app/processing/text_processing/db2/Fake.csv
+23490
-0
True.csv
...ated-training/app/processing/text_processing/db2/True.csv
+21418
-0
developers.py
tools/federated-training/app/routes/developers.py
+9
-5
owners.py
tools/federated-training/app/routes/owners.py
+4
-1
No files found.
src/participation-hub/federated-learning-microservice/Dockerfile
View file @
59c1cd55
FROM
python:3
FROM
python:3
LABEL
maintainer="Alexander Lercher"
LABEL
maintainer="Alexander Lercher"
ENV
http_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/
#
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN
apt-get update
RUN
apt-get update
...
...
src/participation-hub/federated-learning-microservice/app/main.py
View file @
59c1cd55
...
@@ -35,4 +35,4 @@ else:
...
@@ -35,4 +35,4 @@ else:
# start app
# start app
if
__name__
==
'__main__'
:
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
src/participation-hub/federated-learning-microservice/app/routes/developers.py
View file @
59c1cd55
...
@@ -13,14 +13,14 @@ if os.path.exists(modules_path):
...
@@ -13,14 +13,14 @@ if os.path.exists(modules_path):
def
last
(
use_case
:
str
):
def
last
(
use_case
:
str
):
#FORWARD TO GPU SERVER WITH IP AND PORT
#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
(
response
=
requests
.
get
(
url
,
url
,
verify
=
False
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
}
proxies
=
{
"http"
:
None
,
"https"
:
None
}
)
)
return
response
return
json
.
loads
(
response
.
text
)
def
upload_and_train
(
use_case
:
str
,
developer_id
:
int
):
def
upload_and_train
(
use_case
:
str
,
developer_id
:
int
):
...
@@ -30,7 +30,7 @@ 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,
#data = {'use_case' : use_case,
# 'developer_id' : developer_id}
# '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'
#url= 'gpu3.itec.aau.at/home/itec/bogdan/Articonf/smart/tools/federated-training/app/routes/developers'
response
=
requests
.
post
(
response
=
requests
.
post
(
url
,
url
,
...
@@ -40,7 +40,7 @@ def upload_and_train(use_case: str, developer_id: int):
...
@@ -40,7 +40,7 @@ def upload_and_train(use_case: str, developer_id: int):
#data = data
#data = data
)
)
return
response
return
json
.
loads
(
response
.
text
)
#upload_and_train("text_processing",1)
#upload_and_train("text_processing",1)
...
...
src/participation-hub/federated-learning-microservice/app/routes/owners.py
View file @
59c1cd55
...
@@ -15,7 +15,7 @@ def last(use_case: str):
...
@@ -15,7 +15,7 @@ def last(use_case: str):
verify
=
False
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
}
proxies
=
{
"http"
:
None
,
"https"
:
None
}
)
)
return
response
return
json
.
loads
(
response
.
text
)
def
upload_and_train
(
use_case
:
str
):
def
upload_and_train
(
use_case
:
str
):
...
@@ -29,7 +29,7 @@ def upload_and_train(use_case: str):
...
@@ -29,7 +29,7 @@ def upload_and_train(use_case: str):
files
=
request
.
files
files
=
request
.
files
)
)
return
response
return
json
.
loads
(
response
.
text
)
#last("text_processing")
#last("text_processing")
...
...
src/participation-hub/federated-learning-microservice/app/routes/users.py
View file @
59c1cd55
...
@@ -15,7 +15,7 @@ def check_article(use_case: str,data_entry: str):
...
@@ -15,7 +15,7 @@ def check_article(use_case: str,data_entry: str):
verify
=
False
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
}
proxies
=
{
"http"
:
None
,
"https"
:
None
}
)
)
return
response
return
json
.
loads
(
response
.
text
)
...
...
tools/federated-training/app/configs/routes.yml
View file @
59c1cd55
...
@@ -31,7 +31,7 @@ paths:
...
@@ -31,7 +31,7 @@ paths:
responses
:
responses
:
'
200'
:
'
200'
:
description
:
"
Successful
Request"
description
:
"
Successful
Request"
'
40
4
'
:
'
40
0
'
:
description
:
"
Use
case
train
session
data
does
not
exist"
description
:
"
Use
case
train
session
data
does
not
exist"
/Owners/use_cases/{use_case}/upload_and_train
:
/Owners/use_cases/{use_case}/upload_and_train
:
post
:
post
:
...
...
tools/federated-training/app/processing/text_processing/db/Fa
k
e.csv
→
tools/federated-training/app/processing/text_processing/db/Fa
ls
e.csv
View file @
59c1cd55
File moved
tools/federated-training/app/processing/text_processing/db2/Fake.csv
0 → 100644
View file @
59c1cd55
This diff is collapsed.
Click to expand it.
tools/federated-training/app/processing/text_processing/db2/True.csv
0 → 100644
View file @
59c1cd55
This diff is collapsed.
Click to expand it.
tools/federated-training/app/routes/developers.py
View file @
59c1cd55
...
@@ -3,7 +3,7 @@ import os
...
@@ -3,7 +3,7 @@ import os
from
flask
import
Response
,
request
from
flask
import
Response
,
request
import
pandas
as
pd
import
pandas
as
pd
import
sys
import
sys
from
os.path
import
dirname
,
abspath
modules_path
=
'./'
modules_path
=
'./'
if
os
.
path
.
exists
(
modules_path
):
if
os
.
path
.
exists
(
modules_path
):
sys
.
path
.
insert
(
1
,
modules_path
)
sys
.
path
.
insert
(
1
,
modules_path
)
...
@@ -31,10 +31,14 @@ def upload_and_train(use_case: str, developer_id: int):
...
@@ -31,10 +31,14 @@ def upload_and_train(use_case: str, developer_id: int):
#COPY THE NEW DB TO THE FOLDER
#COPY THE NEW DB TO THE FOLDER
#TODO IMPLEMENT HERE
#TODO IMPLEMENT HERE
#file_dict = request.files
app_path
=
dirname
(
dirname
(
abspath
(
__file__
)))
#db_File_True = file_dict["dataset_file1"]
file_dict
=
request
.
files
#db_File_False = file_dict["dataset_file2"]
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
#THEN start processing
last_train_metrics
=
main_proc
.
start_processing
(
use_case
,
developer_id
)
last_train_metrics
=
main_proc
.
start_processing
(
use_case
,
developer_id
)
print
(
"## Last train metrics"
)
print
(
"## Last train metrics"
)
...
...
tools/federated-training/app/routes/owners.py
View file @
59c1cd55
...
@@ -5,7 +5,8 @@ import shutil
...
@@ -5,7 +5,8 @@ import shutil
from
flask
import
Response
,
request
from
flask
import
Response
,
request
import
pandas
as
pd
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'
csv_path
=
'./processing/'
+
use_case
+
'/ledger.csv'
try
:
try
:
df
=
pd
.
read_csv
(
csv_path
)
df
=
pd
.
read_csv
(
csv_path
)
...
@@ -18,6 +19,8 @@ def last(use_case: str):
...
@@ -18,6 +19,8 @@ def last(use_case: str):
print
(
e
)
print
(
e
)
return
Response
(
status
=
400
,
response
=
"Trained model data doesn't exist"
)
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
):
def
upload_and_train
(
use_case
:
str
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment