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

Class Counter

utils/base_utils.py:177–197  ·  view source on GitHub ↗

enable the chief to access worker's total number of updates

Source from the content-addressed store, hash-verified

175
176
177class Counter:
178 """enable the chief to access worker's total number of updates"""
179
180 def __init__(self, val=True):
181 self.val = mp.Value("i", 0)
182 self.lock = mp.Lock()
183
184 def get(self):
185 # used by chief
186 with self.lock:
187 return self.val.value
188
189 def increment(self):
190 # used by workers
191 with self.lock:
192 self.val.value += 1
193
194 def reset(self):
195 # used by chief
196 with self.lock:
197 self.val.value = 0
198
199# Get a render function
200def get_render_func(venv):

Callers 2

main.pyFile · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected