I'm doing some research in neuroscience and I'm using python's tinydb library for keeping track of all my model training runs and the data they generate.
One of the issues I realized might come up is when I try to train multiple models on a cluster. What could happen is that two threads might try to write to the tinydb json file at the same time.
Can someone please let me know if this will be an issue?
Python processes, threads and coroutines offers synchronization primitives such as locks, rlocks, conditions and semaphores. If your threads access randomly one or more shared variables then every thread should acquire lock on this variable so that another thread couldn't access it.
Paraphrased question: Can I update a json file concurrently?
Answer: No
Suggestions:
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.