Activity-Lang: outline for wiring async IO activities
...relies on the same building pattern, with the notable difference that the chain is severed, providing an additional NOTIFY as re-entrance point
This commit is contained in:
parent
73a67886f0
commit
b3b6f7524c
4 changed files with 91 additions and 4 deletions
|
|
@ -86,6 +86,15 @@ namespace gear {
|
|||
return setupActivityScheme (activity::Term::CALC_JOB, job, start, deadline);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder-API: initiate definition of IO data loading activities.
|
||||
*/
|
||||
activity::Term
|
||||
buildAsyncLoadJob (Job job, Time start, Time deadline)
|
||||
{
|
||||
return setupActivityScheme (activity::Term::LOAD_JOB, job, start, deadline);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder-API: initiate definition of internal/planning job.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ namespace gear {
|
|||
Activity* post_{nullptr};
|
||||
|
||||
Activity* gate_{nullptr};
|
||||
Activity* callback_{nullptr};
|
||||
|
||||
|
||||
public:
|
||||
|
|
@ -126,6 +127,17 @@ namespace gear {
|
|||
return *post_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return re-entrance point for completion after async IO.
|
||||
* @remark initiate follow-up processing by ActivityLang::dispatchChain().
|
||||
*/
|
||||
Activity&
|
||||
callback()
|
||||
{
|
||||
REQUIRE (callback_, "Activity Term properly configured for async IO");
|
||||
return *callback_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder operation: block this Term waiting for prerequisite notification.
|
||||
* @param notificationSrc an `NOTIFY`-Activity to attach the notification-link
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ namespace test {
|
|||
|
||||
|
||||
/** @test usage scenario: Activity graph for a simple render job
|
||||
* - build a activity term based on the »CalculationJob« wiring template
|
||||
* - build an activity term based on the »CalculationJob« wiring template
|
||||
* - dispatch the generated Activity chain and verify sequence of invocations
|
||||
*/
|
||||
void
|
||||
|
|
@ -581,16 +581,46 @@ namespace test {
|
|||
.arg("<0, until -85401592:56:01.825")); // ... but the Gate has been closed permanently (by setting the deadline to Time::MIN)
|
||||
CHECK (detector.ensureNoInvocation("testJob") // ==> no further invocation
|
||||
.afterInvocation("trigger").seq(2));
|
||||
|
||||
// cout << detector.showLog()<<endl; // HINT: use this for investigation...
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test TODO usage scenario: Activity graph for an async Job
|
||||
* @todo WIP 8/23 🔁 define ⟶ implement
|
||||
* - use a simple [calculation job term](\ref #scenario_RenderJob) as follow-up receiver
|
||||
* - build an activity Term based on the »Async Load Job« wiring and link it to the receiver
|
||||
* - also retrieve the Activity record used as re-entrance point after completing async IO
|
||||
* @todo WIP 8/23 ✔ define 🔁 implement
|
||||
*/
|
||||
void
|
||||
scenario_IOJob()
|
||||
{
|
||||
Time nominal{7,7};
|
||||
|
||||
Time start{0,1};
|
||||
Time dead{0,10};
|
||||
|
||||
ActivityDetector detector;
|
||||
Job loadJob{detector.buildMockJob("loadJob", nominal, 12345)};
|
||||
Job calcJob{detector.buildMockJob("calcJob", nominal, 54321)};
|
||||
|
||||
BlockFlowAlloc bFlow;
|
||||
ActivityLang activityLang{bFlow};
|
||||
|
||||
auto followup = activityLang.buildCalculationJob (calcJob, start,dead);
|
||||
auto loadTerm = activityLang.buildAsyncLoadJob (loadJob, start,dead)
|
||||
.appendNotificationTo (followup);
|
||||
|
||||
Activity& anchor = loadTerm.post();
|
||||
Activity& notify = loadTerm.callback();
|
||||
|
||||
ActivityLang::dispatchChain (anchor, detector.executionCtx);
|
||||
|
||||
detector.incrementSeq();
|
||||
ActivityLang::dispatchChain (notify, detector.executionCtx);
|
||||
|
||||
cout << detector.showLog()<<endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -77644,8 +77644,12 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
<node CREATED="1693178794380" ID="ID_491437643" MODIFIED="1693178801062" TEXT="optional / on-demand">
|
||||
<node CREATED="1693178805562" ID="ID_1048207081" MODIFIED="1693178814853" TEXT="Gate falls Notify aufgeschaltet"/>
|
||||
<node CREATED="1693178815720" ID="ID_1614785974" MODIFIED="1693178820772" TEXT="Gate falls Deadline definiert"/>
|
||||
<node COLOR="#338800" CREATED="1693178805562" ID="ID_1048207081" MODIFIED="1693686526300" TEXT="Gate falls Notify aufgeschaltet">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1693686465783" ID="ID_1698611033" MODIFIED="1693686530330" TEXT="Callback-Notify für async IO">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#d2beaf" COLOR="#5c4d6e" CREATED="1693223697516" ID="ID_1843732510" MODIFIED="1693268995911" TEXT="Problem: Deadline bestimmen">
|
||||
|
|
@ -80276,6 +80280,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1693323299522" ID="ID_392906930" MODIFIED="1693323317032" TEXT="Grundstruktur verdrahten">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1693684632678" ID="ID_1092577366" LINK="#ID_1698611033" MODIFIED="1693686505258" TEXT="Zugriff auf den Callback-Trigger">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1693432167704" ID="ID_1355575152" MODIFIED="1693432176339" TEXT="Anhängen einer Folge-Notification">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
|
|
@ -82804,6 +82811,35 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<linktarget COLOR="#b22e63" DESTINATION="ID_1493396541" ENDARROW="Default" ENDINCLINATION="-1383;-51;" ID="Arrow_ID_847435526" SOURCE="ID_48632766" STARTARROW="None" STARTINCLINATION="-753;40;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#d2beaf" COLOR="#5c4d6e" CREATED="1693684904305" ID="ID_887857937" MODIFIED="1693684935612" TEXT="Entscheidung: nominal time oder explizite Framenummer">
|
||||
<icon BUILTIN="yes"/>
|
||||
<icon BUILTIN="hourglass"/>
|
||||
<node CREATED="1693684958202" ID="ID_1211986246" MODIFIED="1693685119943" TEXT="Framenummer wäre die offensichtliche Lösung">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
und zwar »point and shot« — es muß genau die Implementierungs-Framenummer sein, die dann für die Verarbeitung wirklich gebraucht wird (und welche ist das?? ... wer weiß das???)
|
||||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<icon BUILTIN="smiley-oh"/>
|
||||
</node>
|
||||
<node CREATED="1693684939893" ID="ID_1837303645" MODIFIED="1693685363183" TEXT="mein Bauchgefühl sagt: Zeit ist generischer">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
da hinter der Invocation stets ein JobFunctor steht, der über eine Closure Zugriff auf konkrete Kontext-Informationen hat — das einzige Prinzip in der für Lumiera entwickelten offenen Daten-Architektur ist, daß alles zu Berechnende <i>zeitlich eingeordnet werden kann. </i>Damit sollte jedwede Aktivität anhand der Zeitangabe im Stande sein, ihre konkrete Parametrisierung abzuleiten. Das Wichtige dabei: <b>diese Ableitung bleibt ein lokales Detail</b>. Der Planungs-Prozeß muß es überhaupt nicht wissen
|
||||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#d2beaf" COLOR="#5c4d6e" CREATED="1693685364237" ID="ID_186112523" MODIFIED="1693685388978" TEXT="letztlich erst mit wachsender Praxis zu entscheiden">
|
||||
<icon BUILTIN="yes"/>
|
||||
<icon BUILTIN="hourglass"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1692108072539" ID="ID_1827409996" MODIFIED="1692108369187" TEXT="Umgang mit Fehlern">
|
||||
<arrowlink COLOR="#6f6ea7" DESTINATION="ID_774705986" ENDARROW="Default" ENDINCLINATION="-559;-416;" ID="Arrow_ID_1863875541" STARTARROW="None" STARTINCLINATION="-199;23;"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue