2021-02-17 20:07:49 +01:00
|
|
|
#include "logger.h"
|
2021-02-17 22:25:03 +01:00
|
|
|
#include "module.h"
|
|
|
|
|
#include "pipeline.h"
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
#include "nlohmann/json.hpp"
|
|
|
|
|
#include <fstream>
|
2021-02-22 18:23:31 +01:00
|
|
|
#include "processing.h"
|
2021-02-17 20:07:49 +01:00
|
|
|
|
2021-02-18 20:42:08 +01:00
|
|
|
bool processing = false;
|
|
|
|
|
|
|
|
|
|
void process(std::string downlink_pipeline,
|
|
|
|
|
std::string input_level,
|
|
|
|
|
std::string input_file,
|
|
|
|
|
std::string output_level,
|
|
|
|
|
std::string output_file,
|
|
|
|
|
std::map<std::string, std::string> parameters)
|
2021-02-17 21:50:36 +01:00
|
|
|
{
|
2021-02-18 20:42:08 +01:00
|
|
|
processing = true;
|
2021-02-17 20:07:49 +01:00
|
|
|
|
2021-02-17 22:25:03 +01:00
|
|
|
logger->info("Starting processing pipeline " + downlink_pipeline + "...");
|
|
|
|
|
logger->debug("Input file (" + input_level + ") : " + input_file);
|
|
|
|
|
logger->debug("Output file (" + output_level + ") : " + output_file);
|
2021-02-17 20:07:49 +01:00
|
|
|
|
2021-02-17 22:25:03 +01:00
|
|
|
if (!std::filesystem::exists(output_file))
|
|
|
|
|
std::filesystem::create_directory(output_file);
|
|
|
|
|
|
|
|
|
|
std::vector<Pipeline>::iterator it = std::find_if(pipelines.begin(),
|
|
|
|
|
pipelines.end(),
|
|
|
|
|
[&downlink_pipeline](const Pipeline &e) {
|
|
|
|
|
return e.name == downlink_pipeline;
|
|
|
|
|
});
|
2021-02-17 20:07:49 +01:00
|
|
|
|
2021-02-17 22:25:03 +01:00
|
|
|
if (it != pipelines.end())
|
|
|
|
|
{
|
|
|
|
|
it->run(input_file, output_file, parameters, input_level, true, uiCallList, uiCallListMutex);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
logger->critical("Pipeline " + downlink_pipeline + " does not exist!");
|
|
|
|
|
}
|
2021-02-17 20:07:49 +01:00
|
|
|
|
2021-02-17 22:25:03 +01:00
|
|
|
logger->info("Done! Goodbye");
|
2021-02-18 20:42:08 +01:00
|
|
|
processing = false;
|
2021-02-17 20:07:49 +01:00
|
|
|
}
|