Skip to content

Commit 8a542c8

Browse files
authored
Allow connect retry for SMB (#1533)
* Allow connect retry for SMB * pin urllib3 in CI * add dask-expr to downstream env
1 parent 2aa3fe7 commit 8a542c8

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

ci/environment-downstream.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ dependencies:
1717
- moto <5
1818
- sqlalchemy<2
1919
- flask
20+
- dask-expr

ci/environment-py38.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ dependencies:
3636
- nomkl
3737
- jinja2
3838
- tqdm
39+
- urllib3 <=1.26.18
3940
- pip:
4041
- hadoop-test-cluster
4142
- smbprotocol

fsspec/implementations/smb.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,21 @@ def _port(self):
118118
return 445 if self.port is None else self.port
119119

120120
def _connect(self):
121-
smbclient.register_session(
122-
self.host,
123-
username=self.username,
124-
password=self.password,
125-
port=self._port,
126-
encrypt=self.encrypt,
127-
connection_timeout=self.timeout,
128-
)
121+
import time
122+
123+
for _ in range(5):
124+
try:
125+
smbclient.register_session(
126+
self.host,
127+
username=self.username,
128+
password=self.password,
129+
port=self._port,
130+
encrypt=self.encrypt,
131+
connection_timeout=self.timeout,
132+
)
133+
break
134+
except Exception:
135+
time.sleep(0.1)
129136

130137
@classmethod
131138
def _strip_protocol(cls, path):

0 commit comments

Comments
 (0)