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
HelloWorld.cpp
Incomplete.cpp
Chaining.cpp
ChainingAsync.cpp
Callback.cpp
Timeout.cpp
Segfault.cpp
......@@ -30,6 +31,7 @@ set(HEADERS
HelloWorld.h
Incomplete.h
Chaining.h
ChainingAsync.h
Callback.h
Timeout.h
Segfault.h
......
......@@ -14,9 +14,9 @@ namespace armarx::skills::provider
{
return SkillDescription{.skillId = armarx::skills::SkillID{.skillName = "Chaining"},
.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.",
.timeout = armarx::core::time::Duration::MilliSeconds(5000)};
.timeout = armarx::core::time::Duration::MilliSeconds(10000)};
}
Skill::MainResult
......@@ -26,12 +26,13 @@ namespace armarx::skills::provider
manager,
skills::SkillID{.providerId = *getSkillId().providerId, .skillName = "Timeout"});
ARMARX_INFO << "CALL PROXY FIRST TIME";
callSubskill(prx);
ARMARX_INFO << "CALL PROXY SECOND TIME";
callSubskill(prx);
ARMARX_INFO << "CALL PROXY THIRD TIME";
callSubskill(prx);
for (int i = 0; i < 25; i++)
{
this->throwIfSkillShouldTerminate();
ARMARX_INFO << "Call subskill number " << i;
callSubskill(prx); // Call the Timeout skill and wait for it to finish
}
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
ARMARX_INFO << "Adding skill ChainingSkill";
addSkillFactory<ChainingSkill>();
// chainingAsync
ARMARX_INFO << "Adding skill ChainingAsyncSkill";
addSkillFactory<ChainingAsyncSkill>();
// incomplete and prepare
ARMARX_INFO << "Adding skill IncompleteSkill";
addSkillFactory<IncompleteSkill>();
......
......@@ -31,6 +31,7 @@
#include "Callback.h"
#include "Chaining.h"
#include "ChainingAsync.h"
#include "HelloWorld.h"
#include "Incomplete.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