|
@@ -45,7 +45,7 @@ public:
|
|
|
return shared_models_;
|
|
|
}
|
|
|
|
|
|
- void start_pipelines()
|
|
|
+ void start_all_pipelines()
|
|
|
{
|
|
|
for (auto& instance : configured_pipelines_)
|
|
|
{
|
|
@@ -60,7 +60,7 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void stop_pipelines()
|
|
|
+ void stop_all_pipelines()
|
|
|
{
|
|
|
for (auto& instance : configured_pipelines_)
|
|
|
{
|
|
@@ -75,6 +75,70 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ void start_pipelines_by_id(std::string pipeline_id)
|
|
|
+ {
|
|
|
+ auto instance = std::find_if(configured_pipelines_.begin(), configured_pipelines_.end(),
|
|
|
+ [&pipeline_id](const PipelineInstance& instance) { return instance.pipeline_id == pipeline_id; });
|
|
|
+ if (instance == configured_pipelines_.end())
|
|
|
+ {
|
|
|
+ std::cerr << "Pipeline with ID " << pipeline_id << " not found." << std::endl;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ std::cout << "Starting pipeline: " << instance->pipeline_id << std::endl;
|
|
|
+ // Start the pipeline by starting all nodes in reverse order
|
|
|
+ for (auto it = instance->nodes.rbegin(); it != instance->nodes.rend(); ++it)
|
|
|
+ {
|
|
|
+ (*it)->start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void stop_pipelines_by_id(std::string pipeline_id)
|
|
|
+ {
|
|
|
+ auto instance = std::find_if(configured_pipelines_.begin(), configured_pipelines_.end(),
|
|
|
+ [&pipeline_id](const PipelineInstance& instance) { return instance.pipeline_id == pipeline_id; });
|
|
|
+ if (instance == configured_pipelines_.end())
|
|
|
+ {
|
|
|
+ std::cerr << "Pipeline with ID " << pipeline_id << " not found." << std::endl;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ std::cout << "Stopping pipeline: " << instance->pipeline_id << std::endl;
|
|
|
+ // Stop the pipeline by stopping all nodes
|
|
|
+ for (const auto& node : instance->nodes)
|
|
|
+ {
|
|
|
+ node->stop();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void show_all_pipeline()
|
|
|
+ {
|
|
|
+ for (const auto& pipeline : configured_pipelines_)
|
|
|
+ {
|
|
|
+ printf("Pipeline ID: %s\nDescription: %s\n", pipeline.pipeline_id.c_str(), pipeline.description.c_str());
|
|
|
+ for (const auto& node : instance->nodes)
|
|
|
+ {
|
|
|
+ printf("%s --> ", node->get_name().c_str());
|
|
|
+ }
|
|
|
+ printf("\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void show_pipeline_by_id(std::string pipeline_id)
|
|
|
+ {
|
|
|
+ auto instance = std::find_if(configured_pipelines_.begin(), configured_pipelines_.end(),
|
|
|
+ [&pipeline_id](const PipelineInstance& instance) { return instance.pipeline_id == pipeline_id; });
|
|
|
+ if (instance == configured_pipelines_.end())
|
|
|
+ {
|
|
|
+ std::cerr << "Pipeline with ID " << pipeline_id << " not found." << std::endl;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ printf("Pipeline ID: %s\nDescription: %s\n", pipeline.pipeline_id.c_str(), pipeline.description.c_str());
|
|
|
+ for (const auto& node : instance->nodes)
|
|
|
+ {
|
|
|
+ printf("%s --> ", node->get_name().c_str());
|
|
|
+ }
|
|
|
+ printf("\n");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
void create_from_json(const std::string& json_path);
|
|
|
|