J
J
Jo Jo2020-06-25 23:00:10
Python
Jo Jo, 2020-06-25 23:00:10

How to manage a running Python process? Is there something like an API for running processes?

I welcome everyone. The bottom line is this, there is a Python script, quite heavy, it runs for more than 2 seconds, it takes more than 500 MB of RAM. It opens the browser in the background and does many other things, which is why it's so slow, but not the point.
And in order not to run it every time and not wait until it boots up and is ready to go, I keep it running all the time, and I feed it tasks through the file system, that is, if changes occur in a certain folder, then it processes the task and then hangs in mind.
But I invented this system myself, and I assume that there is some more reliable and faster way to communicate with the running script (it turns out this is essentially a Python daemon).
If there is such a mechanism, please tell the wretched man what it is called and what to google at least. Thanks in advance for your time. You can also do the same in PHP, if there suddenly is a suitable solution.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Saboteur, 2020-06-26
@saboteur_kiev

Manage via signals, sockets, API It is
possible through the file system.

A
Anatoly, 2020-06-25
@Horizon

A socket is a programming interface for providing information exchange between processes. Probably, this is what we are talking about.
https://habr.com/en/post/149077/

C
CityCat4, 2020-06-26
@CityCat4

Pipes, signals, sockets, shared memory, threads. Google on IPC - InterProcess Communication

J
Jo Jo, 2020-06-26
@michael_novikov

I will add. There is this large script that is constantly running and is "on the hook", and there are smaller ones that the user interacts with (data from the form). And the task is to transfer data from the user to the running 'heavy' process.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question