diff --git a/src/vault/gear/activity-lang.hpp b/src/vault/gear/activity-lang.hpp index 03473f99e..f98864c80 100644 --- a/src/vault/gear/activity-lang.hpp +++ b/src/vault/gear/activity-lang.hpp @@ -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. diff --git a/tests/vault/gear/scheduler-activity-test.cpp b/tests/vault/gear/scheduler-activity-test.cpp index 276585c81..6b4c2b467 100644 --- a/tests/vault/gear/scheduler-activity-test.cpp +++ b/tests/vault/gear/scheduler-activity-test.cpp @@ -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)); } }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index e75da39c0..bbadf5070 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -77633,12 +77633,14 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + + + @@ -80200,8 +80202,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
Im ActivityDetector sind normalerweise die ctx-λ als reine Logging-Funktionen implementiert; aber die nun konstruierte Ausführungs-Logik setzt fest darauf, daß ein Aufruf von ctx.post() sofort in einen ActivityLang::dispatchChain() umgesetzt wird (allerdings nicht wirklich immer, sondern nur in dem Fall, daß wir das GroomingToken halten und die im post() gegebene Zeit die aktuelle Zeit ist)

- - +
@@ -80229,8 +80230,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
FakeExecutionCtx bzw. die dort verwendete DiagnosticFun, auf die man ja tatsächlich zugreifen können sollte (um den Rückgabewert zu manipulieren) — und das wäre bei einer std::function  nicht mehr möglich...

- - +
@@ -80280,11 +80280,14 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + + + +