Increased the number of attempts and moved the os.makedirs in the protected area

parent 56847997
......@@ -153,8 +153,7 @@ class SampleWrapper(BaseWrapper, TransformerMixin):
if isinstance(samples[0], SampleSet):
return [
SampleSet(
self._samples_transform(sset.samples, method_name),
parent=sset,
self._samples_transform(sset.samples, method_name), parent=sset,
)
for sset in samples
]
......@@ -267,7 +266,7 @@ class CheckpointWrapper(BaseWrapper, TransformerMixin):
load_func=None,
sample_attribute="data",
hash_fn=None,
attempts=5,
attempts=10,
**kwargs,
):
super().__init__(**kwargs)
......@@ -389,11 +388,12 @@ class CheckpointWrapper(BaseWrapper, TransformerMixin):
def save(self, sample):
path = self.make_path(sample)
os.makedirs(os.path.dirname(path), exist_ok=True)
# Gets sample.data or sample.<sample_attribute> if specified
to_save = getattr(sample, self.sample_attribute)
for _ in range(self.attempts):
try:
os.makedirs(os.path.dirname(path), exist_ok=True)
self.save_func(to_save, path)
# test loading
......@@ -453,11 +453,7 @@ class DaskWrapper(BaseWrapper, TransformerMixin):
"""
def __init__(
self,
estimator,
fit_tag=None,
transform_tag=None,
**kwargs,
self, estimator, fit_tag=None, transform_tag=None, **kwargs,
):
super().__init__(**kwargs)
self.estimator = estimator
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment