MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / handleStart

Method handleStart

cp-profiler/src/cpprofiler/receiver_worker.cpp:90–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void ReceiverWorker::handleStart(const Message &msg)
91{
92
93 /// create new execution
94
95 std::string execution_name = "<no name>";
96 bool has_restarts = false;
97
98 int exec_id = -1;
99
100 if (msg.has_info())
101 {
102
103 auto info_bytes = QByteArray::fromStdString(msg.info());
104 auto json_doc = QJsonDocument::fromJson(info_bytes);
105
106 if (json_doc.isNull() || json_doc.isArray())
107 {
108 print("Warning: start message info is invalid or empty");
109 }
110 else
111 {
112 QJsonObject json_obj = json_doc.object();
113
114 auto name_val = json_obj.value("name");
115
116 if (name_val.isString())
117 {
118 execution_name = name_val.toString().toStdString();
119 }
120
121 auto restarts_val = json_obj.value("has_restarts");
122
123 if (restarts_val.isBool())
124 {
125 has_restarts = restarts_val.toBool();
126 }
127
128 {
129 auto e_id_val = json_obj.value("execution_id");
130 exec_id = e_id_val.toInt();
131 }
132 }
133 }
134
135 print("New execution: (name: {}, exec_id: {}, has restarts: {}", execution_name, exec_id, has_restarts);
136
137 emit notifyStart(execution_name, exec_id, has_restarts); // blocking connection
138}
139
140/// nid, pid, alt, kids are needed during the Tree Construction
141/// after the tree is build, these fields are easier to get from the tree structure

Callers

nothing calls this directly

Calls 4

has_infoMethod · 0.80
printFunction · 0.50
valueMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected