Generalizing pre- and post run hooks
Background: Using pre- and post run hooks to execute functions directly before and after execution in the runtime service of the compute resource seems to be and important feature for Loihi and Loihi 2. This is probably true also for other compute resources in the future, thus we should generalize the possibility to execute functions in the runtime service pre- and post runs and include a standardized way to communicate information between runtime and runtime service. This is also partly related to Issue #493. The rationale why it is beneficial to run something in the runtime service is, that certain information is only available at that point - after the network was already compiled and mapped to the compute resource. Currently there are pre- and post hooks as functions to inject to the runtime service available in lava-loihi. Generalize the possibility to define and execute pre- and post execution functions in the runtime service.
Ideally would be a solution that such functions can be given to the net object in a process model and state for the functions is defined as Vars in the corresponding process/process model to be accessed in the functions and at runtime level.
User story
As a user I want to be able to execute functions (including configure/change configuration of the compute resource) after compilation and configuration has already happened as well as after an execution ended. The availability of the actual compute resource configuration (e.g. Loihi board object) is needed for this functions. Additionally, accessing gathered data within these functions should be possible, without having to create temporary files,
Conditions of satisfaction
- Users are able to define functions which are executed pre- and post- execution of a compute resource.
- These functions have access to the compute resource configuration (e.g. Loihi board object)
- These functions can use channels to receive/send information back to the runtime/other processes.
Acceptance tests
- Test a function changing a board configuration right before an execution.
- Test a function reading a board configuration right after an execution and writing the values back to runtime/another process.