-
Notifications
You must be signed in to change notification settings - Fork 0
/
procsim.py
38 lines (31 loc) · 825 Bytes
/
procsim.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import queue
class Generator():
"""
These generate outputs that will flow to Processors.
"""
def __init__(self, outputs):
"""
Set up the generator.
"""
self.outputs = outputs
class Processor():
"""
These convert inputs into outputs.
"""
def __init__(self, inputs, outputs):
"""
Set up the processor.
"""
self.inputs = inputs
self.outputs = outputs
class LoadBalancer():
"""
This directs inputs to a collection of Processors.
"""
def __init__(self, inputs, processors):
"""
Set up the LoadBalancer.
"""
self.inputs = inputs
self.processors = processors
# Could we define the process as a graph with nodes being generators or processors and edges being queues?