def fast_blacklisted(x, y=None): # The task should observe a certain computation time such that we can # ensure that it is not stolen due to the blacklisting. If it is too # fast, the standard mechansim shouldn't allow stealing import time time.sleep(0.01)
def access_limited(val, sem): import time with sem: assert len(protected_resource) == 0 protected_resource.append(val) # Interact with the DB time.sleep(0.2) protected_resource.remove(val)
def __reduce__(self): import time time.sleep(self.delay) return (SlowTransmitData, (self.delay, ))
def increment(self): time.sleep(0.1) self.n += 1 return self.n
def __setstate__(self, state): delay = state import time time.sleep(delay) return SlowDeserialize(delay)