Re: Best (simplest) way to share data (Posting On Python-List Prohibited)

Liste des GroupesRevenir à cl python 
Sujet : Re: Best (simplest) way to share data (Posting On Python-List Prohibited)
De : cl (at) *nospam* isbd.net (Chris Green)
Groupes : comp.lang.python
Date : 08. Jul 2024, 14:56:34
Autres entêtes
Message-ID : <294tlk-pqr1.ln1@q957.zbmc.eu>
References : 1 2
User-Agent : tin/2.6.4-20240224 ("Banff") (Linux/6.8.0-36-generic (x86_64))
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
On Sat, 6 Jul 2024 08:28:41 +0100, Chris Green wrote:
 
One fairly obvious way is to have single process/script which reads the
A2D values continuously and writes them to a file.  All other scripts
then read from the file as needed, a simple file lock can then be used
to prevent simultaneous access (well, simultaneous access when the
writing process is writing).
 
The thing with a file is, it persists even when the collector process is
not running. Do you want data that persists when the collector process is
not running?
 
Is this a history of values, or just a snapshot of current values? A
history of values could be written to a database. Databases provide their
own transactions and interlocking to prevent readers from reading partial
updates.
 
There's a separate (crontab driven) process that writes the history to
a sqlite3 database,


If it’s a snapshot of current values, that does not persist when the
collector process is not running, then why not just keep the data in the
memory of the collector process, and have it concurrently listen on a
socket for connections from readers requesting a copy of the current data?

That's exactly the sort of solution I was wondering about.  Is there a
ready made module/library for handling this sort of thing?  Basically
it will just be a string of a few tens of characters that would be
kept up to date by one process and asked for by all the others.

--
Chris Green
·

Date Sujet#  Auteur
6 Jul 24 * Best (simplest) way to share data between processes13Chris Green
6 Jul 24 +- Re: Best (simplest) way to share data between processes1Stefan Ram
6 Jul 24 +* Re: Best (simplest) way to share data between processes2Piergiorgio Sartor
8 Jul 24 i`- Re: Best (simplest) way to share data between processes1Chris Green
7 Jul 24 +* Re: Best (simplest) way to share data (Posting On Python-List Prohibited)5Lawrence D'Oliveiro
8 Jul 24 i`* Re: Best (simplest) way to share data (Posting On Python-List Prohibited)4Chris Green
8 Jul 24 i +* Re: Best (simplest) way to share data2Stefan Ram
9 Jul 24 i i`- Re: Best (simplest) way to share data1Chris Green
9 Jul 24 i `- Re: Best (simplest) way to share data (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
8 Jul 24 +- Re: Best (simplest) way to share data between processes1Barry
8 Jul 24 +- Re: Best (simplest) way to share data between processes1MRAB
8 Jul 24 +- Re: Best (simplest) way to share data between processes1Barry Scott
7 Jul 24 `- Re: Best (simplest) way to share data between processes1Left Right

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal