Skip to content
Snippets Groups Projects
Commit 54c52ef5 authored by Timo Birr's avatar Timo Birr :rage:
Browse files

Merge branch 'feature/skill-manager-stop-all' into 'master'

Feature/skill manager stop all

See merge request !496
parents db1c599c 1056cfeb
No related branches found
No related tags found
1 merge request!496Feature/skill manager stop all
Pipeline #22305 failed
......@@ -92,6 +92,8 @@ module armarx
module dti
{
sequence<provider::dto::AbortSkillResult> AbortSkillResultList;
interface SkillManagerInterface extends
callback::dti::SkillProviderCallbackInterface
{
......@@ -127,8 +129,10 @@ module armarx
// notify a skill to stop ASAP.
provider::dto::AbortSkillResult abortSkill(dto::SkillExecutionID executionId);
provider::dto::AbortSkillResult abortSkillAsync(
dto::SkillExecutionID executionId);
provider::dto::AbortSkillResult abortSkillAsync(dto::SkillExecutionID executionId);
// notify all skills directly via ice interface instead of ugly workarounds in both c++ and python
AbortSkillResultList abortAllSkills();
AbortSkillResultList abortAllSkillsAsync();
};
}
}
......
......@@ -674,6 +674,71 @@ namespace armarx
return ret;
}
std::vector<skills::provider::dto::AbortSkillResult> SkillManagerComponentPluginUser::abortAllSkills(const Ice::Current &current)
{
ARMARX_IMPORTANT << "Stopping all running executions.";
std::vector<skills::provider::dto::AbortSkillResult> results;
skills::manager::dto::SkillStatusUpdateMap executions;
// we ALWAYS want the newest information when stopping all!
// e.g. there is some new skill not known to the GUI which we explicitely want to stop too.
// the stop-all function is often used in an emergency, so we'll live with the extra call...
try
{
executions = this->getSkillExecutionStatuses(current);
}
catch (...) // if any error occurs, we use the snapshot as backup. better to miss a skill
// than to not do anything.
{
executions = this->getSkillExecutionStatuses(current);
}
for (auto& [executionId, status] : executions)
{
// select all running executions...
if (status.status != armarx::skills::core::dto::Execution::Aborted and status.status != armarx::skills::core::dto::Execution::Failed)
{
// ... and kill them.
results.push_back(this->abortSkill(executionId, current));
}
}
return results;
}
std::vector<skills::provider::dto::AbortSkillResult> SkillManagerComponentPluginUser::abortAllSkillsAsync(const Ice::Current &current)
{
ARMARX_IMPORTANT << "Stopping all running executions.";
std::vector<skills::provider::dto::AbortSkillResult> results;
skills::manager::dto::SkillStatusUpdateMap executions;
// we ALWAYS want the newest information when stopping all!
// e.g. there is some new skill not known to the GUI which we explicitely want to stop too.
// the stop-all function is often used in an emergency, so we'll live with the extra call...
try
{
executions = this->getSkillExecutionStatuses(current);
}
catch (...) // if any error occurs, we use the snapshot as backup. better to miss a skill
// than to not do anything.
{
executions = this->getSkillExecutionStatuses(current);
}
for (auto& [executionId, status] : executions)
{
// select all running executions...
if (status.status != armarx::skills::core::dto::Execution::Aborted and status.status != armarx::skills::core::dto::Execution::Failed)
{
// ... and kill them.
results.push_back(this->abortSkillAsync(executionId, current));
}
}
return results;
}
void
SkillManagerComponentPluginUser::updateStatusForSkill(
const skills::provider::dto::SkillStatusUpdate& statusUpdate,
......
......@@ -121,6 +121,10 @@ namespace armarx
abortSkillAsync(const skills::manager::dto::SkillExecutionID& id,
const Ice::Current& current) override;
std::vector<skills::provider::dto::AbortSkillResult> abortAllSkills(const Ice::Current& current) override;
std::vector<skills::provider::dto::AbortSkillResult> abortAllSkillsAsync(const Ice::Current& current) override;
skills::manager::dto::SkillDescriptionMap
getSkillDescriptions(const Ice::Current& current) override;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment