pyiron_base icon indicating copy to clipboard operation
pyiron_base copied to clipboard

As the FileTable is implemented as a Singleton it does not update when a new Project is created

Open jan-janssen opened this issue 2 years ago • 0 comments

Reproduce bug:

pr_1 = Project("test_1")
pr_1.db.update()
pr_2 = Project("test_2")
pr_1.path == pr_2.db._project + "/"

This returns True but it should be False.

An ugly workaround:

pr_1 = Project("test_1")
pr_1.db.update()
pr_2 = Project("test_2")
pr_2.db._project = pr_2.path
pr_2.db.force_reset()
pr_1.path == pr_2.db._project + "/"

Now it returns False, still at the same time pr_2.path == pr_1.db._project + "/" would be True. This is a consequence of the FileTable being a Singleton. So what we need is one Singleton per global path.

jan-janssen avatar Jan 30 '23 08:01 jan-janssen