-
Notifications
You must be signed in to change notification settings - Fork 1
Description
We have created subclasses from Process and used them to implement well known algorithms(echo algorithm) for instance. I propose to use already written processes as reusable pieces of code that can be used as subroutines.
Expected Behavior
Users will add subroutines to a process and then specify when in the run method they are going to be called. Each instance of a subroutine (process) should operate in its own namespace while still having access to the global namespace(the scope of the Process which will act as a node in simulation). The access is necessary to allow different algorithms to be interoperable. But at the same time it shouldn't cause any unexpected behavior in the main Process(the node)
Current Behavior
There is no existing arrangement to allow this.
Possible Solution
Have an OrderedDict of processes(objects of type Process) with strings as keys. Users will add subroutines like:
self.add_subroutine("first echo", TerminatingEchoProcess())this will create self.subroutine["first echo"] and assign it the instance while mapping all the channels with that of the instance.
self.state will be a dictionary which will be accessible to the inner instances by the variable parent_state. This data can persist across subroutines without exposing the complete outer instance inside the inner instances.
Context
There are many algorithms which are composed of using simple basic algorithms one after another. This will greatly increase code reusability and allow fast experimentation. This will also have the added advantage of increasing readability.