MCPcopy Create free account
hub / github.com/BIT-MCS/DRL-eFresh / TrafficLight

Class TrafficLight

utils/base_utils.py:161–174  ·  view source on GitHub ↗

used by chief to allow workers to run or not

Source from the content-addressed store, hash-verified

159
160
161class TrafficLight:
162 """used by chief to allow workers to run or not"""
163
164 def __init__(self, val=True):
165 self.val = mp.Value("b", False)
166 self.lock = mp.Lock()
167
168 def get(self):
169 with self.lock:
170 return self.val.value
171
172 def switch(self):
173 with self.lock:
174 self.val.value = (not self.val.value)
175
176
177class Counter:

Callers 1

main.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected