simpy.util — Utility functions for SimPy

This modules contains various utility functions:

simpy.util.start_delayed(env, generator, delay)

Return a helper process that starts another process for generator after a certain delay.

process() starts a process at the current simulation time. This helper allows you to start a process after a delay of delay simulation time units:

>>> from simpy import Environment
>>> from simpy.util import start_delayed
>>> def my_process(env, x):
...     print('%s, %s' % (env.now, x))
...     yield env.timeout(1)
...
>>> env = Environment()
>>> proc = start_delayed(env, my_process(env, 3), 5)
>>> env.run()
5, 3

Raise a ValueError if delay <= 0.

simpy.util.subscribe_at(event)

Register at the event to receive an interrupt when it occurs.

The most common use case for this is to pass a Process to get notified when it terminates.

Raise a RuntimeError if event has already occurred.

Read the Docs v: 3.0.4
Versions
latest
stable
3.0.10
3.0.9
3.0.8
3.0.7
3.0.6
3.0.5
3.0.4
3.0.3
3.0.2
3.0.1
3.0
Downloads
pdf
htmlzip
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.