Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty pipeline error when no filter #1409

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/libs/ascent/runtimes/ascent_main_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,11 @@ AscentRuntime::ConvertPipelineToFlow(const conduit::Node &pipeline,

const std::vector<std::string> &child_names = pipeline.child_names();

if(child_names.empty())
{
ASCENT_ERROR("Pipeline " << pipeline_name << " empty. Must specify a filter.");
}

for(int i = 0; i < pipeline.number_of_children(); ++i)
{
const std::string cname = child_names[i];
Expand Down
43 changes: 43 additions & 0 deletions src/tests/ascent/t_ascent_ascent_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,46 @@ TEST(ascent_pipeline, test_register_transform)
EXPECT_TRUE(check_test_image(output_file));
}

TEST(ascent_pipeline, test_empty_pipeline_filter)
{
Ascent ascent;
Node ascent_opts;
ascent_opts["exceptions"] = "forward";
ascent.open(ascent_opts);

// Initialize a pipeline and then remove the filter. This is what we are testing and should cause an error.
conduit::Node pipelines;
pipelines["pl1/f1/type"] = "garbage";
pipelines.remove("pl1/f1");

conduit::Node scenes;
scenes["s1/plots/p1/type"] = "pseudocolor";
scenes["s1/plots/p1/field"] = "pl";
scenes["s1/plots/p1/pipeline"] = "pl1";

conduit::Node actions;
// add the pipeline
conduit::Node &add_pipelines= actions.append();
add_pipelines["action"] = "add_pipelines";
add_pipelines["pipelines"] = pipelines;
// add the scenes
conduit::Node &add_scenes= actions.append();
add_scenes["action"] = "add_scenes";
add_scenes["scenes"] = scenes;
// Save info
conduit::Node &save_info= actions.append();
save_info["action"] = "save_info";

bool error_message = false;

try
{
ascent.execute(actions);
}
catch (conduit::Error e)
{
error_message = e.message().find("Pipeline pl1 empty")!=std::string::npos;
}

EXPECT_TRUE(error_message);
}