简体   繁体   中英

Python: how to read variables from another process?

So i'm building a custom machine learning simulation and wanting to read certain values from a training process, in another one to visualize real time training data.

So for example, the training simulation has an array of values under a data structure. Let's say the data structure is an instantiated class called data . Inside this class, there is a list of values, let's call it values .

This simulation has a training loop, so while that training loop is going, I would like to run another script that can query data.values and do something with it.

Is this possible? - Ideally I would like to keep my simulation code as is so as to not add necessary bulk.

You can use a message queue for that. Add the value to the queue in your loop process and read and visualize with the other application. Take a look at RabbitMQ

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM