Skip to content

Commit 1403b7c

Browse files
authored
Bug fix for parallel execution environments
Have been hitting a rare bug here when deploying FastAPI applications with many worker processes in a Kubernetes environment. A bit of a race condition exists here where multiple workers attempt to create the directory but fail because another worker already created it, resulting in a crash loop.
1 parent 66fafee commit 1403b7c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libpysal/examples/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_data_home():
3939
data_home = environ.get("PYSALDATA", join("~", PYSALDATA))
4040
data_home = expanduser(data_home)
4141
if not exists(data_home):
42-
makedirs(data_home)
42+
makedirs(data_home, exist_ok=True)
4343
return data_home
4444

4545

0 commit comments

Comments
 (0)