Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 11f3b8b9 authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

Finish checkbox and functionality for meta data, closes #201

parent 35d24511
Pipeline #85047 canceled with stages
......@@ -61,7 +61,7 @@
}
} ],
"isTimestamped" : true,
"writeMetaData" : false
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.osm.OptimalStepsModel",
......
......@@ -61,7 +61,7 @@
}
} ],
"isTimestamped" : true,
"writeMetaData" : false
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.osm.OptimalStepsModel",
......
......@@ -227,7 +227,6 @@ public class Simulation {
processorManager.update(this.simulationState);
}
for (PassiveCallback c : passiveCallbacks) {
c.postUpdate(simTimeInSec);
}
......
......@@ -47,7 +47,7 @@ public class DataProcessingJsonManager {
private static final String PROCESSORID_KEY = "id";
private static final String ATTRIBUTESTYPE_KEY = "attributesType";
private static final String TIMESTAMP_KEY = "isTimestamped";
private static final String WRITEMETA_KEY = "writeMetaData";
private static final String WRITEMETA_KEY = "isWriteMetaData";
public static ObjectWriter writer;
private static ObjectMapper mapper;
......@@ -61,13 +61,13 @@ public class DataProcessingJsonManager {
private List<OutputFile<?>> outputFiles;
private List<DataProcessor<?, ?>> dataProcessors;
private boolean isTimestamped;
private boolean writeMetaData;
private boolean isWriteMetaData;
public DataProcessingJsonManager() {
this.outputFiles = new ArrayList<>();
this.dataProcessors = new ArrayList<>();
this.isTimestamped = true;
this.writeMetaData = false;
this.isWriteMetaData = false;
this.outputFileFactory = OutputFileFactory.instance();
this.processorFactory = DataProcessorFactory.instance();
}
......@@ -242,15 +242,15 @@ public class DataProcessingJsonManager {
}
public boolean isWriteMetaData(){
return this.writeMetaData;
return this.isWriteMetaData;
}
public void setTimestamped(boolean isTimestamped) {
this.isTimestamped = isTimestamped;
}
public void setWriteMetaData(boolean writeMetaData){
this.writeMetaData = writeMetaData;
public void setWriteMetaData(boolean isWriteMetaData){
this.isWriteMetaData = isWriteMetaData;
}
public String serialize() throws JsonProcessingException {
......@@ -276,13 +276,20 @@ public class DataProcessingJsonManager {
// part 3: timestamp + write meta data option
main.put(TIMESTAMP_KEY, this.isTimestamped);
main.put(WRITEMETA_KEY, this.writeMetaData);
main.put(WRITEMETA_KEY, this.isWriteMetaData);
return main;
}
public ProcessorManager createProcessorManager(MainModel mainModel) {
// this function is called when the simulation starts running
for (OutputFile f : outputFiles) {
f.setWriteMetaData(isWriteMetaData()); // allow to write meta data
}
return new ProcessorManager(dataProcessors, outputFiles, mainModel);
}
public int getMaxProcessorsId() {
......
......@@ -51,6 +51,7 @@ public abstract class OutputFile<K extends DataKey<K>> {
private List<Integer> processorIds;
private List<DataProcessor<K, ?>> dataProcessors;
private boolean isAddedProcessors;
private boolean isWriteMetaData;
private String separator;
private final static String nameConflictAdd = "-Proc?"; // the # is replaced with the processor id
......@@ -60,6 +61,7 @@ public abstract class OutputFile<K extends DataKey<K>> {
protected OutputFile(final String... dataIndices) {
this.dataIndices = dataIndices;
this.isAddedProcessors = false; // init method has to be called
this.isWriteMetaData = false;
this.dataProcessors = new ArrayList<>();
this.writerFactory = VadereWriterFactory.getFileWriterFactory();
}
......@@ -68,6 +70,10 @@ public abstract class OutputFile<K extends DataKey<K>> {
this.absoluteFileName = fileName;
}
public void setWriteMetaData(boolean isWriteMetaData){
this.isWriteMetaData = isWriteMetaData;
}
public void setRelativeFileName(final String fileName) {
this.fileName = fileName;
}
......@@ -96,6 +102,11 @@ public abstract class OutputFile<K extends DataKey<K>> {
try (VadereWriter out = writerFactory.create(absoluteFileName)) {
writer = out;
if(this.isWriteMetaData){
printMetaData(out);
}
printHeader(out);
this.dataProcessors.stream().flatMap(p -> p.getKeys().stream())
......@@ -117,6 +128,16 @@ public abstract class OutputFile<K extends DataKey<K>> {
writeLine(out, this.getEntireHeader());
}
private void printMetaData(VadereWriter out){
String md = "//ROW=" + dataIndices.length + ",COL="+getEntireHeader().size(); // leave Java-style comment also for output
//Make a list with element to reuse writeLine function
List<String> line = new LinkedList<>();
line.add(md);
writeLine(out, line);
}
private List<String> getIndices(){
return new LinkedList<>(Arrays.asList(dataIndices));
}
......
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