Feat: expose 8002 port on docker ups_predictor service
Feat: added label that shows prediction values in datagetherer index.html
This commit is contained in:
parent
ae093c0f26
commit
74c96c620d
6 changed files with 56 additions and 21 deletions
41
.idea/workspace.xml
generated
41
.idea/workspace.xml
generated
|
|
@ -1,10 +1,13 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="603d916b-6d0f-43a7-809c-21ce2bcb2533" name="Default Changelist" comment="Feat: scaled">
|
<list default="true" id="603d916b-6d0f-43a7-809c-21ce2bcb2533" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/DataGatherer/src/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/DataGatherer/src/index.html" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/DataGatherer/src/index.prod.html" beforeDir="false" afterPath="$PROJECT_DIR$/DataGatherer/src/index.prod.html" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/DataGatherer/src/main.ts" beforeDir="false" afterPath="$PROJECT_DIR$/DataGatherer/src/main.ts" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/DataGatherer/src/main.ts" beforeDir="false" afterPath="$PROJECT_DIR$/DataGatherer/src/main.ts" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Predictor/PredictorWebService/src/image-creator/ImageCreatorService.ts" beforeDir="false" afterPath="$PROJECT_DIR$/Predictor/PredictorWebService/src/image-creator/ImageCreatorService.ts" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Predictor/PredictorWebService/src/predictor-web-service/PredictorWebService.ts" beforeDir="false" afterPath="$PROJECT_DIR$/Predictor/PredictorWebService/src/predictor-web-service/PredictorWebService.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/docker-compose.yml" beforeDir="false" afterPath="$PROJECT_DIR$/docker-compose.yml" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
|
@ -66,7 +69,7 @@
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="npm.start-imageCreator">
|
<component name="RunManager" selected="Docker.docker-compose.yml: Compose Deployment (1)">
|
||||||
<configuration name="docker-compose.yml: Compose Deployment (1)" type="docker-deploy" factoryName="docker-compose.yml" temporary="true" server-name="Docker">
|
<configuration name="docker-compose.yml: Compose Deployment (1)" type="docker-deploy" factoryName="docker-compose.yml" temporary="true" server-name="Docker">
|
||||||
<deployment type="docker-compose.yml">
|
<deployment type="docker-compose.yml">
|
||||||
<settings>
|
<settings>
|
||||||
|
|
@ -119,11 +122,11 @@
|
||||||
<envs />
|
<envs />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="start-imageCreator" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
<configuration name="start-ws" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||||
<package-json value="$PROJECT_DIR$/Predictor/PredictorWebService/package.json" />
|
<package-json value="$PROJECT_DIR$/Predictor/PredictorWebService/package.json" />
|
||||||
<command value="run" />
|
<command value="run" />
|
||||||
<scripts>
|
<scripts>
|
||||||
<script value="start-imageCreator" />
|
<script value="start-ws" />
|
||||||
</scripts>
|
</scripts>
|
||||||
<node-interpreter value="project" />
|
<node-interpreter value="project" />
|
||||||
<envs />
|
<envs />
|
||||||
|
|
@ -132,19 +135,19 @@
|
||||||
<list>
|
<list>
|
||||||
<item itemvalue="Docker.docker-compose.yml: Compose Deployment" />
|
<item itemvalue="Docker.docker-compose.yml: Compose Deployment" />
|
||||||
<item itemvalue="Docker.dockerfile.yml: Compose Deployment" />
|
<item itemvalue="Docker.dockerfile.yml: Compose Deployment" />
|
||||||
<item itemvalue="Docker.docker-compose.yml: Compose Deployment (1)" />
|
<item itemvalue="npm.start-ws" />
|
||||||
<item itemvalue="npm.build" />
|
<item itemvalue="npm.build" />
|
||||||
<item itemvalue="npm.build:prod" />
|
<item itemvalue="npm.build:prod" />
|
||||||
<item itemvalue="npm.build-ws:prod" />
|
<item itemvalue="npm.build-ws:prod" />
|
||||||
<item itemvalue="npm.start-imageCreator" />
|
<item itemvalue="Docker.docker-compose.yml: Compose Deployment (1)" />
|
||||||
</list>
|
</list>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
<item itemvalue="npm.start-imageCreator" />
|
|
||||||
<item itemvalue="Docker.docker-compose.yml: Compose Deployment (1)" />
|
<item itemvalue="Docker.docker-compose.yml: Compose Deployment (1)" />
|
||||||
<item itemvalue="npm.build:prod" />
|
<item itemvalue="npm.build:prod" />
|
||||||
<item itemvalue="npm.build-ws:prod" />
|
<item itemvalue="npm.build-ws:prod" />
|
||||||
<item itemvalue="npm.build" />
|
<item itemvalue="npm.build" />
|
||||||
|
<item itemvalue="npm.start-ws" />
|
||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -152,12 +155,7 @@
|
||||||
<option name="allServicesViewState">
|
<option name="allServicesViewState">
|
||||||
<serviceView>
|
<serviceView>
|
||||||
<treeState>
|
<treeState>
|
||||||
<expand>
|
<expand />
|
||||||
<path>
|
|
||||||
<item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
|
|
||||||
<item name="com.intellij.execution.services.ServiceModel$ServiceNode@1ad5b4b6" type="9fbbdea:ServiceModel$ServiceNode" />
|
|
||||||
</path>
|
|
||||||
</expand>
|
|
||||||
<select />
|
<select />
|
||||||
</treeState>
|
</treeState>
|
||||||
</serviceView>
|
</serviceView>
|
||||||
|
|
@ -195,7 +193,8 @@
|
||||||
<workItem from="1571588208616" duration="549000" />
|
<workItem from="1571588208616" duration="549000" />
|
||||||
<workItem from="1571650740912" duration="14000" />
|
<workItem from="1571650740912" duration="14000" />
|
||||||
<workItem from="1572936055537" duration="9527000" />
|
<workItem from="1572936055537" duration="9527000" />
|
||||||
<workItem from="1572945879186" duration="1102000" />
|
<workItem from="1572945879186" duration="1797000" />
|
||||||
|
<workItem from="1573108855497" duration="2724000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Feat: Added websocket comm. for DataGatherer and PredictorWebService">
|
<task id="LOCAL-00001" summary="Feat: Added websocket comm. for DataGatherer and PredictorWebService">
|
||||||
<created>1554992034761</created>
|
<created>1554992034761</created>
|
||||||
|
|
@ -204,7 +203,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1554992034761</updated>
|
<updated>1554992034761</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="2" />
|
<task id="LOCAL-00002" summary="Fix: image creator service flowName and agentName fixes">
|
||||||
|
<created>1572947070648</created>
|
||||||
|
<option name="number" value="00002" />
|
||||||
|
<option name="presentableId" value="LOCAL-00002" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1572947070648</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="3" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
|
@ -225,6 +231,7 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="Feat: Added websocket comm. for DataGatherer and PredictorWebService" />
|
<MESSAGE value="Feat: Added websocket comm. for DataGatherer and PredictorWebService" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Feat: Added websocket comm. for DataGatherer and PredictorWebService" />
|
<MESSAGE value="Fix: image creator service flowName and agentName fixes" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Fix: image creator service flowName and agentName fixes" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<script>
|
||||||
|
UPS_CONFIGS = {
|
||||||
|
gatherer_ws_url: 'localhost:8001',
|
||||||
|
predictor_ws_url: 'localhost:8002/predict'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
#prediction {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<script src="../dist/bundle.js"></script>
|
<script src="../dist/bundle.js"></script>
|
||||||
<script>
|
<script>
|
||||||
/* const interval = setInterval(() => {
|
/* const interval = setInterval(() => {
|
||||||
|
|
@ -16,6 +28,8 @@
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div id="prediction"> Prediction = <div id="prediction_value"></div></div>
|
||||||
<button>ciao</button>
|
<button>ciao</button>
|
||||||
<div id="1" style="width: 50px; height: 70px; background-color:red; position: absolute; top: 20px; left: 100px;"></div>
|
<div id="1" style="width: 50px; height: 70px; background-color:red; position: absolute; top: 20px; left: 100px;"></div>
|
||||||
<div id="2" style="width: 30px; height: 500px; background-color:blue; position: absolute; top: 465px; left: 33px;"></div>
|
<div id="2" style="width: 30px; height: 500px; background-color:blue; position: absolute; top: 465px; left: 33px;"></div>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,12 @@
|
||||||
predictor_ws_url: 'localhost:8002/predict'
|
predictor_ws_url: 'localhost:8002/predict'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style>
|
||||||
|
#prediction {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<script src="bundle.js"></script>
|
<script src="bundle.js"></script>
|
||||||
<script>
|
<script>
|
||||||
/* const interval = setInterval(() => {
|
/* const interval = setInterval(() => {
|
||||||
|
|
@ -22,6 +28,8 @@
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div id="prediction"> Prediction = <div id="prediction_value"></div></div>
|
||||||
<button>ciao</button>
|
<button>ciao</button>
|
||||||
<div id="1" style="width: 50px; height: 70px; background-color:red; position: absolute; top: 20px; left: 100px;"></div>
|
<div id="1" style="width: 50px; height: 70px; background-color:red; position: absolute; top: 20px; left: 100px;"></div>
|
||||||
<div id="2" style="width: 30px; height: 500px; background-color:blue; position: absolute; top: 465px; left: 33px;"></div>
|
<div id="2" style="width: 30px; height: 500px; background-color:blue; position: absolute; top: 465px; left: 33px;"></div>
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ function main() {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
//startPrediction(gatherer);
|
startPrediction(humanGatherer);
|
||||||
// startGathering([humanGatherer, botGatherer]);
|
// startGathering([humanGatherer, botGatherer]);
|
||||||
startGathering([humanGatherer])
|
startGathering([humanGatherer])
|
||||||
}
|
}
|
||||||
|
|
@ -30,11 +30,15 @@ function getAgentName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function startPrediction(gatherer: Gatherer) {
|
function startPrediction(gatherer: Gatherer) {
|
||||||
const sender: Sender = new Sender(() => gatherer.getData(), UPS_CONFIGS.gatherer_ws_url,10000);
|
const sender: Sender = new Sender(() => gatherer.getData(), UPS_CONFIGS.predictor_ws_url,2000);
|
||||||
sender.start('http')
|
sender.start('http')
|
||||||
.subscribe(
|
.subscribe(
|
||||||
val => {
|
val => {
|
||||||
console.log(val);
|
if (val) {
|
||||||
|
const max = Math.max(...val);
|
||||||
|
const maxIndex = val.indexOf(max.toString());
|
||||||
|
document.getElementById("prediction_value").innerText = val + '\n Stato probabile: ' + maxIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +52,6 @@ function startGathering(gatherers: Array<Gatherer>) {
|
||||||
sender.start('ws')
|
sender.start('ws')
|
||||||
.subscribe(
|
.subscribe(
|
||||||
val => {
|
val => {
|
||||||
console.log(val);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,8 @@ export class PredictorWebService {
|
||||||
this.app.use(bodyParser.urlencoded({ extended: false }));
|
this.app.use(bodyParser.urlencoded({ extended: false }));
|
||||||
|
|
||||||
this.app.post('/predict', function (req, res) {
|
this.app.post('/predict', function (req, res) {
|
||||||
|
|
||||||
|
//TODO contatta servizio python
|
||||||
function generateFakeResponse() {
|
function generateFakeResponse() {
|
||||||
return Array.from({length: 20}, () => Math.random().toPrecision(2));
|
return Array.from({length: 20}, () => Math.random().toPrecision(2));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ services:
|
||||||
:ro"
|
:ro"
|
||||||
ports:
|
ports:
|
||||||
- "8001:8001"
|
- "8001:8001"
|
||||||
|
- "8002:8002"
|
||||||
|
|
||||||
ups_database:
|
ups_database:
|
||||||
image: ups_database
|
image: ups_database
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue