Scheduler: Layer-2 integration scenario complete
could even rig the diagnostic Execution-Ctx to drop the GroomingToken at the point when switching to work-mode
This commit is contained in:
parent
c2ddaed28e
commit
10a2c6908c
4 changed files with 113 additions and 48 deletions
|
|
@ -280,7 +280,7 @@ namespace test {
|
|||
|
||||
/** mock function call operator: logs all invocations */
|
||||
RET
|
||||
operator() (ARGS ...args)
|
||||
operator() (ARGS ...args) const
|
||||
{
|
||||
log_->call (log_->getID(), id_, args...)
|
||||
.addAttrib (MARK_SEQ, util::toString(*seqNr_));
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ namespace test {
|
|||
[&](Time when, Activity& postedAct, auto& ctx)
|
||||
{
|
||||
if (when == ctx.getSchedTime()) // only for POST to run „right now“
|
||||
return activityLang.dispatchChain (postedAct, ctx);
|
||||
return ActivityLang::dispatchChain (postedAct, ctx);
|
||||
else
|
||||
return activity::PASS;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ namespace test {
|
|||
// verify_GroomingToken();
|
||||
// torture_GroomingToken();
|
||||
// verify_DispatchDecision();
|
||||
// verify_findWork();
|
||||
// verify_postDispatch();
|
||||
verify_findWork();
|
||||
verify_postDispatch();
|
||||
integratedWorkCycle();
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +314,6 @@ namespace test {
|
|||
|
||||
queue.instruct (a2, t2);
|
||||
queue.instruct (a1, t1);
|
||||
CHECK (t1 == queue.headTime());
|
||||
CHECK (isSameObject (a1, *sched.findWork(queue, now))); // the earlier activity is found first
|
||||
CHECK (t2 == queue.headTime());
|
||||
CHECK (isSameObject (a2, *sched.findWork(queue, now)));
|
||||
|
|
@ -411,16 +410,19 @@ namespace test {
|
|||
|
||||
|
||||
|
||||
/** @test TODO build the integrated sequence of worker activation
|
||||
/** @test step-wise perform the typical sequence of planning and worker activation
|
||||
* - use the Render-Job scenario from SchedulerActivity_test::scenario_RenderJob()
|
||||
* - use similar instrumentation to trace Activities
|
||||
* @todo WIP 10/23 🔁 define ⟶ implement
|
||||
* - specifically rig the diagnostic executionCtx to drop the GroomingToken at λ-work
|
||||
* - Step-1 : schedule the Activity-term
|
||||
* - Step-2 : later search for work, retrieve and dispatch the term
|
||||
* - verify the expected sequence of Activities actually occurred
|
||||
* @todo WIP 10/23 ✔ define ⟶ ✔ implement
|
||||
*/
|
||||
void
|
||||
integratedWorkCycle()
|
||||
{
|
||||
{ // ===================================================================== setup a rigged Job
|
||||
Time nominal{7,7};
|
||||
|
||||
Time start{0,1};
|
||||
Time dead{0,10};
|
||||
|
||||
|
|
@ -438,25 +440,57 @@ namespace test {
|
|||
detector.watchGate (anchor.next, "theGate");
|
||||
|
||||
|
||||
// ===================================================================== setup test subject
|
||||
SchedulerInvocation queue;
|
||||
SchedulerCommutator sched;
|
||||
|
||||
Time now = detector.executionCtx.getSchedTime();
|
||||
Time past {Time::ZERO};
|
||||
// no one holds the GroomingToken
|
||||
___ensureGroomingTokenReleased(sched);
|
||||
auto myself = std::this_thread::get_id();
|
||||
CHECK (not sched.holdsGroomingToken (myself));
|
||||
|
||||
// CHECK (activity::PASS == ActivityLang::dispatchChain (anchor, detector.executionCtx));
|
||||
TimeVar now{Time::ZERO};
|
||||
|
||||
sched.postDispatch (&anchor, now, detector.executionCtx, queue);
|
||||
//////////////////////////////////////////////////////////////////////TODO advance "now" time
|
||||
// rig the ExecutionCtx to allow manipulating "current scheduler time"
|
||||
detector.executionCtx.getSchedTime = [&]{ return Time{now}; };
|
||||
// rig the λ-work to verify GroomingToken and to drop it then
|
||||
detector.executionCtx.work.implementedAs(
|
||||
[&](Time, size_t)
|
||||
{
|
||||
CHECK (sched.holdsGroomingToken (myself));
|
||||
sched.dropGroomingToken();
|
||||
});
|
||||
|
||||
|
||||
// ===================================================================== actual test sequence
|
||||
// Add the Activity-Term to be scheduled at start-Time
|
||||
sched.postDispatch (&anchor, start, detector.executionCtx, queue);
|
||||
CHECK (detector.ensureNoInvocation("testJob"));
|
||||
CHECK (not sched.holdsGroomingToken (myself));
|
||||
CHECK (not queue.empty());
|
||||
|
||||
// later->"now"
|
||||
now = Time{555,5};
|
||||
detector.incrementSeq();
|
||||
|
||||
// Assuming a worker runs "later" and retrieves work...
|
||||
Activity* act = sched.findWork(queue,now);
|
||||
CHECK (sched.holdsGroomingToken (myself)); // acquired the GroomingToken
|
||||
CHECK (isSameObject(*act, anchor)); // "found" the rigged Activity as next work to do
|
||||
|
||||
sched.postDispatch (act, now, detector.executionCtx, queue);
|
||||
|
||||
// CHECK (detector.verifyInvocation("theGate").arg("5.105 ⧐ Act(GATE")
|
||||
// .beforeInvocation("after-theGate").arg("⧐ Act(WORKSTART")
|
||||
// .beforeInvocation("CTX-work").arg("5.155","")
|
||||
// .beforeInvocation("testJob") .arg("7.007",12345)
|
||||
// .beforeInvocation("CTX-done").arg("5.355",""));
|
||||
cout << detector.showLog()<<endl; // HINT: use this for investigation...
|
||||
CHECK (queue.empty());
|
||||
CHECK (not sched.holdsGroomingToken (myself)); // the λ-work was invoked and dropped the GroomingToken
|
||||
|
||||
CHECK (detector.verifySeqIncrement(1)
|
||||
.beforeInvocation("theGate").arg("5.555 ⧐ Act(GATE")
|
||||
.beforeInvocation("after-theGate").arg("⧐ Act(WORKSTART")
|
||||
.beforeInvocation("CTX-work").arg("5.555","")
|
||||
.beforeInvocation("testJob") .arg("7.007",12345)
|
||||
.beforeInvocation("CTX-done").arg("5.555",""));
|
||||
|
||||
// cout << detector.showLog()<<endl; // HINT: use this for investigation...
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -86180,12 +86180,12 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688336794355" ID="ID_1705923970" MODIFIED="1688337246572" TEXT="SchedulerCommutator_test">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1688336794355" ID="ID_1705923970" MODIFIED="1697662668390" TEXT="SchedulerCommutator_test">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1688337141875" ID="ID_1442397948" MODIFIED="1697552361129" TEXT="»Layer-2« : Activity execution">
|
||||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697473097086" ID="ID_236233579" MODIFIED="1697493162215" TEXT="Aufgaben">
|
||||
<node COLOR="#435e98" CREATED="1697473097086" ID="ID_236233579" MODIFIED="1697662397960" TEXT="Aufgaben">
|
||||
<icon BUILTIN="yes"/>
|
||||
<node COLOR="#338800" CREATED="1697483439491" ID="ID_20743819" MODIFIED="1697643526449" TEXT="die Bestandteile des API abdecken">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
@ -86202,8 +86202,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1697473111557" ID="ID_750298563" MODIFIED="1697643535869" TEXT="Bestandteile des Work-Funktors direkt verbinden">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1697473111557" FOLDED="true" ID="ID_750298563" MODIFIED="1697662523001" TEXT="Bestandteile des Work-Funktors direkt verbinden">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1697484212735" ID="ID_853921255" MODIFIED="1697484238920" TEXT="Maßgabe: korrekte Verschaltung der ExecCtx-λ">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
|
|
@ -86217,7 +86217,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node CREATED="1697485021536" ID="ID_473846960" MODIFIED="1697485038425" TEXT="⟹ Kette muß komplett durchlaufen"/>
|
||||
<node CREATED="1697485039349" ID="ID_393821740" MODIFIED="1697485047472" TEXT="⟹ GroomingToken muß gedropped werden"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1697473133474" ID="ID_1452561509" MODIFIED="1697493772501" TEXT="high-level-Schnittstelle zur Planung klären">
|
||||
<node COLOR="#338800" CREATED="1697473133474" FOLDED="true" ID="ID_1452561509" MODIFIED="1697662515411" TEXT="high-level-Schnittstelle zur Planung klären">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1697483606913" ID="ID_315948316" MODIFIED="1697483617085" TEXT="gehört eigentlich nicht hierher"/>
|
||||
<node CREATED="1697483617691" ID="ID_1269032096" MODIFIED="1697483624678" TEXT="es handelt sich um den POST-Eingang"/>
|
||||
|
|
@ -86277,7 +86277,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
<node COLOR="#435e98" CREATED="1697493572685" ID="ID_600487672" MODIFIED="1697493644563" TEXT="Fazit">
|
||||
<icon BUILTIN="forward"/>
|
||||
<node CREATED="1697493609672" ID="ID_1260482318" MODIFIED="1697493638619" TEXT="Meta-Job bauen">
|
||||
<node CREATED="1697493609672" ID="ID_1260482318" MODIFIED="1697662494396" TEXT="Render-Job bauen">
|
||||
<icon BUILTIN="full-1"/>
|
||||
</node>
|
||||
<node CREATED="1697493613575" ID="ID_1356997062" MODIFIED="1697493641246" TEXT="diesen über den POST-Eingang einspielen">
|
||||
|
|
@ -86294,7 +86294,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1697560612176" ID="ID_1970152549" MODIFIED="1697560615803" TEXT="Fälle">
|
||||
<node COLOR="#435e98" CREATED="1697560612176" ID="ID_1970152549" MODIFIED="1697662384898" TEXT="Fälle">
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1697560628310" ID="ID_670606112" MODIFIED="1697562328081" TEXT="demonstrateSimpleUsage">
|
||||
<icon BUILTIN="pencil"/>
|
||||
</node>
|
||||
|
|
@ -86385,8 +86385,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1697560591659" ID="ID_1581648425" MODIFIED="1697645317998" TEXT="integratedWorkCycle">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1697560591659" ID="ID_1581648425" MODIFIED="1697662380188" TEXT="integratedWorkCycle">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1697643554969" ID="ID_136268123" MODIFIED="1697643896607" TEXT="Maßgabe">
|
||||
<icon BUILTIN="yes"/>
|
||||
<node CREATED="1697643566840" ID="ID_1881707348" MODIFIED="1697643573858" TEXT="Perspektive ist Layer-2"/>
|
||||
|
|
@ -86413,8 +86413,21 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
<node CREATED="1697643680641" ID="ID_158566307" MODIFIED="1697643705314" TEXT="ActivityDetektor zur Verfolgung der Abläufe"/>
|
||||
<node CREATED="1697643707245" ID="ID_33409746" MODIFIED="1697643729333" TEXT="aber: bereits funktionale Vertrahtung wie im Scheduler">
|
||||
<node CREATED="1697643768189" ID="ID_544635778" MODIFIED="1697643841143" TEXT="λ-post ⟶ postDispatch()"/>
|
||||
<node CREATED="1697643768189" ID="ID_1175399919" MODIFIED="1697643850309" TEXT="λ-work ⟶ dropGroomingToken()"/>
|
||||
<node COLOR="#5b280f" CREATED="1697643768189" ID="ID_544635778" MODIFIED="1697658700066" TEXT="λ-post ⟶ postDispatch()">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1697658719661" HGAP="30" ID="ID_1080504984" MODIFIED="1697658826222" TEXT="(wird für diesen Testfall gar nicht gebraucht)" VSHIFT="4">
|
||||
<edge COLOR="#7c360f" STYLE="sharp_linear" WIDTH="2"/>
|
||||
<font NAME="SansSerif" SIZE="10"/>
|
||||
<icon BUILTIN="stop-sign"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1697643768189" ID="ID_1175399919" MODIFIED="1697643850309" TEXT="λ-work ⟶ dropGroomingToken()">
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1697658719661" HGAP="30" ID="ID_1422948623" MODIFIED="1697658860972" TEXT="verifiziert Grooming-Token - Handhabung" VSHIFT="4">
|
||||
<edge COLOR="#7c360f" STYLE="sharp_linear" WIDTH="2"/>
|
||||
<font NAME="SansSerif" SIZE="10"/>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1697643873588" ID="ID_1914496998" MODIFIED="1697644383309">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
|
|
@ -86426,32 +86439,50 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
Activity-Term präparieren wie im <font face="Monospaced" color="#333333">SchedulerActivity_test::</font><font face="Monospaced" color="#020080"><b>scenario_RenderJob</b></font><font face="Monospaced" color="#333333">()</font>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1697645187303" ID="ID_225836126" MODIFIED="1697645351457" TEXT="Verifikation">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1697645187303" ID="ID_225836126" MODIFIED="1697662378579" TEXT="Verifikation">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1697645198038" ID="ID_684515169" MODIFIED="1697645209458" TEXT="Szenario in Ursprungs-Form läuft durch wie erwartet">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697645210335" ID="ID_1557850384" MODIFIED="1697645242464" TEXT="aktuelle Scheduler-Zeit manipulierbar machen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1697645210335" ID="ID_1557850384" MODIFIED="1697662622362" TEXT="aktuelle Scheduler-Zeit manipulierbar machen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697645222818" ID="ID_1215667724" MODIFIED="1697645242464" TEXT="innere Verdrahtungen im ExecutionCtx einbauen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1697645222818" ID="ID_1215667724" MODIFIED="1697662366750" TEXT="innere Verdrahtungen im ExecutionCtx einbauen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1697657638874" ID="ID_1235782778" MODIFIED="1697657728816" TEXT="auch dafür gibts bereits ein Beispiel">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<font color="#333333" face="Monospaced">SchedulerActivity_test::</font><font color="#020080" face="Monospaced"><b>scenario_Notification</b></font><font color="#333333" face="Monospaced">()</font>
|
||||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1697645245663" ID="ID_685915287" MODIFIED="1697645308480" TEXT="prüfen: geht erst mal in die Queue">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
<node COLOR="#3d3c78" CREATED="1697657742722" ID="ID_1237025197" MODIFIED="1697657787311" TEXT="(bin ich froh daß ich mir den Detector so gut ausgestattet habe)">
|
||||
<font NAME="SansSerif" SIZE="9"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1697645256903" ID="ID_230126414" MODIFIED="1697645263922" TEXT="Zeit auf später weiterschalten">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1697645265733" ID="ID_1757939624" MODIFIED="1697645308480" TEXT="prüfen: bekomme den gebauten Term wieder zurück">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
<node COLOR="#338800" CREATED="1697645245663" ID="ID_685915287" MODIFIED="1697662373341" TEXT="prüfen: geht erst mal in die Queue">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1697645289665" ID="ID_1827770478" MODIFIED="1697645308481" TEXT="prüfen: Ausführung läuft komplett durch">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
<node COLOR="#338800" CREATED="1697645256903" ID="ID_230126414" MODIFIED="1697662374674" TEXT="Zeit auf später weiterschalten">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1697645265733" ID="ID_1757939624" MODIFIED="1697662375611" TEXT="prüfen: bekomme den gebauten Term wieder zurück">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1697645289665" ID="ID_1827770478" MODIFIED="1697662376362" TEXT="prüfen: Ausführung läuft komplett durch">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1697662641710" ID="ID_150256812" MODIFIED="1697662648959" TEXT="prüfen: GroomingToken dropped">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue