1👍
✅
Wrap your read function in a try/except block marking some external memoization for execution control. I’m using Redis as an example:
from redis import Redis
try:
r_client = Redis() # assuming standard settings
sentinel = r_client.incr("my_sentinel")
if sentinel == 1:
run_command()
else:
r_client.decr("my_sentinel")
except Exception as e:
r_client.decr("my_sentinel")
raise e
0👍
You could create a file named “i_am_running.log” at the beginning of your management command and remove it at the end if it. When running same management command, check for its’ presence. In case of no exist – go further. Otherwise – abort.
- [Answer]-Optimized query to match and exclude multiple ManyToMany entries
- [Answer]-Why when i logout in django after i updated my data appears this error?
- [Answer]-Django – ./manage.py defaults to python 2.x
- [Answer]-JQuery ui autocomplete with Django return 404
Source:stackexchange.com