Skip to content

Commit 8172d9b

Browse files
committed
bugfix
1 parent acd41a3 commit 8172d9b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

python/prophet/models.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,17 @@ def sampling(self, stan_init, stan_data, samples, **kwargs) -> dict:
174174
def cleanup(self):
175175
import cmdstanpy
176176

177-
if hasattr(self , "stan_fit"):
177+
if hasattr(self, "stan_fit"):
178178
fit_result: cmdstanpy.CmdStanMLE | cmdstanpy.CmdStanMCMC = self.stan_fit
179-
for fpath in fit_result.runset.csv_files:
180-
pathlib.Path(fpath).unlink(missing_ok=True)
179+
to_remove = (
180+
fit_result.runset.csv_files +
181+
fit_result.runset.diagnostic_files +
182+
fit_result.runset.stdout_files +
183+
fit_result.runset.profile_files
184+
)
185+
for fpath in to_remove:
186+
if pathlib.Path(fpath).is_file():
187+
pathlib.Path(fpath).unlink()
181188

182189
@staticmethod
183190
def sanitize_custom_inits(default_inits, custom_inits):

0 commit comments

Comments
 (0)