I
I
Ilya Chichak2016-12-19 19:16:25
Django
Ilya Chichak, 2016-12-19 19:16:25

How to create Singleton with process control?

there is a long process that only superuser has access to.
is launched in another thread, similar to the article .
how to make a singleton with the ability to control employment, that is, when accessing it, either a process is started, or a message is returned that the process is already running?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
OnYourLips, 2016-12-19
@OnYourLips

Singleton has nothing to do with it.
You need inter-process communication facilities.
from multiprocessing import Lock

S
sim3x, 2016-12-19
@sim3x

Create a file and check for its existence
Or write a label to the database

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question