9 using StatusMap = std::map<skills::SkillExecutionID, skills::SkillStatusUpdate>;
11 std::map<skills::ProviderID, std::map<skills::SkillID, skills::SkillDescription>>;
24 std::scoped_lock l(mutex_memory);
29 auto currentManagerStatuses =
memory->getSkillExecutionStatuses();
32 for (
const auto& [k,
v] : currentManagerStatuses)
38 statusMap[executionId] = statusUpdate;
42 catch (Ice::Exception
const& e)
45 <<
"Unhandled Ice exception encountered while updating executions. Exception was: "
52 ARMARX_WARNING <<
"Unknown exception encountered while updating executions.";
59 matches(std::string skillName, std::vector<std::string>& searches)
62 for (std::string& substring : searches)
64 size_t occurance = skillName.find(substring,
index);
65 if (occurance == std::string::npos)
78 SkillManagerWrapper::filterSkillUpdate(
79 std::map<skills::manager::dto::SkillID, skills::manager::dto::SkillDescription>&
update)
82 if (this->currentSkillSearch.empty())
87 std::vector<std::string> substrings;
91 for (
auto&
string : rawSubstrings)
93 substrings.push_back(simox::alg::to_lower(
string));
122 std::scoped_lock l(mutex_memory);
126 auto managerSkills =
memory->getSkillDescriptions();
128 this->filterSkillUpdate(managerSkills);
131 for (
const auto& [sid, desc] : managerSkills)
135 auto providerId = skillId.providerId.value_or(
140 auto& providedSkillsMap =
skills[providerId];
141 providedSkillsMap.insert({skillId, description});
146 catch (Ice::Exception
const& e)
149 <<
"Unhandled Ice exception encountered while updating skills. Exception was: "
156 ARMARX_WARNING <<
"Unknown exception encountered while updating skills.";
163 skills::manager::dti::SkillManagerInterfacePrx
const& updatedMemory)
165 std::scoped_lock l(mutex_memory);
166 this->
memory = updatedMemory;
174 std::scoped_lock l(mutex_memory);
181 this->currentSkillSearch = search;
189 for (
auto& [executionId,
status] : executions)
192 if (!
status.hasBeenTerminated())
200 const std::optional<ProviderID>
206 ARMARX_WARNING <<
"The memory snapshot was searched for any provider, when a provider "
211 for (
auto& [prov, skillMap] : map)
213 for (
auto& [skill, desc] : skillMap)
215 if (skill == skillId)
226 const unsigned int max_retries)
234 unsigned int retries = max_retries;
242 std::scoped_lock l(mutex_memory);
245 catch (Ice::Exception
const& e)
248 ARMARX_ERROR <<
"Unhandeled Ice exception while aborting skill '"
256 ARMARX_ERROR <<
"Unhandled error while aborting skill '"
266 ARMARX_WARNING <<
"There where errors aborting skills. Retrying...";
270 ARMARX_ERROR <<
"Couldn't abort all skills after " << max_retries
271 <<
" tries. Giving up.";
289 if (!providerId.has_value())
292 <<
"' has been requested to be executed, but no provider was "
293 "given. Aborting...";
297 std::map<skills::SkillID, skills::SkillDescription> skillDescriptions;
299 skillDescriptions = this->
fetchSkills().at(providerId.value());
302 if (skillDescriptions.find(skillId) == skillDescriptions.end())
305 <<
"' has been requested to be executed, but no skill description was "
306 "found. Aborting...";
310 char hostname[HOST_NAME_MAX];
311 gethostname(hostname, HOST_NAME_MAX);
315 .executorName =
"Skills.Manager GUI (hostname: " + std::string(hostname) +
")",
316 .parameters = params};
323 std::scoped_lock l(mutex_memory);
324 memory->executeSkillAsync(req.toManagerIce());
326 catch (Ice::Exception
const& e)
328 ARMARX_ERROR <<
"Unhandeled Ice exception while executing skill '" << skillId.skillName
330 emit
connectionUpdate(
"Execution failed of skill " + skillId.skillName, e.what());
334 ARMARX_ERROR <<
"Unhandled error while executing skill '" << skillId.skillName