Commit 630f2716 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added exception types

parent c0b42137
......@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.model.Exceptions.TypeExeption;
import nl.uva.sne.drip.model.NodeTemplate;
import nl.uva.sne.drip.model.NodeTemplateMap;
import nl.uva.sne.drip.model.tosca.Credential;
......@@ -167,25 +168,25 @@ public class ToscaHelper {
}
}
public String getTopologyDomain(NodeTemplateMap nodeTemplateMap) throws Exception {
public String getTopologyDomain(NodeTemplateMap nodeTemplateMap) throws TypeExeption {
NodeTemplate nodeTemplate = nodeTemplateMap.getNodeTemplate();
if (nodeTemplate.getType().equals(VM_TOPOLOGY)) {
return (String) nodeTemplate.getProperties().get("domain");
} else {
throw new Exception("NodeTemplateMap is not of type: " + VM_TOPOLOGY + " it is of type: " + nodeTemplate.getType());
throw new TypeExeption("NodeTemplateMap is not of type: " + VM_TOPOLOGY + " it is of type: " + nodeTemplate.getType());
}
}
public String getTopologyProvider(NodeTemplateMap nodeTemplateMap) throws Exception {
public String getTopologyProvider(NodeTemplateMap nodeTemplateMap) throws TypeExeption {
NodeTemplate nodeTemplate = nodeTemplateMap.getNodeTemplate();
if (nodeTemplate.getType().equals(VM_TOPOLOGY)) {
return (String) nodeTemplate.getProperties().get("provider");
} else {
throw new Exception("NodeTemplate is not of type: " + VM_TOPOLOGY + " it is of type: " + nodeTemplate.getType());
throw new TypeExeption("NodeTemplate is not of type: " + VM_TOPOLOGY + " it is of type: " + nodeTemplate.getType());
}
}
public NodeTemplateMap setCredentialsInVMTopology(NodeTemplateMap vmTopologyMap, Credential credential) throws Exception {
public NodeTemplateMap setCredentialsInVMTopology(NodeTemplateMap vmTopologyMap, Credential credential) throws TypeExeption {
NodeTemplate vmTopology = vmTopologyMap.getNodeTemplate();
if (vmTopology.getType().equals(VM_TOPOLOGY)) {
Map<String, Object> att = vmTopology.getAttributes();
......@@ -197,7 +198,7 @@ public class ToscaHelper {
vmTopologyMap.setNodeTemplate(vmTopology);
return vmTopologyMap;
} else {
throw new Exception("NodeTemplate is not of type: " + VM_TOPOLOGY + " it is of type: " + vmTopology.getType());
throw new TypeExeption("NodeTemplate is not of type: " + VM_TOPOLOGY + " it is of type: " + vmTopology.getType());
}
}
......
/*
* Copyright 2019 S. Koulouzis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.model.Exceptions;
/**
*
* @author S. Koulouzis
*/
public class MissingCredentialsException extends Exception{
public MissingCredentialsException(String string) {
super(string);
}
}
/*
* Copyright 2019 S. Koulouzis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.model.Exceptions;
/**
*
* @author S. Koulouzis
*/
public class TypeExeption extends Exception{
public TypeExeption(String string) {
super(string);
}
}
......@@ -30,27 +30,35 @@ import javax.validation.constraints.NotNull;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Message implements Serializable {
/**
* @return the exception
*/
public Exception getException() {
return exception;
}
/**
* @param exception the exception to set
*/
public void setException(Exception exception) {
this.exception = exception;
}
@NotNull
private String owner;
@NotNull
private Long creationDate;
private List<MessageParameter> parameters;
// private List<MessageParameter> parameters;
private ToscaTemplate toscaTemplate;
private Exception exception;
public Long getCreationDate() {
return this.creationDate;
}
public void setParameters(List<MessageParameter> parameters) {
this.parameters = parameters;
}
public List<MessageParameter> getParameters() {
return this.parameters;
}
public void setCreationDate(Long creationDate) {
this.creationDate = creationDate;
}
......@@ -83,8 +91,4 @@ public class Message implements Serializable {
this.toscaTemplate = toscaTemplate;
}
public void setExeption(Exception exception) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
#namespace: kubernetes-dashboard
namespace: default
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
#namespace: kubernetes-dashboard
namespace: default
#kube-system
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v1
kind: Namespace
metadata:
name: kubernetes-dashboard
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
---
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
type: NodePort
ports:
- port: 8443
nodePort: 30443
selector:
k8s-app: kubernetes-dashboard
---
apiVersion: v1
kind: Secret
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-certs
namespace: kubernetes-dashboard
type: Opaque
---
apiVersion: v1
kind: Secret
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-csrf
namespace: kubernetes-dashboard
type: Opaque
data:
csrf: ""
---
apiVersion: v1
kind: Secret
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-key-holder
namespace: kubernetes-dashboard
type: Opaque
---
kind: ConfigMap
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-settings
namespace: kubernetes-dashboard
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
rules:
# Allow Dashboard to get, update and delete Dashboard exclusive secrets.
- apiGroups: [""]
resources: ["secrets"]
resourceNames: ["kubernetes-dashboard-key-holder", "kubernetes-dashboard-certs", "kubernetes-dashboard-csrf"]
verbs: ["get", "update", "delete"]
# Allow Dashboard to get and update 'kubernetes-dashboard-settings' config map.
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["kubernetes-dashboard-settings"]
verbs: ["get", "update"]
# Allow Dashboard to get metrics.
- apiGroups: [""]
resources: ["services"]
resourceNames: ["heapster", "dashboard-metrics-scraper"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:", "dashboard-metrics-scraper", "http:dashboard-metrics-scraper"]
verbs: ["get"]
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
rules:
# Allow Metrics Scraper to get metrics from the Metrics server
- apiGroups: ["metrics.k8s.io"]
resources: ["pods", "nodes"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: kubernetes-dashboard
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubernetes-dashboard
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kubernetes-dashboard
---
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: kubernetes-dashboard
template:
metadata:
labels:
k8s-app: kubernetes-dashboard
spec:
containers:
- name: kubernetes-dashboard
image: kubernetesui/dashboard:v2.0.0-rc3
imagePullPolicy: Always
ports:
- containerPort: 8443
protocol: TCP
args:
- --auto-generate-certificates
- --namespace=kubernetes-dashboard
# Uncomment the following line to manually specify Kubernetes API server Host
# If not specified, Dashboard will attempt to auto discover the API server and connect
# to it. Uncomment only if the default does not work.
# - --apiserver-host=http://my-address:port
volumeMounts:
- name: kubernetes-dashboard-certs
mountPath: /certs
# Create on-disk volume to store exec logs
- mountPath: /tmp
name: tmp-volume
livenessProbe:
httpGet:
scheme: HTTPS
path: /
port: 8443
initialDelaySeconds: 30
timeoutSeconds: 30
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsUser: 1001
runAsGroup: 2001
volumes:
- name: kubernetes-dashboard-certs
secret:
secretName: kubernetes-dashboard-certs
- name: tmp-volume
emptyDir: {}
serviceAccountName: kubernetes-dashboard
nodeSelector:
"beta.kubernetes.io/os": linux
# Comment the following tolerations if Dashboard must not be deployed on master
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
---
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: dashboard-metrics-scraper
name: dashboard-metrics-scraper
namespace: kubernetes-dashboard
spec:
ports:
- port: 8000
targetPort: 8000
selector:
k8s-app: dashboard-metrics-scraper
---
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
k8s-app: dashboard-metrics-scraper
name: dashboard-metrics-scraper
namespace: kubernetes-dashboard
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: dashboard-metrics-scraper
template:
metadata:
labels:
k8s-app: dashboard-metrics-scraper
annotations:
seccomp.security.alpha.kubernetes.io/pod: 'runtime/default'
spec:
containers:
- name: dashboard-metrics-scraper
image: kubernetesui/metrics-scraper:v1.0.3
ports:
- containerPort: 8000
protocol: TCP
livenessProbe:
httpGet:
scheme: HTTP
path: /
port: 8000
initialDelaySeconds: 30
timeoutSeconds: 30
volumeMounts:
- mountPath: /tmp
name: tmp-volume
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsUser: 1001
runAsGroup: 2001
serviceAccountName: kubernetes-dashboard
nodeSelector:
"beta.kubernetes.io/os": linux
# Comment the following tolerations if Dashboard must not be deployed on master
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
volumes:
- name: tmp-volume
emptyDir: {}
......@@ -4,7 +4,7 @@ metadata:
labels:
app: NAME
name: NAME
namespace: application
namespace: default
spec:
selector:
matchLabels:
......
......@@ -4,7 +4,7 @@ metadata:
labels:
app: NAME
name: NAME
namespace: application
namespace: default
spec:
type: NodePort
ports:
......
......@@ -33,8 +33,8 @@ def create_service_definition(docker_name, docker):
k8s_service['metadata']['labels']['app'] = docker_name
k8s_service['metadata']['name'] = docker_name
docker_ports = docker[docker_name]['properties']['ports'][0].split(':')
k8s_service['spec']['ports'][0]['port'] = docker_ports[1]
k8s_service['spec']['ports'][0]['nodePort'] = docker_ports[0]
k8s_service['spec']['ports'][0]['port'] = int(docker_ports[1])
k8s_service['spec']['ports'][0]['nodePort'] = int(docker_ports[0])
k8s_service['spec']['selector']['app'] = docker_name
# k8s_service = {'apiVersion': 'v1', 'kind': 'Service'}
......@@ -61,7 +61,7 @@ def create_deployment_definition(docker_name, docker):
deployment['spec']['selector']['matchLabels']['app'] = docker_name
deployment['spec']['template']['metadata']['labels']['app'] = docker_name
deployment['spec']['template']['spec']['containers'][0]['image'] = docker[docker_name]['artifacts']['image']['file']
deployment['spec']['template']['spec']['containers'][0]['ports'][0]['containerPort'] = docker_ports[1]
deployment['spec']['template']['spec']['containers'][0]['ports'][0]['containerPort'] = int(docker_ports[1])
deployment['spec']['template']['spec']['containers'][0]['name'] = docker_name
if docker[docker_name]['properties'] and 'environment' in docker[docker_name]['properties']:
env_list = []
......@@ -114,7 +114,7 @@ def get_k8s_definitions(dockers):
def create_pip_task():
pip_task = {'name': 'install kubernetes'}
pip_task = {'name': 'install pip modules'}
modules = ['setuptools', 'kubernetes', 'openshift']
pip = {'name': modules}
pip_task['pip'] = pip
......@@ -142,6 +142,21 @@ def create_namespace_task():
return task
def create_dashboard_task():
task = {'name': 'create dashboard'}
k8s = {'src': '/tmp/recommended.yaml', 'state': 'present'}
task['k8s'] = k8s
return task
def create_download_dashboard_task():
task = {'name': 'Download dashboard'}
get_url = {'url': 'https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc3/aio/deploy/recommended.yaml',
'dest': '/tmp/recommended.yaml'}
task['get_url'] = get_url
return task
def write_ansible_k8s_files(tosca_template_json, tmp_path):
dockers = get_dockers(tosca_template_json)
k8s_definitions = get_k8s_definitions(dockers)
......@@ -152,9 +167,14 @@ def write_ansible_k8s_files(tosca_template_json, tmp_path):
pip_task = create_pip_task()
tasks.append(pip_task)
namespace_task = create_namespace_task()
tasks.append(namespace_task)
# namespace_task = create_namespace_task()
# tasks.append(namespace_task)
download_dashboard_task = create_download_dashboard_task()
tasks.append(download_dashboard_task)
dashboard_task = create_dashboard_task()
tasks.append(dashboard_task)
for services_def in services:
task = create_service_task(i, services_def)
i += 1
......
......@@ -2,6 +2,8 @@ package nl.uva.sne.drip.api;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -10,6 +12,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import javax.servlet.http.HttpServletRequest;
import nl.uva.sne.drip.model.Exceptions.MissingCredentialsException;
import nl.uva.sne.drip.model.Exceptions.TypeExeption;
import nl.uva.sne.drip.service.DRIPService;
import nl.uva.sne.drip.sure.tosca.client.ApiException;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -48,10 +52,7 @@ public class ProvisionerApiController implements ProvisionerApi {
dripService.setRequestQeueName(queueName);
String planedYemplateId = dripService.provision(id);
return new ResponseEntity<>(planedYemplateId, HttpStatus.OK);
} catch (ApiException ex) {
java.util.logging.Logger.getLogger(ProvisionerApiController.class.getName()).log(Level.SEVERE, null, ex);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
} catch (Exception ex) {
} catch (ApiException | MissingCredentialsException | TypeExeption | IOException | TimeoutException | InterruptedException | NotFoundException ex) {
java.util.logging.Logger.getLogger(ProvisionerApiController.class.getName()).log(Level.SEVERE, null, ex);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
......
......@@ -16,8 +16,6 @@ import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.model.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
/*
......
......@@ -15,6 +15,8 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.api.NotFoundException;
import nl.uva.sne.drip.commons.utils.ToscaHelper;
import nl.uva.sne.drip.model.Exceptions.MissingCredentialsException;
import nl.uva.sne.drip.model.Exceptions.TypeExeption;
import nl.uva.sne.drip.model.Message;
import nl.uva.sne.drip.model.NodeTemplateMap;
import nl.uva.sne.drip.model.tosca.Credential;
......@@ -49,31 +51,21 @@ public class DRIPService {
ProvisionerService provisionerService;
private static final String OPERATION_PROVISION = "provision";
private String execute(ToscaTemplate toscaTemplate) throws JsonProcessingException, ApiException, Exception {
try {
caller.init();
Logger.getLogger(DRIPService.class.getName()).log(Level.INFO, "toscaTemplate:\n{0}", toscaTemplate);
Message message = new Message();
message.setOwner("user");
message.setCreationDate(System.currentTimeMillis());
message.setToscaTemplate(toscaTemplate);
caller.setRequestQeueName(requestQeueName);
Message plannerResponse = caller.call(message);
ToscaTemplate plannedToscaTemplate = plannerResponse.getToscaTemplate();
return toscaTemplateService.save(plannedToscaTemplate);
} catch (IOException | TimeoutException | InterruptedException ex) {
Logger.getLogger(DRIPService.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
caller.close();
} catch (IOException | TimeoutException ex) {
Logger.getLogger(DRIPService.class.getName()).log(Level.SEVERE, null, ex);
}
}
return null;
private String execute(ToscaTemplate toscaTemplate) throws JsonProcessingException, ApiException, IOException, TimeoutException, InterruptedException {
caller.init();
Logger.getLogger(DRIPService.class.getName()).log(Level.INFO, "toscaTemplate:\n{0}", toscaTemplate);
Message message = new Message();
message.setOwner("user");
message.setCreationDate(System.currentTimeMillis());
message.setToscaTemplate(toscaTemplate);
caller.setRequestQeueName(requestQeueName);
Message plannerResponse = caller.call(message);
ToscaTemplate plannedToscaTemplate = plannerResponse.getToscaTemplate();
caller.close();
return toscaTemplateService.save(plannedToscaTemplate);
}
/**
......@@ -94,7 +86,7 @@ public class DRIPService {
return credentials.get(0);
}
private ToscaTemplate addCredentials(ToscaTemplate toscaTemplate) throws IOException, JsonProcessingException, ApiException, Exception {
private ToscaTemplate addCredentials(ToscaTemplate toscaTemplate) throws MissingCredentialsException, ApiException, TypeExeption {
List<NodeTemplateMap> vmTopologies = helper.getVMTopologyTemplates();
List<Credential> credentials = null;
for (NodeTemplateMap vmTopologyMap : vmTopologies) {
......@@ -102,7 +94,7 @@ public class DRIPService {
if (needsCredentials(provider)) {
credentials = credentialService.findByProvider(provider);
if (credentials == null || credentials.size() <= 0) {
throw new Exception("Provider: " + provider + " needs credentials but non clould be found");
throw new MissingCredentialsException("Provider: " + provider + " needs credentials but non clould be found");
} else {
Credential credential = getBestCredential(credentials);
vmTopologyMap = helper.setCredentialsInVMTopology(vmTopologyMap, credential);
......@@ -120,14 +112,14 @@ public class DRIPService {
return execute(toscaTemplate);
}
public String provision(String id) throws JsonProcessingException, NotFoundException, IOException, Exception {
public String provision(String id) throws MissingCredentialsException, ApiException, TypeExeption, IOException, JsonProcessingException, TimeoutException, InterruptedException, NotFoundException {
ToscaTemplate toscaTemplate = initExecution(id);
toscaTemplate = addCredentials(toscaTemplate);
toscaTemplate = setProvisionOperation(toscaTemplate, OPERATION_PROVISION);
return execute(toscaTemplate);
}
private ToscaTemplate setProvisionOperation(ToscaTemplate toscaTemplate, String operation) throws IOException, JsonProcessingException, ApiException, Exception {
private ToscaTemplate setProvisionOperation(ToscaTemplate toscaTemplate, String operation) throws IOException, JsonProcessingException, ApiException {
List<NodeTemplateMap> vmTopologies = helper.getVMTopologyTemplates();
for (NodeTemplateMap vmTopologyMap : vmTopologies) {
Map<String, Object> provisionerInterface = helper.getProvisionerInterfaceFromVMTopology(vmTopologyMap);
......@@ -160,10 +152,10 @@ public class DRIPService {
private ToscaTemplate initExecution(String id) throws JsonProcessingException, NotFoundException, IOException, ApiException {
String ymlToscaTemplate = toscaTemplateService.findByID(id);
Logger.getLogger(DRIPService.class.getName()).log(Level.FINE,"Found ToscaTemplate with id: "+id);
Logger.getLogger(DRIPService.class.getName()).log(Level.FINE, "Found ToscaTemplate with id: {0}", id);
ToscaTemplate toscaTemplate = toscaTemplateService.getYaml2ToscaTemplate(ymlToscaTemplate);
helper.uploadToscaTemplate(toscaTemplate);
return toscaTemplate;
}
......
......@@ -100,7 +100,7 @@ public class Consumer extends DefaultConsumer {
private Message handleException(Exception ex) {
Message errorMessage = new Message();
errorMessage.setCreationDate(System.currentTimeMillis());
errorMessage.setExeption(new ApiException(ex));
errorMessage.setException(ex);
return errorMessage;
}
......
PyYAML
wheel==0.33.6
connexion == 2.4.0
python-dateutil == 2.8.0
......
......@@ -87,7 +87,6 @@ def get_tosca_template(tosca_template_dict):
def get_tosca_template_dict_by_id(id):
tosca_template_dict = tosca_templates_db.get(doc_id=int(id))
return tosca_template_dict
......@@ -119,9 +118,6 @@ def save(file):
doc_id = tosca_templates_db.insert(dictionary)
# tosca_templates_db.close()
logger.info("Returning doc_id: " + str(doc_id))
end = time.time()
elapsed = end - start
logger.info("Time elapsed: " + str(elapsed))
return doc_id
# except Exception as e:
# logger.error(str(e))
......
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