Chain-Load: setup simple integration test
- use a chain-load with 64 steps - use a simple topology - trigger test run with default stepping TODO: Test hangs -> Timeout
This commit is contained in:
parent
481e35a597
commit
e761447a25
5 changed files with 112 additions and 40 deletions
|
|
@ -146,7 +146,7 @@ namespace lib {
|
|||
{
|
||||
if (buff_) discard();
|
||||
size_ = cnt;
|
||||
buff_ = cnt? std::aligned_alloc (std::alignment_of<T>(), cnt * sizeof(T))
|
||||
buff_ = cnt? static_cast<T*> (std::aligned_alloc (std::alignment_of<T>(), cnt * sizeof(T)))
|
||||
: nullptr;
|
||||
return buff_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,13 +157,13 @@ namespace gear {
|
|||
ManifestationID manID_{};
|
||||
bool isCompulsory_{false};
|
||||
|
||||
Scheduler& theScheduler_;
|
||||
Scheduler* theScheduler_;
|
||||
std::optional<activity::Term> term_;
|
||||
|
||||
public:
|
||||
ScheduleSpec (Scheduler& sched, Job job)
|
||||
: job_{job}
|
||||
, theScheduler_{sched}
|
||||
, theScheduler_{&sched}
|
||||
, term_{std::nullopt}
|
||||
{ }
|
||||
|
||||
|
|
@ -174,6 +174,13 @@ namespace gear {
|
|||
return move(*this);
|
||||
}
|
||||
|
||||
ScheduleSpec
|
||||
startTime (Time fixedTime)
|
||||
{
|
||||
start_ = fixedTime;
|
||||
return move(*this);
|
||||
}
|
||||
|
||||
ScheduleSpec
|
||||
lifeWindow (microseconds afterStart)
|
||||
{
|
||||
|
|
@ -565,15 +572,14 @@ namespace gear {
|
|||
ScheduleSpec::post()
|
||||
{
|
||||
term_ = move(
|
||||
theScheduler_
|
||||
.activityLang_
|
||||
.buildCalculationJob (job_, start_,death_));
|
||||
theScheduler_->activityLang_
|
||||
.buildCalculationJob (job_, start_,death_));
|
||||
//set up new schedule by retrieving the Activity-chain...
|
||||
theScheduler_.postChain ({term_->post(), start_
|
||||
, death_
|
||||
, manID_
|
||||
, isCompulsory_});
|
||||
theScheduler_.ensureDroppedGroomingToken();
|
||||
theScheduler_->postChain ({term_->post(), start_
|
||||
, death_
|
||||
, manID_
|
||||
, isCompulsory_});
|
||||
theScheduler_->ensureDroppedGroomingToken();
|
||||
return move(*this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
simpleUsage();
|
||||
usageExample();
|
||||
verify_Node();
|
||||
verify_Topology();
|
||||
showcase_Expansion();
|
||||
|
|
@ -93,9 +93,27 @@ namespace test {
|
|||
* @todo WIP 11/23 🔁 define ⟶ 🔁 implement
|
||||
*/
|
||||
void
|
||||
simpleUsage()
|
||||
usageExample()
|
||||
{
|
||||
TestChainLoad testLoad;
|
||||
auto anchor = RealClock::now();
|
||||
auto offset = [&](Time when =RealClock::now()){ return _raw(when) - _raw(anchor); };
|
||||
|
||||
auto testLoad =
|
||||
TestChainLoad{64}
|
||||
.configureShape_simple_short_segments()
|
||||
.buildToplolgy();
|
||||
SHOW_EXPR(offset())
|
||||
|
||||
BlockFlowAlloc bFlow;
|
||||
EngineObserver watch;
|
||||
Scheduler scheduler{bFlow, watch};
|
||||
|
||||
SHOW_EXPR(testLoad.getHash())
|
||||
SHOW_EXPR(offset())
|
||||
testLoad.setupSchedule(scheduler)
|
||||
.launch_and_wait();
|
||||
SHOW_EXPR(offset())
|
||||
SHOW_EXPR(testLoad.getHash())
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ namespace test {
|
|||
}
|
||||
|
||||
|
||||
size_t size() const { return afterNode() - frontNode(); }
|
||||
size_t size() const { return numNodes_; }
|
||||
size_t topLevel() const { return unConst(this)->backNode()->level; }
|
||||
size_t getSeed() const { return unConst(this)->frontNode()->hash; }
|
||||
size_t getHash() const { return unConst(this)->backNode()->hash; } /////////////////////TODO combine hash of all exit nodes
|
||||
|
|
@ -407,6 +407,17 @@ namespace test {
|
|||
: Rule().probability(p2).maxVal(v);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/** preconfigured topology: simple interwoven 3-step graph segments */
|
||||
TestChainLoad&&
|
||||
configureShape_simple_short_segments()
|
||||
{
|
||||
seedingRule(rule().probability(0.8).maxVal(1));
|
||||
reductionRule(rule().probability(0.75).maxVal(3));
|
||||
pruningRule(rule_atJoin(1));
|
||||
return move(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1229,8 +1240,8 @@ namespace test {
|
|||
|
||||
std::promise<void> signalDone_{};
|
||||
|
||||
RandomChainCalcFunctor<maxFan> calcFunctor_;
|
||||
RandomChainPlanFunctor<maxFan> planFunctor_;
|
||||
std::unique_ptr<RandomChainCalcFunctor<maxFan>> calcFunctor_;
|
||||
std::unique_ptr<RandomChainPlanFunctor<maxFan>> planFunctor_;
|
||||
|
||||
|
||||
/* ==== Callbacks from job planning ==== */
|
||||
|
|
@ -1286,12 +1297,12 @@ namespace test {
|
|||
ScheduleCtx (TestChainLoad& mother, Scheduler& scheduler)
|
||||
: chainLoad_{mother}
|
||||
, scheduler_{scheduler}
|
||||
, calcFunctor_{chainLoad_.nodes_[0]}
|
||||
, planFunctor_{chainLoad_.nodes_[0], chainLoad_.numNodes_
|
||||
,[this](size_t i, size_t l){ disposeStep(i,l); }
|
||||
,[this](auto* p, auto* s) { setDependency(p,s);}
|
||||
,[this](size_t l, bool w) { continuation(l,w); }
|
||||
}
|
||||
, calcFunctor_{new RandomChainCalcFunctor<maxFan>{chainLoad_.nodes_[0]}}
|
||||
, planFunctor_{new RandomChainPlanFunctor<maxFan>{chainLoad_.nodes_[0], chainLoad_.numNodes_
|
||||
,[this](size_t i, size_t l){ disposeStep(i,l); }
|
||||
,[this](auto* p, auto* s) { setDependency(p,s);}
|
||||
,[this](size_t l, bool w) { continuation(l,w); }
|
||||
}}
|
||||
{ }
|
||||
|
||||
ScheduleCtx
|
||||
|
|
@ -1324,18 +1335,18 @@ namespace test {
|
|||
Job
|
||||
calcJob (size_t idx, size_t level)
|
||||
{
|
||||
return Job{calcFunctor_
|
||||
,calcFunctor_.encodeNodeID(idx)
|
||||
,calcFunctor_.encodeLevel(level)
|
||||
return Job{*calcFunctor_
|
||||
, calcFunctor_->encodeNodeID(idx)
|
||||
, calcFunctor_->encodeLevel(level)
|
||||
};
|
||||
}
|
||||
|
||||
Job
|
||||
planningJob (size_t level)
|
||||
{
|
||||
return Job{planFunctor_
|
||||
,InvocationInstanceID()
|
||||
,planFunctor_.encodeLevel(level)
|
||||
return Job{*planFunctor_
|
||||
, InvocationInstanceID()
|
||||
, planFunctor_->encodeLevel(level)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1360,7 +1371,7 @@ namespace test {
|
|||
Time
|
||||
calcStartTime(size_t level)
|
||||
{
|
||||
return startTime_ + level / levelSpeed_;
|
||||
return startTime_ + Time{level / levelSpeed_};
|
||||
}
|
||||
|
||||
Time
|
||||
|
|
@ -1380,11 +1391,13 @@ namespace test {
|
|||
|
||||
/**
|
||||
* establish and configure the context used for scheduling computations.
|
||||
* @note clears hashes and re-propagates seed in the node graph beforehand.
|
||||
*/
|
||||
template<size_t maxFan>
|
||||
typename TestChainLoad<maxFan>::ScheduleCtx
|
||||
TestChainLoad<maxFan>::setupSchedule(Scheduler& scheduler)
|
||||
{
|
||||
clearNodeHashes();
|
||||
return ScheduleCtx{*this, scheduler};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96528,9 +96528,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1701661921354" ID="ID_1422491771" MODIFIED="1701662010544" TEXT="verify_scheduling_setup">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1701661961030" ID="ID_1398320014" MODIFIED="1701661985334" TEXT="Zweck: die Bauelemente verifzieren (nicht das Scheduling)">
|
||||
<node COLOR="#338800" CREATED="1701661921354" ID="ID_1422491771" MODIFIED="1701838435138" TEXT="verify_scheduling_setup">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1701661961030" ID="ID_1398320014" MODIFIED="1701838437120" TEXT="Zweck: die Bauelemente verifzieren (nicht das Scheduling)">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1701661987502" ID="ID_1253231042" MODIFIED="1701662008665" TEXT="einige Nodes direkt definieren und aufrufen; hash prüfen">
|
||||
|
|
@ -96540,6 +96540,16 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1701838479658" ID="ID_120274201" MODIFIED="1701838586016" TEXT="usageExample">
|
||||
<linktarget COLOR="#bb1868" DESTINATION="ID_120274201" ENDARROW="Default" ENDINCLINATION="-730;116;" ID="Arrow_ID_573558112" SOURCE="ID_111682569" STARTARROW="None" STARTINCLINATION="-428;0;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1701838487567" ID="ID_535031858" MODIFIED="1701838516891" TEXT="das ist zugleich ein einfacher Integrations-Test">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node CREATED="1701838497798" ID="ID_1377336908" MODIFIED="1701838519142" TEXT="verwendet also einen voll funktionalen Scheduler (und Threadpool)">
|
||||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#ccb59b" COLOR="#6e2a38" CREATED="1701017861080" ID="ID_797249846" MODIFIED="1701017874112" TEXT="nur begrenzte Verifikation">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="14"/>
|
||||
|
|
@ -100621,11 +100631,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1701493065993" ID="ID_1474617887" MODIFIED="1701493070377" TEXT="Implementierung">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1701548966576" ID="ID_1078499413" MODIFIED="1701548984371" TEXT="Basis und Rahmen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1701548966576" ID="ID_1078499413" MODIFIED="1701838335253" TEXT="Basis und Rahmen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1701549002234" ID="ID_1561610431" MODIFIED="1701735925477" TEXT="Design-Fragen zu klären">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node BACKGROUND_COLOR="#f0d5c5" COLOR="#990033" CREATED="1701550180973" ID="ID_809373895" MODIFIED="1701630273510" TEXT="wie verarbeiten wir Prerequisites?">
|
||||
<node COLOR="#435e98" CREATED="1701550180973" ID="ID_809373895" MODIFIED="1701838329203" TEXT="wie verarbeiten wir Prerequisites?">
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1701550315571" ID="ID_1778692014" MODIFIED="1701550322317" TEXT="Activity-Term-API">
|
||||
<node CREATED="1701550323615" ID="ID_7308108" MODIFIED="1701550333725" TEXT="wir brauchen für beide einen ActivityTerm"/>
|
||||
|
|
@ -100634,8 +100644,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node CREATED="1701550473011" ID="ID_1870816803" MODIFIED="1701550487721" TEXT="SchedulerSpec">
|
||||
<node CREATED="1701550488596" ID="ID_1839210683" MODIFIED="1701550497481" TEXT="packt den ActivityTerm ein"/>
|
||||
<node CREATED="1701550497932" ID="ID_1574659542" MODIFIED="1701550504262" TEXT="Scheduler gibt uns nur diese"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1701550504897" ID="ID_1986125239" MODIFIED="1701550524073" TEXT="dort ein API zum Anhängen von Prerequisites schaffen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1701550504897" ID="ID_1986125239" MODIFIED="1701838331914" TEXT="dort ein API zum Anhängen von Prerequisites schaffen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1701550571574" ID="ID_903982829" MODIFIED="1701550580028" TEXT="Nodes verweisen per direktem Pointer aufeinander">
|
||||
|
|
@ -100701,7 +100711,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#f0d5c5" COLOR="#990033" CREATED="1701550085813" ID="ID_1532623231" MODIFIED="1701630291290" TEXT="wie greift der Meta-Job auf den Schedulerer zu?">
|
||||
<node COLOR="#435e98" CREATED="1701550085813" ID="ID_1532623231" MODIFIED="1701838325982" TEXT="wie greift der Meta-Job auf den Schedulerer zu?">
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1701630398320" ID="ID_519354189" MODIFIED="1701630417244" TEXT="der reale Meta-Planer-Job wird über einen Scheduler-Service (DI) gehen"/>
|
||||
<node CREATED="1701630418928" ID="ID_456698721" MODIFIED="1701630480580" TEXT="das würde aber das Test-Setup verkomplizieren und behindern"/>
|
||||
|
|
@ -101035,7 +101045,23 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node COLOR="#338800" CREATED="1701814806243" ID="ID_1359675923" MODIFIED="1701823453699" TEXT="Job-Funktoren">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1701814828932" ID="ID_1598907893" MODIFIED="1701814991598" TEXT="RandomChainCalcFunctor"/>
|
||||
<node COLOR="#435e98" CREATED="1701814837569" ID="ID_1253997420" MODIFIED="1701814991599" TEXT="RandomChainPlanFunctor">
|
||||
<node COLOR="#435e98" CREATED="1701838354650" ID="ID_1348650598" MODIFIED="1701838373436" TEXT="müssen auf den Heap alloziert werden">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1701838377111" HGAP="27" ID="ID_536020711" MODIFIED="1701838396668" TEXT="JobFunctor ist NonCopyable" VSHIFT="3">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...und das ist gut so
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#435e98" CREATED="1701814837569" ID="ID_1253997420" MODIFIED="1701838398366" TEXT="RandomChainPlanFunctor">
|
||||
<node CREATED="1701814852805" ID="ID_437138180" MODIFIED="1701814876079" TEXT="die Callbacks ⟶ member functions"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1701814811675" ID="ID_1396437995" MODIFIED="1701823438336" STYLE="fork" TEXT="geleich im Ctor verdrahten">
|
||||
|
|
@ -101095,6 +101121,15 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1701838412722" ID="ID_794626379" MODIFIED="1701838420687" TEXT="einfacher Intergrationstest">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1701838524907" ID="ID_111682569" MODIFIED="1701838595646" TEXT="als »usageExample« für TestChainLoad">
|
||||
<arrowlink COLOR="#bb1868" DESTINATION="ID_120274201" ENDARROW="Default" ENDINCLINATION="-730;116;" ID="Arrow_ID_573558112" STARTARROW="None" STARTINCLINATION="-428;0;"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fafe99" COLOR="#fa002a" CREATED="1701838598906" ID="ID_1235285916" MODIFIED="1701838619227" TEXT="bleibt hängen ⟶ Timeout">
|
||||
<icon BUILTIN="broken-line"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue