---------------------------------------------------------------------------
OSError Traceback (most recent call last)
in
----> 1 s = my_long_func("arg")
~/path/to/my/env/lib/python3.7/site-packages/cachier/core.py in func_wrapper(*args, **kwds)
169 return _calc_entry(core, key, func, args, kwds)
170 _print('No entry found. No current calc. Calling like a boss.')
--> 171 return _calc_entry(core, key, func, args, kwds)
172
173 def clear_cache():
~/path/to/my/env/lib/python3.7/site-packages/cachier/core.py in _calc_entry(core, key, func, args, kwds)
65 core.mark_entry_being_calculated(key)
66 # _get_executor().submit(core.mark_entry_being_calculated, key)
---> 67 func_res = func(*args, **kwds)
68 core.set_entry(key, func_res)
69 # _get_executor().submit(core.set_entry, key, func_res)
~/path/to/my/src.py in my_long_func.py(kwarg, another_arg)
47 @cachier(stale_after=timedelta(weeks=1))
48 def my_long_func.py(kwarg: str, another_arg: bool = False):
---> 49 res_df = wrapped_func(kwarg=kwarg, another_arg="string")
50 if another_arg:
51 return res_df.query("valid_data == True")
~/path/to/my/env/lib/python3.7/site-packages/cachier/core.py in func_wrapper(*args, **kwds)
165 _print('No value but being calculated. Waiting.')
166 try:
--> 167 return core.wait_on_entry_calc(key)
168 except RecalculationNeeded:
169 return _calc_entry(core, key, func, args, kwds)
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value
~/path/to/my/env/lib/python3.7/site-packages/cachier/pickle_core.py in wait_on_entry_calc(self, key)
187 recursive=True
188 )
--> 189 observer.start()
190 observer.join(timeout=1.0)
191 if observer.isAlive():
~/path/to/my/env/lib/python3.7/site-packages/watchdog/observers/api.py in start(self)
253 def start(self):
254 for emitter in self._emitters:
--> 255 emitter.start()
256 super(BaseObserver, self).start()
257
~/path/to/my/env/lib/python3.7/site-packages/watchdog/utils/init.py in start(self)
108
109 def start(self):
--> 110 self.on_thread_start()
111 threading.Thread.start(self)
112
~/path/to/my/env/lib/python3.7/site-packages/watchdog/observers/inotify.py in on_thread_start(self)
119 def on_thread_start(self):
120 path = unicode_paths.encode(self.watch.path)
--> 121 self._inotify = InotifyBuffer(path, self.watch.is_recursive)
122
123 def on_thread_stop(self):
~/path/to/my/env/lib/python3.7/site-packages/watchdog/observers/inotify_buffer.py in init(self, path, recursive)
33 BaseThread.init(self)
34 self._queue = DelayedQueue(self.delay)
---> 35 self._inotify = Inotify(path, recursive)
36 self.start()
37
~/path/to/my/env/lib/python3.7/site-packages/watchdog/observers/inotify_c.py in init(self, path, recursive, event_mask)
186 inotify_fd = inotify_init()
187 if inotify_fd == -1:
--> 188 Inotify._raise_error()
189 self._inotify_fd = inotify_fd
190 self._lock = threading.Lock()
~/path/to/my/env/lib/python3.7/site-packages/watchdog/observers/inotify_c.py in _raise_error()
413 raise OSError("inotify watch limit reached")
414 elif err == errno.EMFILE:
--> 415 raise OSError("inotify instance limit reached")
416 else:
417 raise OSError(os.strerror(err))
I just tried out cachier
for the first run and couldn't at first understand why it was not working and the reason seems to be that caching is not done if the function returns None. Is this intended?
Consider the following example:
from time import sleep
from timeit import default_timer as timer
from cachier import cachier
@cachier()
def func():
sleep(1)
t0 = timer()
func()
t1 = timer()
func()
t2 = timer()
print(t1 - t0)
print(t2 - t1)
where no caching is done.
However, changing the function to be:
@cachier()
def func():
sleep(1)
return 1
enables the caching
redis is the king of cache, a backend for it can be cool
(on my todo list, down on the bottom of it)
The nature of virtual envs is to support different versions. pickling to home essentially breaks the ability to cache pickles of objects from different versions. This can lead to very strange exceptions like fsnotify exceeding its limits.
Therefore I propose to have a path inside the venv if we are in a virtual environment.
To create the key for a cache entry, the current implementation uses the following expression:
key = args + tuple(sorted(kwds.items()))
For a function with signature spam(*args, **kwargs)
, this will generate the same key for spam(1, a=2)
and spam(1, ("a", 2))
, which may be undesirable.
Well, my use case is:
I have a function that queries the database, the input is the database alias and the query.
It's working great, but I just saw that the cache size will grow indefinitely, right?
My idea was to keep track of the stale date, and check for all elements of the object if any was already "staled", and delete it.
Just to keep the filesize at a minimum.
I never worked with Classes like this project, but I can try something.
What do you think?
I'm using it wrong?
Issue:
In certain cases the MongoDB backend might leave a deadlock behind, blocking all subsequent requests from being processed.
Explanation:
In https://github.com/shaypal5/cachier/blob/17d1b7cc9c57dabb0c40bf7ef748bd68d4a3628c/cachier/core.py#L64 ๐
def _calc_entry(core, key, func, args, kwds):
try:
core.mark_entry_being_calculated(key)
# _get_executor().submit(core.mark_entry_being_calculated, key)
func_res = func(*args, **kwds)
core.set_entry(key, func_res)
# _get_executor().submit(core.set_entry, key, func_res)
return func_res
finally:
core.mark_entry_not_calculated(key)
The happy path procedure is:
- Mark the entry as being calculated
- Call the decorated function
3a. If no exception has been thrown, set the result in cache.
3b. If an exception has been thrown, cleanup the entry in the cache.
The buggy path:
- Mark the entry as being calculated
- Call the decorated function.
- While running the decorated function any major issue occurs. Imagine losing MongoDB connection or the service being stopped with Ctrl-C or Ctrl-D.
- Restart the service again, call the decorated function again.
- The entry still exists in DB (because
core.mark_entry_not_calculated(key)
was never called); resulting in an infinite loop in this line.
def wait_on_entry_calc(self, key):
while True:
time.sleep(MONGO_SLEEP_DURATION_IN_SEC)
key, entry = self.get_entry_by_key(key)
if entry is None:
raise RecalculationNeeded()
if entry is not None and not entry['being_calculated']:
return entry['value']
Possible solutions:
- Avoid creating the lock to begin with; which will make calls to the decorated function to pile up.
- Set a timeout so the code will loop for a specific period of time, after which it will assume the lock is a deadlock and proceed to call the decorated function. This approach has been submitted in a PR.
Please don't hesitate in reaching out if you need more clarifications or some modifications in the PR.
Thanks
Nic
Allow a way to specify the cache directory
In addition to configuring the cache file path for each wrapped function, a way to globally change the location of the general cache directory for all cachier
caches is required.
A possible API:
>>> import cachier
>>> cachier.get_global_cache_dpath()
'/home/myuser/.cachier'
>>> cachier.set_global_cache_dpath('/home/opt/caches/')
>>> cachier.get_global_cache_dpath()
'/home/opt/caches/'
Looking at how arg and kwarg hashing is done now, it is a little different from how the stdlib does it with functools.cache (see https://github.com/python/cpython/blob/3.10/Lib/functools.py#L448)
I think this builtin method is
- more efficient
- more bugfree (note the kwd_mark that separates the args from kwargs)
- better maintained
What about switching to just using functools._make_key
as the default hash function? Important to consider if the order of kwargs is important, they decided it was NOT, but I think swapping to this would be breaking for users here.
As a side note, monogo_core.get_entry() and memory_core.get_entry() have duplicated hashing logic that I think could get factored out?
Cachier is broken for me since #17 for string arguments (probably for other built-in objects as well).
This comes from the fact that the built-in hash()
method is not deterministic between runs in python.
Therefore calling it on the arguments of the function for caching purpose does not work between multiple runs because it will hash to different values.
The problematic call to hash()
is here.
Repro
Run this script twice in a row and it will re-execute the method test()
each time without relying on the cache:
import time
from cachier import cachier
@cachier(pickle_reload=False)
def test(text):
time.sleep(1)
print(text)
print(hash(text))
return 0
start_time = time.time()
text = 'foo'
print(hash(text))
test(text)
print(time.time() - start_time)
This looks like a solid cache tool, but lack of an in memory backend to both avoid filesystem interaction and not require an external dependency like running mongodb, is a pretty big hinderance for me.
Hi, I love cachier!
I'm just investigating some things in our stack that appear to be broken with the release of cachier 1.1x: monarch-initiative/biolink-api#53
Is there a list of changes for the 1.x series?
@shaoyucheng used cachier directly in his business code, and found it was not working. He then set up some test code to verify, and it worked well as expected. He finally found the key point was his business code was running through importlib module and the underlying framework codes generated a uuid for every module imported at every running time which disturbed the unique module name obtained by cachier.
- It's a point worthy of attention if your running mechanism is similar to his.
- It might be worthwhile supporting this functionality.
If you don't have pymongo installed, you get the following warning message whenever you use Cachier:
Cachier warning: pymongo was not found. MongoDB cores will not work.
There should be some way to turn this off.
The pickling conflicts with the mock objects otherwise, and it seems like a clean solution could be to have a way to globally disarm all caching.
Since no one else has brought this question up, I assume there's a better way to work around this that I'm unaware of.
for example, run a python script multiple times, and i want the same function with same arguments could read from cache instead of calc again.
I'm seeing an issue with cachier
where I'm getting Bad File Descriptor
errors. Just want to make sure I'm not completely abusing it here, I have multiple writers (and readers) accessing a shared cache directory via NFS.
Am I way off the mark here for thinking this would ever work correctly?
Hi, Great package, finally found this one that I was able to use for my purposes. I am running into an issue using 3.7 python and pickle not being able to save over 4GB. I have forked and updated line 139 of pickle_core.py to use protocol 4:
pickle.dump(cache, cache_file, protocol=4)
However, I am not sure if earlier version of python would accept this hard coded protocol which is why I didn't do a PR. I am wondering if you could update your package to include this somehow?
Thanks again for for cachier :)
I cannot get it to run in Python 2.
The first complaint is about line 458 in core.py
(due to)
I also notices some super()
calls [1] [2], which are only supported in Python 3.
Hi, I'd like to propose an enhancement similar to verbose_cache
.
I will call the new keyword argument notify_fresh
. The wrapped function will return a tuple where the second value indicates if the value was fresh from cache.
This will enable logic outside the scope of the cached function to make decisions based on whether the data came from the cache.
For example, let's pretend we have a snobby server that hates being asked too many questions in rapid succession. If we get our answer fresh from the cache, then we can ask the next question right away:
@cachier()
def small_talk_to_snobby_server(query):
response = "I'm fine, thank you!"
return response
if __name__ == "__main__":
response, is_fresh = small_talk_to_snobby_server(query="How are you?", notify_fresh=True)
if not is_fresh:
sleep(60)
response = small_talk_to_snobby_server(query="What are you up to these days?")
Some self-critique
I find it rather clunky and API-breaking to make functions return a different data type than expected. I do not know any other way around this.
Recommend Projects
-
-
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
An Open Source Machine Learning Framework for Everyone
-
The Web framework for perfectionists with deadlines.
-
A PHP framework for web artisans
-
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
Some thing interesting about web. New door for the world.
-
A server is a program made to process requests and deliver data to clients.
-
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Some thing interesting about visualization, use data art
-
Some thing interesting about game, make everyone happy.
-
Recommend Org
-
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Open source projects and samples from Microsoft.
-
Google โค๏ธ Open Source for everyone.
-
Alibaba Open Source for everyone
-
Data-Driven Documents codes.
-
China tencent open source team.
-