Go to the documentation of this file.
26 #include <nlohmann/json.hpp>
33 const boost::python::dict &globalDict)
40 for(
const auto &fn : config) {
41 auto fileName = fn.get<std::string>();
42 if(std::filesystem::exists(fileName)) {
44 boost::python::exec_file(fileName.c_str(), globalDict, globalDict);
47 catch (boost::python::error_already_set &) {
49 "Loading of computation graph file \"" + fileName +
"\" failed: " +
handle_pyerror());
53 throw NRPException::logCreate(
"Loading of computation graph file \"" + fileName +
"\" failed: the file doesn't exist.");
72 "Exception in the ComputationalGraph: found Node with id 'clock_node', which is reserved for the input Clock node");
74 if(gm.
getNode(
"iteration_node")) {
77 throw NRPException::logCreate(
"Exception in the ComputationalGraph: found Node with id 'iteration_node', which is reserved for the input Iteration node");
80 return std::make_pair(_clock, _iteration);
83 #endif //GRAPH_UTILS_H
void configure()
Configure ComputationalGraph.
Definition: computational_graph_manager.h:132
void createPythonGraphFromConfig(const nlohmann::json &config, const ComputationalGraph::ExecMode &execMode, const boost::python::dict &globalDict)
Definition: graph_utils.h:32
static ComputationalGraphManager & resetInstance()
Reset singleton instance.
Definition: computational_graph_manager.cpp:36
static void info(const FormatString &fmt, const Args &...args)
NRP logging function with message formatting for info level.
Definition: nrp_logger.h:138
static ComputationalGraphManager & getInstance()
Get singleton instance of ComputationalGraphManager.
Definition: computational_graph_manager.cpp:31
ComputationalNode * getNode(const std::string &id)
Retrieve a node from the graph as a pointer.
Definition: computational_graph_manager.h:95
ExecMode
Definition: computational_graph.h:62
static EXCEPTION logCreate(LOG_EXCEPTION_T &exception, const std::string &msg, NRPLogger::spdlog_out_fcn_t spdlogCall=NRPLogger::critical)
Definition: nrp_exceptions.h:73
void setExecMode(ComputationalGraph::ExecMode mode)
Definition: computational_graph_manager.h:160
std::pair< InputClockNode *, InputIterationNode * > findTimeNodes()
Definition: graph_utils.h:61
void graphLoadComplete()
Function to be called externally after all nodes has been added to the graph.
Definition: computational_graph_manager.h:145
std::string handle_pyerror()
Read out a properly formatted Python exception string. Only call if a Python exception was thrown.
Definition: python_error_handler.cpp:27
Singleton class managing a computational graph.
Definition: computational_graph_manager.h:45
nlohmann::json json
Definition: engine_json_server.cpp:31