From 2e28f5d278ad40c84e2636a3cfb1d31dd293c475 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 3 Sep 2023 01:50:50 +0200 Subject: [PATCH] Activity-Lang: abstracted execution framework complete and tested (closes: #1319) --- src/vault/gear/activity-lang.hpp | 38 ++++++---- src/vault/gear/activity.hpp | 10 +-- tests/32scheduler.tests | 6 +- tests/vault/gear/activity-detector-test.cpp | 21 ++---- tests/vault/gear/activity-detector.hpp | 67 +++++------------ wiki/thinkPad.ichthyo.mm | 83 +++++++++++---------- 6 files changed, 98 insertions(+), 127 deletions(-) diff --git a/src/vault/gear/activity-lang.hpp b/src/vault/gear/activity-lang.hpp index 181ca0c23..b8e03f761 100644 --- a/src/vault/gear/activity-lang.hpp +++ b/src/vault/gear/activity-lang.hpp @@ -28,12 +28,9 @@ ** can be passed to the scheduler's messaging queue to cause the described ** activities to be performed in the context of the Lumiera render engine. ** - ** @warning mostly this is planned functionality ** @see SchedulerActivity_test ** @see activity.hpp definition of verbs - ** - ** @todo WIP-WIP-WIP 6/2023 »Playback Vertical Slice« - ** + ** */ @@ -44,22 +41,36 @@ #include "vault/gear/activity.hpp" #include "vault/gear/block-flow.hpp" #include "vault/gear/activity-term.hpp" -//#include "lib/symbol.hpp" -//#include "lib/util.hpp" - -//#include namespace vault{ namespace gear { -// using util::isnil; -// using std::string; using BlockFlowAlloc = BlockFlow; - /** - * TODO write type comment... + + /*************************************************************************************//** + * Term builder and execution framework to perform chains of _scheduler Activities_. + * These are the verbs of a low-level execution language for render jobs; individual + * \ref Activity records are managed by the \ref BlockFlow allocation scheme and maintained + * until expiration their deadline. To enact a render job, a connection of Activities + * will be suitably wired, and the entry point to start execution can be instructed + * into the Scheduler. + * + * The ActivityLang object provides an _construction and execution service_ + * - it provides a builder API to construct _terms_ of properly wired Activity records + * - the activity::Term serves as a transient object for wiring and configuration and + * can be discarded after enqueuing the entry point of a chain. + * - the static function ActivityLang::dispatchChain() provides the execution logic + * for _activating_ a chain of Activities successively. + * - for real usage, this execution environment needs some functionality implemented + * in the scheduler, which -- for the purpose of Activity activation -- is abstracted + * as an *Execution Context* with the following operations + * ** λ-post : hand over a chain of Activities for (time bound) activation + * ** λ-work : signal start of media processing and then leave »management mode« + * ** λ-done : signal completion of media processing + * ** λ-tick : activate an internal heartbeat and scheduler maintenance hook * * @see Activity * @see SchedulerActivity_test @@ -69,7 +80,7 @@ namespace gear { BlockFlowAlloc& mem_; public: -// explicit + explicit ActivityLang (BlockFlowAlloc& memManager) : mem_{memManager} { } @@ -153,6 +164,5 @@ namespace gear { }; - }} // namespace vault::gear #endif /*SRC_VAULT_GEAR_ACTIVITY_LANG_H_*/ diff --git a/src/vault/gear/activity.hpp b/src/vault/gear/activity.hpp index af8a3a25e..1a09b4d65 100644 --- a/src/vault/gear/activity.hpp +++ b/src/vault/gear/activity.hpp @@ -55,9 +55,7 @@ ** ** @see SchedulerActivity_test ** @see ActivityLang implementation of execution logic - ** - ** @todo WIP-WIP 8/2023 »Playback Vertical Slice« - ** + ** */ @@ -71,8 +69,6 @@ #include "lib/meta/function.hpp" #include "lib/util.hpp" -//#include - namespace vault{ namespace gear { @@ -80,11 +76,10 @@ namespace gear { using lib::time::TimeValue; using lib::time::TimeVar; using lib::time::Offset; -// using util::isnil; -// using std::string; namespace error = lumiera::error; + class Activity; @@ -696,6 +691,5 @@ namespace gear { } - }} // namespace vault::gear #endif /*SRC_VAULT_GEAR_ACTIVITY_H_*/ diff --git a/tests/32scheduler.tests b/tests/32scheduler.tests index beae46256..97a900a22 100644 --- a/tests/32scheduler.tests +++ b/tests/32scheduler.tests @@ -2,19 +2,19 @@ TESTING "Component Test Suite: Scheduler" ./test-suite --group=engine -PLANNED "Activity observation framework" ActivityDetector_test < -//using test::Test; -//using lib::time::Time; -//using lib::time::FSecs; -//using std::move; +using lib::time::Time; +using lib::time::FSecs; + using util::isSameObject; using lib::test::randStr; using lib::test::randTime; @@ -48,14 +46,6 @@ namespace vault{ namespace gear { namespace test { -// using lib::time::FrameRate; -// using lib::time::Offset; - using lib::time::Time; - using lib::time::FSecs; - - - - /*****************************************************************//** * @test verify instrumentation setup to watch scheduler Activities. @@ -82,8 +72,7 @@ namespace test { } - /** @test TODO demonstrate a simple usage scenario - * @todo WIP 7/23 🔁 define 🔁 implement + /** @test demonstrate a simple usage scenario of this test support facility */ void simpleUsage() diff --git a/tests/vault/gear/activity-detector.hpp b/tests/vault/gear/activity-detector.hpp index 90c060887..6b34162ea 100644 --- a/tests/vault/gear/activity-detector.hpp +++ b/tests/vault/gear/activity-detector.hpp @@ -32,7 +32,7 @@ ** _detector Activity records_ is provided, which drop off event log messages ** by side effect. These detector probes can be wired in as decorators into ** an otherwise valid Activity-Term, allowing to watch and verify patterns - ** of invocation -- which might even happen concurrently. + ** of invocation. ** ** # Usage ** @@ -50,9 +50,19 @@ ** - ActivityDetector::buildDiadnosticFun(id) generates a functor object with ** _arbitrary signature,_ which records any invocation and arguments. ** The corresponding verification matcher is #verifyInvocation(id) + ** - ActivityDetector::buildMockJobFunctor(id) a JobFunctor implementation + ** suitably rigged to record invocations and arguments + ** - ActivityDetector::buildActivationProbe a debugging Activity to record activation + ** - ActivityDetector::insertActivationTap hooks this Activation-Probe before an + ** existing Activity-connection, so that passing on the activation can be detected + ** - ActivityDetector::watchGate rig a `GATE` activity by prepending and appending + ** an Activation-Probe, so that both incoming and outgoing activations can be traced + ** - ActivityDetector::executionCtx test setup of the execution environment abstraction + ** for performing chains of Activities; it provides the expected λ-functions as + ** instances of ActivityDetctor::DiagnosticFun, so that any invocation is recorded ** - ** @todo WIP-WIP-WIP 8/2023 gradually gaining traction. ** @see SchedulerActivity_test + ** @see ActivityDetector_test ** @see EventLog_test (demonstration of EventLog capbabilities) */ @@ -65,35 +75,20 @@ #include "lib/test/test-helper.hpp" #include "lib/test/event-log.hpp" -//#include "steam/play/dummy-play-connection.hpp" -//#include "steam/fixture/node-graph-attachment.hpp" -//#include "steam/fixture/segmentation.hpp" -//#include "steam/mobject/model-port.hpp" -//#include "steam/engine/dispatcher.hpp" -//#include "steam/engine/job-ticket.hpp" #include "vault/gear/job.h" #include "vault/gear/activity.hpp" #include "vault/gear/nop-job-functor.hpp" -//#include "vault/real-clock.hpp" -//#include "lib/allocator-handle.hpp" #include "lib/time/timevalue.hpp" -//#include "lib/diff/gen-node.hpp" -//#include "lib/linked-elements.hpp" #include "lib/meta/variadic-helper.hpp" #include "lib/meta/function.hpp" #include "lib/wrapper.hpp" -#include "lib/format-cout.hpp" #include "lib/format-util.hpp" -//#include "lib/itertools.hpp" -//#include "lib/depend.hpp" #include "lib/util.hpp" #include #include #include #include -//#include -//#include namespace vault{ @@ -102,23 +97,14 @@ namespace test { using std::string; using std::function; -// using std::make_tuple; -// using lib::diff::GenNode; -// using lib::diff::MakeRec; using lib::time::TimeValue; using lib::time::Time; using lib::time::FSecs; using lib::time::Offset; -// using lib::HashVal; using lib::meta::RebindVariadic; using util::isnil; using std::forward; using std::move; -// using util::isSameObject; -// using fixture::Segmentation; -// using vault::RealClock; -// using vault::gear::Job; -// using vault::gear::JobClosure; namespace {// Diagnostic markers @@ -167,29 +153,14 @@ namespace test { operator bool() const { return _Parent::operator bool(); } -// EventMatch& locate (string match); -// EventMatch& locateMatch (string regExp); -// EventMatch& locateEvent (string match); -// EventMatch& locateEvent (string classifier, string match); -// EventMatch& locateCall (string match); -// -// -// /* query builders to find a match stepping forwards */ -// -// EventMatch& before (string match); -// EventMatch& beforeMatch (string regExp); -// EventMatch& beforeEvent (string match); -// EventMatch& beforeEvent (string classifier, string match); + /* query builder(s) to find a match stepping forwards */ ActivityMatch& beforeInvocation (string match) { return delegate (&EventMatch::beforeCall, move(match)); } -// -// -// /* query builders to find a match stepping backwards */ -// -// EventMatch& after (string match); -// EventMatch& afterMatch (string regExp); -// EventMatch& afterEvent (string match); -// EventMatch& afterEvent (string classifier, string match); + // more here... + + /* query builders to find a match stepping backwards */ ActivityMatch& afterInvocation (string match) { return delegate (&EventMatch::afterCall, move(match)); } + // more here... + /** qualifier: additionally match the function arguments */ template @@ -245,13 +216,13 @@ namespace test { }; + /** * Diagnostic context to record and evaluate activations within the Scheduler. * The provided tools and detectors are wired back internally, such as to record * any observations into an lib::test::EventLog instance. Thus, after performing * rigged functionality, the expected activities and their order can be verified. * @see ActivityDetector_test - * @todo WIP-WIP-WIP 8/23 gradually building the verification tools needed... */ class ActivityDetector : util::NonCopyable diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index a6d8f9d08..8dd51823b 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -77263,8 +77263,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -77425,9 +77425,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + @@ -77438,13 +77438,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + - - - - - + + @@ -77452,9 +77450,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + + @@ -77526,13 +77525,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - - + + @@ -77559,11 +77558,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - + + + - + @@ -77611,8 +77610,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -77647,8 +77646,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -78547,12 +78546,12 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + @@ -79017,7 +79016,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -79704,7 +79703,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -80000,9 +79999,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + + + + +

+ »Activity Language« Functionality test +

+ +
@@ -80011,7 +80018,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -80073,7 +80080,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -80096,7 +80103,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -80163,7 +80170,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -80178,7 +80185,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -80221,7 +80228,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -80325,7 +80332,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -80337,7 +80344,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -80566,7 +80573,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- +