Commit 4b5c9b67 authored by mriedl's avatar mriedl
Browse files

Merge branch 'morphemic-rc2.5' of...

Merge branch 'morphemic-rc2.5' of https://gitlab.ow2.org/melodic/morphemic-preprocessor into morphemic-rc2.5
parents 3782a8a8 aca57e0d
Pipeline #21750 passed with stages
in 38 minutes and 58 seconds
......@@ -126,6 +126,38 @@ deploy:persistent-storage:
- docker tag persistent_storage:latest $CI_REGISTRY_IMAGE/persistent_storage:$CI_COMMIT_BRANCH
- docker push $CI_REGISTRY_IMAGE/persistent_storage:$CI_COMMIT_BRANCH
deploy:camel_converter:
stage: deploy
image: $DOCKER_DIND_IMAGE
only:
- master
- morphemic-rc2.5
services:
- $DOCKER_DIND_SERVICE
script:
- cd camel_converter
- docker build -t camel_converter -f ./Dockerfile .
- docker image ls
- echo "$K8S_SECRET_DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $K8S_SECRET_DOCKER_USER --password-stdin
- docker tag camel_converter:latest $CI_REGISTRY_IMAGE/camel_converter:$CI_COMMIT_BRANCH
- docker push $CI_REGISTRY_IMAGE/camel_converter:$CI_COMMIT_BRANCH
deploy:polymorphic_solver:
stage: deploy
image: $DOCKER_DIND_IMAGE
only:
- master
- morphemic-rc2.5
services:
- $DOCKER_DIND_SERVICE
script:
- cd polymorphic_solver
- docker build -t polymorphic_solver -f ./Dockerfile .
- docker image ls
- echo "$K8S_SECRET_DOCKER_PASSWORD" | docker login $CI_REGISTRY -u $K8S_SECRET_DOCKER_USER --password-stdin
- docker tag polymorphic_solver:latest $CI_REGISTRY_IMAGE/polymorphic_solver:$CI_COMMIT_BRANCH
- docker push $CI_REGISTRY_IMAGE/polymorphic_solver:$CI_COMMIT_BRANCH
deploy:forecaster-cnn:
stage: deploy
image: $DOCKER_DIND_IMAGE
......
FROM openjdk:slim
COPY --from=python:3.9 / /
COPY requirements.txt /app/requirements.txt
ADD src /app/src
RUN pip install --upgrade pip
RUN pip install -r /app/requirements.txt
EXPOSE 7676
WORKDIR /app/src
ENTRYPOINT ["python", "-u","app.py"]
#
# Copyright (C) 2017 7bulls.com
#
# This Source Code Form is subject to the terms of the
# Mozilla Public License, v. 2.0. If a copy of the MPL
# was not distributed with this file, You can obtain one at
# http://mozilla.org/MPL/2.0/.
#
#hostname where CDO Server resides
host=cdoserver
#port on which CDO Server listens
port=2036
#the name of the CDO repository of the server
repository=repo1
#logging to be set off or on - default is off
logging=on
#user information
userName=admin
password=admin
#mysql connection properties
dbtype=mysql
dburl=jdbc:mysql://localhost:3306/repo1
username=root
password=admin
#hsqldb connection properties
#dbtype=hsqldb
#dburl=jdbc:hsqldb:file:cdohibernate
#username=admin
#password=admin
#name of the repository to be created
repository=repo1
#type of store to be created
storetype=db
#number of port to listen
port=2036
#logging should be set on or off - default is off
logging=on
#security should be set on or off - default is off
security=off
### logback configuration ###
logging.config=file:${MELODIC_CONFIG_DIR}/logback-conf/logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2017 7bulls.com
~
~ This Source Code Form is subject to the terms of the
~ Mozilla Public License, v. 2.0. If a copy of the MPL
~ was not distributed with this file, You can obtain one at
~ http://mozilla.org/MPL/2.0/.
-->
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<logger name="eu.melodic.upperware.adapter" level="INFO"/>
<logger name="org.springframework.web.filter.CommonsRequestLoggingFilter" level="DEBUG"/>
<logger name="eu.melodic.upperware.cpsolver" level="INFO"/>
<!-- choco solver begin -->
<logger name="choco" level="WARN"/>
<logger name="choco.util" level="INFO"/>
<logger name="bench" level="info"/>
<logger name="solver" level="info"/>
<logger name="fzn" level="info"/>
<logger name="explainer" level="info"/>
<logger name="configuration" level="info"/>
<logger name="tree" level="info"/>
<logger name="visualization" level="info"/>
<!-- choco solver end -->
<logger name="eu.melodic.upperware.metasolver" level="INFO"/>
<!-- from generator -->
<logger name="eu.paasage.upperware.profiler" level="INFO"/>
<logger name="eu.paasage.upperware.security" level="INFO"/>
<logger name="eu.melodic.security.authorization" level="INFO"/>
<logger name="eu.paasage.mddb.cdo.server" level="DEBUG"/>
<logger name="org.hibernate.SQL" level="DEBUG"/>
<logger name="org.hibernate.type" level="TRACE"/>
<logger name="eu.paasage.upperware.profiler.generator.service.camel" level="DEBUG"/>
<!-- DLMSWebService -->
<logger name="eu.melodic.upperware.dlms" level="DEBUG"/>
<!-- DLMSController, DLMSUtility -->
<logger name="eu.melodic.dlms" level="DEBUG"/>
<!-- ems -->
<logger name="eu.melodic.event" level="INFO"/>
<logger name="eu.melodic.event.control" level="INFO"/>
<logger name="eu.melodic.event.baguette.server" level="INFO"/>
<logger name="eu.melodic.event.baguette.client.install" level="DEBUG"/>
<logger name="eu.melodic.event.brokercep" level="DEBUG"/>
<logger name="eu.melodic.event.brokerclient" level="DEBUG"/>
<logger name="eu.melodic.event.translate" level="DEBUG"/>
<logger name="eu.melodic.event.util" level="DEBUG"/>
<logger name="eu.melodic.event.util.NetUtil" level="INFO"/>
</configuration>
version: '3'
services:
camel_converter:
image: jdtotow/camel_converter
build:
context: .
restart: always
container_name: camel
ports:
- 7676:7676
environment:
- CDO_SERVER_PATH=resource #please change it
- PAASAGE_CONFIG_DIR=.paasage
volumes:
- ./morphemic/camel_converter:/app/src/models
- ./config:/app/src/.paasage
cdoserver:
image: gitlab.ow2.org:4567/melodic/model-repository/cdo-server:rc3.1
container_name: cdoserver
volumes:
- ./tmp:/var/lib/mysql
- ./config:/config
- ./logs:/logs
environment:
- MYSQL_ROOT_PASSWORD=admin
- MYSQL_DATABASE=repo1
- MYSQL_USER=root
- MYSQL_PASSWORD=admin
- MELODIC_CONFIG_DIR=/config
- PAASAGE_CONFIG_DIR=/config
- spring.config.location=/config/eu.paasage.mddb.cdo.server.properties
- LOG_FILE=/logs/cdoserver.log
pid: host
ports:
- 2036:2036
- 3306:3306
2022-06-03 10:52:00.775 INFO 62767 --- [main] e.p.m.cdo.server.CdoServerApplication : Starting CdoServerApplication v3.1.0-SNAPSHOT on 3956130dcb06 with PID 62767 (/server.jar started by root in /)
2022-06-03 10:52:00.783 DEBUG 62767 --- [main] e.p.m.cdo.server.CdoServerApplication : Running with Spring Boot v1.5.4.RELEASE, Spring v4.3.9.RELEASE
2022-06-03 10:52:00.785 INFO 62767 --- [main] e.p.m.cdo.server.CdoServerApplication : No active profile set, falling back to default profiles: default
2022-06-03 10:52:00.893 INFO 62767 --- [main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@4ee285c6: startup date [Fri Jun 03 10:52:00 CEST 2022]; root of context hierarchy
2022-06-03 10:52:01.527 INFO 62767 --- [main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2022-06-03 10:52:02.583 INFO 62767 --- [main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2022-06-03 10:52:02.617 INFO 62767 --- [main] e.p.m.cdo.server.CdoServerApplication : Started CdoServerApplication in 2.647 seconds (JVM running for 3.505)
pyjnius
fastapi
uvicorn
host=localhost
port=2036
repository=repo1
logging=on
userName=morphemic
password=morphemic
\ No newline at end of file
import json, time, os, uvicorn, xmltodict
from fastapi import FastAPI
from loader import CDOClientWapper
from pydantic import BaseModel
from typing import Optional
model_folder = os.environ.get("MODEL_FOLDER","./models/")
class ExportRequest(BaseModel):
resource_name: str
filename: str
output: Optional[str] = 'xmi'
class ImportRequest(BaseModel):
resource_name: str
filename: str
app = FastAPI()
@app.post("/import_model")
async def import_model(request: ImportRequest):
filename = model_folder + request.filename
if not os.path.isfile(filename):
return {"status": False, "message": "File {0} not found".format(filename)}
try:
client = CDOClientWapper()
status = client.importModel(filename, request.resource_name)
if status:
return {"status": True, "message": "camel imported successfully"}
else:
return {"status": False, "message": "An error occured while importing camel model"}
except Exception as e:
return {"status": False, "message": e}
@app.post("/export_model")
async def export_model(request: ExportRequest):
filename = model_folder + request.filename
try:
client = CDOClientWapper()
status = client.exportModel(filename, request.resource_name)
if status:
if request.output == "json":
_file = open(filename,"r")
_json_content = json.dumps(xmltodict.parse(_file.read()))
_file.close()
filename = filename[:filename.rindex(".")] + ".json"
_file = open(filename,"w")
_file.write(_json_content)
_file.close()
return {"status": True, "message": "Camel model exporter in the following path: {0}".format(filename)}
else:
return {"status": False, "message": ""}
except Exception as e:
return {"status": False, "message": e}
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=7676)
\ No newline at end of file
Supports Markdown
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