mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
SDK: warn if given path translates to no selected tasks
This commit is contained in:
committed by
Dennis Klein
parent
78b1c188bf
commit
5a7dcd9fc1
@@ -65,7 +65,7 @@ void handleCommand(const string& command, const string& path, unsigned int timeo
|
|||||||
cout << d.taskId << " : " << d.state << endl;
|
cout << d.taskId << " : " << d.state << endl;
|
||||||
}
|
}
|
||||||
} else if (command == "o") {
|
} else if (command == "o") {
|
||||||
cout << "> dumping config of the devices (" << path << ")" << endl;
|
cout << "> dumping config of " << (path == "" ? "all" : path) << endl;
|
||||||
// TODO: extend this regex to return all properties, once command size limitation is removed.
|
// TODO: extend this regex to return all properties, once command size limitation is removed.
|
||||||
auto const result = topo.GetProperties("^(session|id)$", path, std::chrono::milliseconds(timeout));
|
auto const result = topo.GetProperties("^(session|id)$", path, std::chrono::milliseconds(timeout));
|
||||||
for (const auto& d : result.second.devices) {
|
for (const auto& d : result.second.devices) {
|
||||||
@@ -79,39 +79,39 @@ void handleCommand(const string& command, const string& path, unsigned int timeo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const DeviceProperties props{{pKey, pVal}};
|
const DeviceProperties props{{pKey, pVal}};
|
||||||
cout << "> sending property (" << path << ")" << endl;
|
cout << "> setting properties --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.SetProperties(props, path);
|
topo.SetProperties(props, path);
|
||||||
// give dds time to complete request
|
// give dds time to complete request
|
||||||
this_thread::sleep_for(chrono::milliseconds(100));
|
this_thread::sleep_for(chrono::milliseconds(100));
|
||||||
} else if (command == "i") {
|
} else if (command == "i") {
|
||||||
cout << "> init devices (" << path << ")" << endl;
|
cout << "> initiating InitDevice transition --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.ChangeState(TopologyTransition::InitDevice, path, std::chrono::milliseconds(timeout));
|
topo.ChangeState(TopologyTransition::InitDevice, path, std::chrono::milliseconds(timeout));
|
||||||
} else if (command == "k") {
|
} else if (command == "k") {
|
||||||
cout << "> complete init (" << path << ")" << endl;
|
cout << "> initiating CompleteInit transition --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.ChangeState(TopologyTransition::CompleteInit, path, std::chrono::milliseconds(timeout));
|
topo.ChangeState(TopologyTransition::CompleteInit, path, std::chrono::milliseconds(timeout));
|
||||||
} else if (command == "b") {
|
} else if (command == "b") {
|
||||||
cout << "> bind devices (" << path << ")" << endl;
|
cout << "> initiating Bind transition --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.ChangeState(TopologyTransition::Bind, path, std::chrono::milliseconds(timeout));
|
topo.ChangeState(TopologyTransition::Bind, path, std::chrono::milliseconds(timeout));
|
||||||
} else if (command == "x") {
|
} else if (command == "x") {
|
||||||
cout << "> connect devices (" << path << ")" << endl;
|
cout << "> initiating Connect transition --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.ChangeState(TopologyTransition::Connect, path, std::chrono::milliseconds(timeout));
|
topo.ChangeState(TopologyTransition::Connect, path, std::chrono::milliseconds(timeout));
|
||||||
} else if (command == "j") {
|
} else if (command == "j") {
|
||||||
cout << "> init tasks (" << path << ")" << endl;
|
cout << "> initiating InitTask transition --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.ChangeState(TopologyTransition::InitTask, path, std::chrono::milliseconds(timeout));
|
topo.ChangeState(TopologyTransition::InitTask, path, std::chrono::milliseconds(timeout));
|
||||||
} else if (command == "r") {
|
} else if (command == "r") {
|
||||||
cout << "> run tasks (" << path << ")" << endl;
|
cout << "> initiating Run transition --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.ChangeState(TopologyTransition::Run, path, std::chrono::milliseconds(timeout));
|
topo.ChangeState(TopologyTransition::Run, path, std::chrono::milliseconds(timeout));
|
||||||
} else if (command == "s") {
|
} else if (command == "s") {
|
||||||
cout << "> stop devices (" << path << ")" << endl;
|
cout << "> initiating Stop transition --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.ChangeState(TopologyTransition::Stop, path, std::chrono::milliseconds(timeout));
|
topo.ChangeState(TopologyTransition::Stop, path, std::chrono::milliseconds(timeout));
|
||||||
} else if (command == "t") {
|
} else if (command == "t") {
|
||||||
cout << "> reset tasks (" << path << ")" << endl;
|
cout << "> initiating ResetTask transition --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.ChangeState(TopologyTransition::ResetTask, path, std::chrono::milliseconds(timeout));
|
topo.ChangeState(TopologyTransition::ResetTask, path, std::chrono::milliseconds(timeout));
|
||||||
} else if (command == "d") {
|
} else if (command == "d") {
|
||||||
cout << "> reset devices (" << path << ")" << endl;
|
cout << "> initiating ResetDevice transition --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.ChangeState(TopologyTransition::ResetDevice, path, std::chrono::milliseconds(timeout));
|
topo.ChangeState(TopologyTransition::ResetDevice, path, std::chrono::milliseconds(timeout));
|
||||||
} else if (command == "q") {
|
} else if (command == "q") {
|
||||||
cout << "> end (" << path << ")" << endl;
|
cout << "> initiating End transition --> " << (path == "" ? "all" : path) << endl;
|
||||||
topo.ChangeState(TopologyTransition::End, path, std::chrono::milliseconds(timeout));
|
topo.ChangeState(TopologyTransition::End, path, std::chrono::milliseconds(timeout));
|
||||||
} else if (command == "h") {
|
} else if (command == "h") {
|
||||||
cout << "> help" << endl;
|
cout << "> help" << endl;
|
||||||
@@ -206,6 +206,7 @@ try {
|
|||||||
sendCommand(command, path, timeout, topo, pKey, pVal);
|
sendCommand(command, path, timeout, topo, pKey, pVal);
|
||||||
}
|
}
|
||||||
size_t pos = targetState.find("->");
|
size_t pos = targetState.find("->");
|
||||||
|
cout << "> waiting for " << (path == "" ? "all" : path) << " to reach " << targetState << endl;
|
||||||
if (pos == string::npos) {
|
if (pos == string::npos) {
|
||||||
/* auto ec = */topo.WaitForState(GetState(targetState), path, std::chrono::milliseconds(timeout));
|
/* auto ec = */topo.WaitForState(GetState(targetState), path, std::chrono::milliseconds(timeout));
|
||||||
// cout << "WaitForState(" << targetState << ") result: " << ec.message() << endl;
|
// cout << "WaitForState(" << targetState << ") result: " << ec.message() << endl;
|
||||||
|
@@ -439,6 +439,9 @@ class BasicTopology : public AsioBase<Executor, Allocator>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (fTasks.empty()) {
|
||||||
|
FAIR_LOG(warn) << "ChangeState initiated on an empty set of tasks, check the path argument.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ChangeStateOp() = delete;
|
ChangeStateOp() = delete;
|
||||||
ChangeStateOp(const ChangeStateOp&) = delete;
|
ChangeStateOp(const ChangeStateOp&) = delete;
|
||||||
@@ -741,6 +744,9 @@ class BasicTopology : public AsioBase<Executor, Allocator>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (fTasks.empty()) {
|
||||||
|
FAIR_LOG(warn) << "WaitForState initiated on an empty set of tasks, check the path argument.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
WaitForStateOp() = delete;
|
WaitForStateOp() = delete;
|
||||||
WaitForStateOp(const WaitForStateOp&) = delete;
|
WaitForStateOp(const WaitForStateOp&) = delete;
|
||||||
@@ -938,6 +944,9 @@ class BasicTopology : public AsioBase<Executor, Allocator>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (expectedCount == 0) {
|
||||||
|
FAIR_LOG(warn) << "GetProperties initiated on an empty set of tasks, check the path argument.";
|
||||||
|
}
|
||||||
// FAIR_LOG(debug) << "GetProperties " << fId << " with expected count of " << fExpectedCount << " started.";
|
// FAIR_LOG(debug) << "GetProperties " << fId << " with expected count of " << fExpectedCount << " started.";
|
||||||
}
|
}
|
||||||
GetPropertiesOp() = delete;
|
GetPropertiesOp() = delete;
|
||||||
@@ -1093,6 +1102,9 @@ class BasicTopology : public AsioBase<Executor, Allocator>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (expectedCount == 0) {
|
||||||
|
FAIR_LOG(warn) << "SetProperties initiated on an empty set of tasks, check the path argument.";
|
||||||
|
}
|
||||||
// FAIR_LOG(debug) << "SetProperties " << fId << " with expected count of " << fExpectedCount << " started.";
|
// FAIR_LOG(debug) << "SetProperties " << fId << " with expected count of " << fExpectedCount << " started.";
|
||||||
}
|
}
|
||||||
SetPropertiesOp() = delete;
|
SetPropertiesOp() = delete;
|
||||||
|
Reference in New Issue
Block a user