File: PPExample.txt

package info (click to toggle)
python-simpy 2.3.1%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,864 kB
  • sloc: python: 11,171; makefile: 143
file content (28 lines) | stat: -rw-r--r-- 651 bytes parent folder | download | duplicates (5)
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
"""
Example for SimPy with Parallel Python.
"""

import PPExampleProcess
from SimPy.Simulation import *
import pp


def runSimulation(jobNum, numCars):
    sim = SimPy.Simulation.Simulation()
    cars = []
    for i in range(numCars):
        car = PPExampleProcess.Car(sim, i * jobNum + i)
        sim.activate(car, car.run(), at = 0)
        cars.append(car)
    sim.simulate(until = 30)


server = pp.Server(ppservers = ())
for i in range(4):
    job = server.submit(
                        runSimulation, 
                        (i, 2),
                        (),
                        ('SimPy.Simulation', 'PPExampleProcess'))
    job()