How to enforce only one running instance of a process in python Django framework?
问题 I have a python Django manage command that should be called upon receiving an input file but this command is not safe for parallel calls. So an input file should be processed only and only when there is no other file being processed. One solution that I have is to use a lock file. Basically, create a lock file at the start of the process and delete it at the end. I'm worried that if the process crashes the lock file won't be deleted and consequently none of the other files would be processed