Skip to content
Snippets Groups Projects
Commit 759a3a44 authored by Fabian Tërnava's avatar Fabian Tërnava
Browse files

call timeout more times in chaining

add chainingAsync skill to test async calling of skills
parent 206a0860
No related branches found
No related tags found
1 merge request!489fix skillmanager and provider deadlocks when callingSubskills, query executionsatus and descriptions and stopping subskills at the same time
Pipeline #21254 failed
...@@ -16,6 +16,7 @@ set(SOURCES ...@@ -16,6 +16,7 @@ set(SOURCES
HelloWorld.cpp HelloWorld.cpp
Incomplete.cpp Incomplete.cpp
Chaining.cpp Chaining.cpp
ChainingAsync.cpp
Callback.cpp Callback.cpp
Timeout.cpp Timeout.cpp
Segfault.cpp Segfault.cpp
...@@ -30,6 +31,7 @@ set(HEADERS ...@@ -30,6 +31,7 @@ set(HEADERS
HelloWorld.h HelloWorld.h
Incomplete.h Incomplete.h
Chaining.h Chaining.h
ChainingAsync.h
Callback.h Callback.h
Timeout.h Timeout.h
Segfault.h Segfault.h
......
...@@ -14,9 +14,9 @@ namespace armarx::skills::provider ...@@ -14,9 +14,9 @@ namespace armarx::skills::provider
{ {
return SkillDescription{.skillId = armarx::skills::SkillID{.skillName = "Chaining"}, return SkillDescription{.skillId = armarx::skills::SkillID{.skillName = "Chaining"},
.description = .description =
"This skill calls the Timeout skill three times. The last " "This skill calls the Timeout skill several times. At some point the "
"execution is aborted due to a timeout of this skill.", "execution is aborted due to a timeout of this skill.",
.timeout = armarx::core::time::Duration::MilliSeconds(5000)}; .timeout = armarx::core::time::Duration::MilliSeconds(10000)};
} }
Skill::MainResult Skill::MainResult
...@@ -26,12 +26,13 @@ namespace armarx::skills::provider ...@@ -26,12 +26,13 @@ namespace armarx::skills::provider
manager, manager,
skills::SkillID{.providerId = *getSkillId().providerId, .skillName = "Timeout"}); skills::SkillID{.providerId = *getSkillId().providerId, .skillName = "Timeout"});
ARMARX_INFO << "CALL PROXY FIRST TIME"; for (int i = 0; i < 25; i++)
callSubskill(prx); {
ARMARX_INFO << "CALL PROXY SECOND TIME"; this->throwIfSkillShouldTerminate();
callSubskill(prx);
ARMARX_INFO << "CALL PROXY THIRD TIME"; ARMARX_INFO << "Call subskill number " << i;
callSubskill(prx); callSubskill(prx); // Call the Timeout skill and wait for it to finish
}
this->throwIfSkillShouldTerminate(); this->throwIfSkillShouldTerminate();
......
#include "ChainingAsync.h"
namespace armarx::skills::provider
{
ChainingAsyncSkill::ChainingAsyncSkill() : SimpleSkill(GetSkillDescription())
{
}
SkillDescription
ChainingAsyncSkill::GetSkillDescription()
{
return SkillDescription{.skillId = armarx::skills::SkillID{.skillName = "ChainingAsync"},
.description =
"This skill calls the Timeout skill several times async.",
.timeout = armarx::core::time::Duration::MilliSeconds(5000)};
}
Skill::MainResult
ChainingAsyncSkill::main(const MainInput& in)
{
SkillProxy prx(
manager,
skills::SkillID{.providerId = *getSkillId().providerId, .skillName = "Timeout"});
for (int i = 0; i < 25; i++)
{
this->throwIfSkillShouldTerminate();
ARMARX_INFO << "Call subskill number " << i;
callSubskillAsync(prx); // Call the Timeout skill
}
this->throwIfSkillShouldTerminate();
return {TerminatedSkillStatus::Succeeded, nullptr};
}
} // namespace armarx::skills::provider
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Fabian Reister ( fabian dot reister at kit dot edu )
* @date 2021
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
// RobotAPI
#include <RobotAPI/libraries/skills/provider/SimpleSkill.h>
namespace armarx::skills::provider
{
class ChainingAsyncSkill : public SimpleSkill
{
public:
ChainingAsyncSkill();
static SkillDescription GetSkillDescription();
private:
Skill::MainResult main(const MainInput&) final;
};
} // namespace armarx::skills::provider
...@@ -54,6 +54,10 @@ namespace armarx::skills::provider ...@@ -54,6 +54,10 @@ namespace armarx::skills::provider
ARMARX_INFO << "Adding skill ChainingSkill"; ARMARX_INFO << "Adding skill ChainingSkill";
addSkillFactory<ChainingSkill>(); addSkillFactory<ChainingSkill>();
// chainingAsync
ARMARX_INFO << "Adding skill ChainingAsyncSkill";
addSkillFactory<ChainingAsyncSkill>();
// incomplete and prepare // incomplete and prepare
ARMARX_INFO << "Adding skill IncompleteSkill"; ARMARX_INFO << "Adding skill IncompleteSkill";
addSkillFactory<IncompleteSkill>(); addSkillFactory<IncompleteSkill>();
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "Callback.h" #include "Callback.h"
#include "Chaining.h" #include "Chaining.h"
#include "ChainingAsync.h"
#include "HelloWorld.h" #include "HelloWorld.h"
#include "Incomplete.h" #include "Incomplete.h"
#include "Segfault.h" #include "Segfault.h"
......
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