我是否需要 FileLock 来读取其他批处理使用文件锁定写入的文件?
我有一堆进程同时从 Python 访问和修改 csv 文件(使用 FileLock
安全地执行此操作)。我使用 Pandas
包访问该文件。
我想启动另一批进程,这些进程将访问同一个文件(读取)但不修改它。 我可以在不使用锁定系统的情况下访问该文件,并且仍然使第一个写入过程不受此影响吗?
如果可以的话,如果文件被锁定,读取文件是否必须等待写入过程完成?
我必须指出,以防不清楚,我不希望写作过程受到阅读过程的影响。然而,在我的例子中,写入过程对文件所做的修改与读取过程无关,所以我不介意它们处于写入的哪个阶段。
I have a bunch of processes accessing and modifying a csv file from Python at the same time (safely doing so with FileLock
). I access the file using the Pandas
package.
I would like to launch another batch of processes which are going to access this same file (reading) but without modifying it.
Can I access this file without using a locking system, and still have the first writing processes unaffected by this?
In case that it is okay to do this, will the reading of the file have to wait for a writing process to finish if it is locked?
I must note, in case that it is not clear, that I do not want the writing processes to be affected by the reading ones. However, the modifications done by the writing processes on the file are not relevant for the reading processes in my case, so I do not mind in which stage of writing they are.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论