MCPcopy Create free account
hub / github.com/numpy/numpy / simulate

Function simulate

tools/travis-sorter.py:130–161  ·  view source on GitHub ↗
(jobs, limit)

Source from the content-addressed store, hash-verified

128
129
130def simulate(jobs, limit):
131
132 time = 0
133
134 # summarise(jobs)
135
136 while True:
137 # Check if any have ended
138 for job in jobs:
139 if job.status == "active":
140 if time >= job.started + job.length:
141 # print("{}/{} Finished:".format(count_status(jobs, "active"), limit))
142 job.ended = time
143 job.status = "finished"
144 # print(job)
145
146 # Check if any can start
147 for job in jobs:
148 if job.status == "not started":
149 if count_status(jobs, "active") < limit:
150 # print("{}/{} Starting:".format(count_status(jobs, "active"), limit))
151 job.started = time
152 job.status = "active"
153 # print(job)
154
155 time += 1
156
157 # Exit loop?
158 if count_status(jobs, "finished") == len(jobs):
159 break
160
161 summarise(jobs)
162
163
164def do_thing(repo, number):

Callers 1

travis-sorter.pyFile · 0.85

Calls 2

count_statusFunction · 0.85
summariseFunction · 0.85

Tested by

no test coverage detected