Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interrupts for Engine #154

Open
eagmon opened this issue Feb 7, 2022 · 2 comments
Open

Interrupts for Engine #154

eagmon opened this issue Feb 7, 2022 · 2 comments

Comments

@eagmon
Copy link
Member

eagmon commented Feb 7, 2022

Currently Engine.front tracks all processes next updates, with a dict that has the next update times and the updates that will be applied: {'time': 14.0, 'update': {update-to-be-applied}}. The process's next update time is determined by the global time plus the timestep given by its Process.calculate_timestep().

Having interrupts would allow other processes to change a given process's next update time to be earlier. This might be necessary if, for example, an event such as chromosome replication needs to reset transcription at a given time. If the interrupt time is before the previously-determined next update time, the transcription process would need to be rerun from its previous initial state, and would return a new update dict: {'time': 13.0, 'update': {new}}.

To add this feature requires that we save the initial state provided for the process, so it could be re-run from that state at a shorter interval. Something like: {'time': 14.0, 'update': {update-to-be-applied}, 'state': {saved-view}}. It would also require the interrupt times to be received and handled by Engine.run_for.

@U8NWXD
Copy link
Member

U8NWXD commented Feb 7, 2022

Would a saved "view" of the state be enough? Currently the views we give to processes aren't copies. If we used a similar view here, any changes to the state would also affect the saved view. To prevent this, I think we'd need to deepcopy the view

@eagmon
Copy link
Member Author

eagmon commented Feb 7, 2022

Agree -- a "view" would not be enough, it would need to be a deepcopy. This would clearly add overhead, so maybe it should be optional? Processes can opt in for interruption, in which case the deepcopy of the view is applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants