3

I have a general question about how to debug in Simpy. Normal debugging tools don't seem to work, since everything is working on the event loop, and you can't step through the code line by line and inspect what exists at any point in time.

Primarily, I'm interested in finding what kinds of processes and callbacks are in existence at a particular time, and how to remove them at the appropriate point. Are there any best practices surrounding debugging in discrete event simulation generally?

Allen Wang
  • 2,426
  • 2
  • 24
  • 48

2 Answers2

0

I would just use a bunch of print()s.

Stefan Scherfke
  • 3,012
  • 1
  • 19
  • 28
0

One thing you might find useful is the specific requests that can be passed to primitives such as resources. For example you can ask a resource how many users it currently has or how big the queue to use the resource is with:

All of these commands can be found in the documentation, here is the resource example: https://simpy.readthedocs.io/en/latest/api_reference/simpy.resources.html

Harry Munro
  • 304
  • 2
  • 12
  • I guess I was interested in knowing if it is possible to stop the simulation at a particular point of time and have an interactive session to explore what is occurring at that point. – Allen Wang Oct 24 '17 at 15:18