Activity-Lang: wiring for internal/planning job

...uses just the minimal wiring and is thus already implemented :-)
This commit is contained in:
Fischlurch 2023-09-02 03:35:02 +02:00
parent e6d233def2
commit 73a67886f0
3 changed files with 58 additions and 13 deletions

View file

@ -86,6 +86,15 @@ namespace gear {
return setupActivityScheme (activity::Term::CALC_JOB, job, start, deadline);
}
/**
* Builder-API: initiate definition of internal/planning job.
*/
activity::Term
buildMetaJob (Job job, Time start, Time deadline)
{
return setupActivityScheme (activity::Term::META_JOB, job, start, deadline);
}
/**
* Execution Framework: dispatch performance of a chain of Activities.

View file

@ -478,9 +478,11 @@ namespace test {
};
BlockFlowAlloc bFlow;
ActivityLang activityLang{bFlow};
auto term = activityLang.buildCalculationJob (testJob, start,dead);
Activity& anchor = term.post();
// Build the Activity-Term for a simple calculation job...
Activity& anchor = activityLang.buildCalculationJob (testJob, start,dead)
.post(); // retrieve the entrance point to the chain
// insert instrumentation to trace activation
detector.watchGate (anchor.next, "theGate");
@ -501,7 +503,6 @@ namespace test {
* - Case-1 : a Notification decreases the latch, but blocks otherwise
* - Case-2 : when the primary chain is activated after the Notification,
* then the tail chain behind the Gate is dispatched
* @todo WIP 8/23 define implement
*/
void
scenario_Notification()
@ -594,12 +595,44 @@ namespace test {
/** @test TODO usage scenario: Activity graph for administrative job
* @todo WIP 8/23 🔁 define implement
/** @test usage scenario: Activity graph for administrative job
* - by default, neither Gate, nor start/stop notification used
* - rather, the `INVOKE` and the argument-`FEED` is posted directly
* @remark the job itself is thus performed in »management mode«
* (holding the `GroomingToken`), and may modify the queue
* to generate new jobs.
*/
void
scenario_MetaJob()
{
Time nominal{7,7};
Time start{0,1};
Time dead{0,10};
ActivityDetector detector;
Job testJob{detector.buildMockJob("metaJob", nominal, 12345)};
BlockFlowAlloc bFlow;
ActivityLang activityLang{bFlow};
// Build Activity-Term with a chain defining a meta-job...
Activity& anchor = activityLang.buildMetaJob (testJob, start,dead)
.post();
CHECK (anchor.is (Activity::POST));
CHECK (anchor.next->is (Activity::INVOKE));
CHECK (anchor.next->next->is (Activity::FEED));
CHECK (anchor.next->next->next->is (Activity::FEED));
CHECK (anchor.next->next->next->next == nullptr);
// insert test-instrumentation
detector.insertActivationTap(anchor.next);
CHECK (activity::PASS == ActivityLang::dispatchChain (anchor, detector.executionCtx));
CHECK (detector.verifyInvocation("tap-INVOKE").arg("5.555 ⧐ Act(INVOKE")
.beforeInvocation("metaJob") .arg("7.007",12345));
}
};

View file

@ -77633,12 +77633,14 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<node COLOR="#338800" CREATED="1693178646683" ID="ID_1322750884" MODIFIED="1693327429521" TEXT="Klammer Workstart|stop">
<icon BUILTIN="button_ok"/>
</node>
<node CREATED="1693178702928" ID="ID_973455223" MODIFIED="1693178762434" TEXT="Verbindung Feed&#x27f6;Worksop | Callback"/>
<node CREATED="1693178702928" ID="ID_973455223" MODIFIED="1693178762434" TEXT="Verbindung Feed&#x27f6;Workstop | Callback"/>
<node CREATED="1693178764856" ID="ID_1455997570" MODIFIED="1693178773842" TEXT="optional/mandatory">
<node COLOR="#338800" CREATED="1693178780905" ID="ID_1918846546" MODIFIED="1693327436464" TEXT="Gate">
<icon BUILTIN="button_ok"/>
</node>
<node CREATED="1693178785229" ID="ID_820032876" MODIFIED="1693178786896" TEXT="Notify"/>
<node COLOR="#338800" CREATED="1693178785229" ID="ID_820032876" MODIFIED="1693618312895" TEXT="Notify">
<icon BUILTIN="button_ok"/>
</node>
</node>
</node>
<node CREATED="1693178794380" ID="ID_491437643" MODIFIED="1693178801062" TEXT="optional / on-demand">
@ -80200,8 +80202,7 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
Im ActivityDetector sind normalerweise die ctx-&#955; als reine Logging-Funktionen implementiert; aber die nun konstruierte Ausf&#252;hrungs-Logik setzt fest darauf, da&#223; ein Aufruf von ctx.post() sofort in einen ActivityLang::dispatchChain() umgesetzt wird <i><font size="2" color="#562275">(allerdings nicht wirklich immer, sondern nur in dem Fall, da&#223; wir das GroomingToken halten und die im post() gegebene Zeit die aktuelle Zeit ist)</font></i>
</p>
</body>
</html>
</richcontent>
</html></richcontent>
<arrowlink COLOR="#8f4550" DESTINATION="ID_1373519941" ENDARROW="Default" ENDINCLINATION="-166;-6;" ID="Arrow_ID_1164574930" STARTARROW="None" STARTINCLINATION="191;13;"/>
<icon BUILTIN="messagebox_warning"/>
</node>
@ -80229,8 +80230,7 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<font color="#7b4438" face="Monospaced">FakeExecutionCtx</font>&#160;bzw. die dort verwendete <font color="#7b4438" face="Monospaced">DiagnosticFun</font>, auf die man ja tats&#228;chlich zugreifen k&#246;nnen sollte (um den R&#252;ckgabewert zu manipulieren) &#8212; und das w&#228;re bei einer <font face="Monospaced" color="#2f1687">std::function</font>&#160; nicht mehr m&#246;glich...
</p>
</body>
</html>
</richcontent>
</html></richcontent>
<linktarget COLOR="#8f4550" DESTINATION="ID_1373519941" ENDARROW="Default" ENDINCLINATION="-166;-6;" ID="Arrow_ID_1164574930" SOURCE="ID_1170059404" STARTARROW="None" STARTINCLINATION="191;13;"/>
<icon BUILTIN="broken-line"/>
</node>
@ -80280,11 +80280,14 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<icon BUILTIN="flag-yellow"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689200553782" ID="ID_722630098" MODIFIED="1689200595611" TEXT="scenario_MetaJob">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1689200553782" ID="ID_722630098" MODIFIED="1693618275138" TEXT="scenario_MetaJob">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1693323319980" ID="ID_1996463444" MODIFIED="1693323335269" TEXT="die minimale default-Verdrahtung gen&#xfc;gt">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1693618353666" ID="ID_1280526834" MODIFIED="1693618364282" TEXT="die kurze Kette explizit verifizieren">
<icon BUILTIN="button_ok"/>
</node>
</node>
</node>
</node>