Skip to content

Commit

Permalink
Fix: Reexecuting a metric starts with clean values
Browse files Browse the repository at this point in the history
Refactor: Added additional logging and error handling
Refactor: Renamed Adapters to modules for better understanding of the project structure
  • Loading branch information
bigbasti committed Nov 21, 2017
1 parent 686f268 commit 372c5fb
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 249 deletions.
7 changes: 0 additions & 7 deletions coria-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@
<artifactId>gs-ui</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -180,9 +175,7 @@
</goals>
<configuration>
<includeGroupIds>${project.groupId}</includeGroupIds>
<!--<includeArtifactIds>coria-metric-python-nx</includeArtifactIds>-->
<excludeTransitive>true</excludeTransitive>
<!--<overWrite>true</overWrite>-->
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<excludes>com/**,META-INF/**,rebel.xml</excludes>
<overWriteReleases>true</overWriteReleases>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.nio.file.FileSystemNotFoundException;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Future;
Expand Down Expand Up @@ -135,7 +136,13 @@ Future<ResponseEntity> startMetricExecution(@RequestParam("identification") Stri
logger.debug("metricModule execution {} finished for {}", metricid, datasetid);
} catch (Exception e) {
//something went wrong while executing the metricModule
setMetricInfoToFailed(storage, mInfo, e.getMessage());
if(e instanceof FileSystemNotFoundException){
//this usually happens when the module resources were not copied into coria-api resources
//if this is the case please perform a maven install on the root project
setMetricInfoToFailed(storage, mInfo, "Could not find required file resource for metric execution. Please contact your system administrator and check if all resources are in place.");
}else {
setMetricInfoToFailed(storage, mInfo, e.getMessage());
}
e.printStackTrace();
}
return new AsyncResult<>(ResponseEntity.ok(null));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div class="page-header">
<h1>Datasets <small>Upload new Dataset</small></h1>
<h1>Datasets <small>Export</small></h1>
</div>
<div class="row">
<div class="col-md-4">
<div class="alert alert-danger" role="alert" ng-show="$ctrl.export.errorMessage">{{$ctrl.export.errorMessage}}</div>
<form name="import" id="import" ng-submit="$ctrl.submitExport()">
<div class="form-group">
<label for="export.providers">Select Export Adapter</label>
<label for="export.providers">Select Export Module</label>
<select class="form-control" ng-model="$ctrl.export.provider" id="export.providers" ng-change="$ctrl.exportProviderSelected()">
<option ng-repeat="provider in $ctrl.exportProviders" value="{{provider.identification}}">{{provider.name}}</option>
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ angular.module('coria.components')

var vm = this;
vm.datasets = [];
vm.selectedProvider = {name:"<= Select Export Adapter"};
vm.selectedProvider = {name:"<= Select Export Module"};
vm.exportProviders = modulesService.queryExportModules();
dataSetService.shortDataSets().then(function(data){
vm.datasets = data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h1>Datasets <small>Upload new Dataset</small></h1>
<div class="alert alert-danger" role="alert" ng-show="$ctrl.import.errorMessage">{{$ctrl.import.errorMessage}}</div>
<form name="import" id="import" ng-submit="$ctrl.submitImport()">
<div class="form-group">
<label for="import.providers">Select Import Parser</label>
<label for="import.providers">Select Import Module</label>
<select class="form-control" ng-model="$ctrl.import.provider" id="import.providers" ng-change="$ctrl.importProviderSelected()">
<option ng-repeat="provider in $ctrl.inputProviders" value="{{provider.identification}}">{{provider.name}}</option>
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ angular.module('coria.components')
function( $scope, modulesService, dataSetService){

var vm = this;
vm.selectedProvider = {name:"<= Select Import Parser"};
vm.selectedProvider = {name:"<= Select Import Module"};
vm.inputProviders = modulesService.queryImportModules();

vm.import = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,5 @@ angular.module('coria.components')
vm.exportModules = modulesService.queryExportModules();
vm.metricModules = modulesService.queryMetricModules();
vm.storageModules = modulesService.queryStorageModules();

vm.datasets = [];
vm.datasetsPerPage = 15;
dataSetService.shortDataSets().then(function(data){
vm.datasets = data;
}, function(error){
console.dir(error);
vm.errorOccured = error.data.error;
});

vm.openDataset = function openDataset(ds){
$location.path("datasets/" + ds.id);
};

vm.deleteDataset = function deleteDataset(dataset){
$ngConfirm({
title: "Delete Dataset",
content: "<strong>Do yoou really want to delete the dataset?</strong><br/>This will also delete all its data including nodes, edges and all calculated metrics!",
buttons: {
yes: {
text: 'Yes',
btnClass: 'btn-blue',
keys: ['enter', 'y'],
action: function(scope, button){
dataSetService.deleteDataset(dataset.id).then(function() {
$route.reload();
});
}
},
no: {
text: 'No',
keys: ['esc', 'n'],
action: function(scope, button){

}
}
}
});
};
}]
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,9 @@
*/
public interface StorageModule {
String getIdentification();

String getName();

String getDescription();

CoriaEdge getEdge(String id);
@Transient
List<CoriaEdge> getEdges();
List<CoriaEdge> getEdges(String orderby, String ordertype);
List<CoriaEdge> getEdges(Long from, Long to, String orderBy, String orderType);
void updateEdge(CoriaEdge edge);
void deleteEdge(CoriaEdge edge);
void deleteEdge(String id);

CoriaNode getNode(String id);
@Transient
List<CoriaNode> getNodes();
List<CoriaNode> getNodes(String orderby, String ordertype);
List<CoriaEdge> getNodes(Long from, Long to, String orderBy, String orderType);
void updateNode(CoriaNode node);
void deleteNode(CoriaNode node);
void deleteNode(String id);

MetricInfo getMetricInfo(String id);
@Transient
List<MetricInfo> getMetricInfos();
List<MetricInfo> getMetricInfos(String datasetId);
Expand All @@ -61,7 +40,7 @@ public interface StorageModule {
void deleteDataSet(String id);

/**
* returns current storage status (wether it is available) and provides an
* returns current storage status (whether it is available) and provides an
* error message in case its not
* @return Status of storage
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ public boolean startSyncSystemProcess(String params){
int exitValue = startProcessAndWait(params);

Instant ends = Instant.now();
logger.debug("python execution finished ({})", Duration.between(starts, ends));
logger.debug("process execution finished ({})", Duration.between(starts, ends));

if (exitValue != 0) {
//something happened -> do something
logger.debug("python exit code: {}", exitValue);
logger.debug("process exit code: {}", exitValue);
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,81 +90,6 @@ public String getDescription() {
return "Connects CORIA to the MySQL Storage, the access configuration needs to be setup in the application.properties";
}

@Override
public CoriaEdge getEdge(String id) {
return null;
}

@Override
public List<CoriaEdge> getEdges() {
return null;
}

@Override
public List<CoriaEdge> getEdges(String orderby, String ordertype) {
return null;
}

@Override
public List<CoriaEdge> getEdges(Long from, Long to, String orderBy, String orderType) {
return null;
}

@Override
public void updateEdge(CoriaEdge edge) {

}

@Override
public void deleteEdge(CoriaEdge edge) {

}

@Override
public void deleteEdge(String id) {

}

@Override
public CoriaNode getNode(String id) {
return null;
}

@Override
public List<CoriaNode> getNodes() {
return null;
}

@Override
public List<CoriaNode> getNodes(String orderby, String ordertype) {
return null;
}

@Override
public List<CoriaEdge> getNodes(Long from, Long to, String orderBy, String orderType) {
return null;
}

@Override
public void updateNode(CoriaNode node) {

}

@Override
public void deleteNode(CoriaNode node) {

}

@Override
public void deleteNode(String id) {

}

@Override
public MetricInfo getMetricInfo(String id) {
return null;
}

@Override
public List<MetricInfo> getMetricInfos() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,81 +78,6 @@ public String getDescription() {
return "Connects CORIA to the Redis Storage, the access configuration needs to be setup in the application.properties";
}

@Override
public CoriaEdge getEdge(String id) {
return null;
}

@Override
public List<CoriaEdge> getEdges() {
return null;
}

@Override
public List<CoriaEdge> getEdges(String orderby, String ordertype) {
return null;
}

@Override
public List<CoriaEdge> getEdges(Long from, Long to, String orderBy, String orderType) {
return null;
}

@Override
public void updateEdge(CoriaEdge edge) {

}

@Override
public void deleteEdge(CoriaEdge edge) {

}

@Override
public void deleteEdge(String id) {

}

@Override
public CoriaNode getNode(String id) {
return null;
}

@Override
public List<CoriaNode> getNodes() {
return null;
}

@Override
public List<CoriaNode> getNodes(String orderby, String ordertype) {
return null;
}

@Override
public List<CoriaEdge> getNodes(Long from, Long to, String orderBy, String orderType) {
return null;
}

@Override
public void updateNode(CoriaNode node) {

}

@Override
public void deleteNode(CoriaNode node) {

}

@Override
public void deleteNode(String id) {

}

@Override
public MetricInfo getMetricInfo(String id) {
return null;
}

@Override
public List<MetricInfo> getMetricInfos() {
logger.debug("loading metric infos");
Expand Down Expand Up @@ -201,18 +126,6 @@ public String updateMetricInfo(MetricInfo metricInfo) {
RList<MetricInfo> dbMInfos = getClient().getList("minfos#" + ds.getId());
for(MetricInfo mi : dbMInfos){
if(mi.getId().equals(metricInfo.getId())){
// MetricInfo updated = new MetricInfo();
// updated.setId(metricInfo.getId());
// updated.setExecutionStarted(metricInfo.getExecutionStarted());
// updated.setExecutionFinished(metricInfo.getExecutionFinished());
// updated.setMessage(metricInfo.getMessage());
// updated.setName(metricInfo.getName());
// updated.setProvider(metricInfo.getProvider());
// updated.setShortcut(metricInfo.getShortcut());
// updated.setTechnology(metricInfo.getTechnology());
// updated.setType(metricInfo.getType());
// updated.setValue(metricInfo.getValue());
// updated.setStatus(metricInfo.getStatus());
dbMInfos.remove(mi);
dbMInfos.add(metricInfo);
break;
Expand Down Expand Up @@ -322,9 +235,6 @@ public List<DataSet> getDataSets() {

@Override
public List<DataSet> getDataSetsShort() {
// RKeys keys = getClient().getKeys();
// Iterable<String> dataSets = keys.getKeysByPattern("dataset*");

RList<DataSet> dataSets = getClient().getList("datasets");
return dataSets.readAll();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public String getIdentification() {

@Override
public String getName() {
return "CORIA DataSet Export Adapter";
return "CORIA DataSet Export Module";
}

@Override
public String getDescription() {
return "<p><strong>This export adapter exports a whole DataSet including its name and all meta information inside it</strong></p>" +
return "<p><strong>This export module exports a whole DataSet including its name and all meta information inside it</strong></p>" +
"<p>The exportet data can be in <code>XML</code> or <code>JSON</code> format. You can choose the format in the input field named 'format' on the left. (If it is left blank or an unsupported value is entered JSON format will be used)</p>" +
"<p>This format is designed to be used to transfer a dataset between different instances of CORIA</p>" +
"<p><strong>NOTE:</strong> Although the data is extracted, the internal IDs of the objects will not be exported. They will be regenerated while importing the DataSet</p>";
Expand Down
Loading

0 comments on commit 372c5fb

Please sign in to comment.