Open acreegan opened 8 months ago
This seems to be a connection error. Can you perhaps try again or from a different location? I've just tested it and did not encounter any problems.
I'll try to test from my home network / a vpn this evening. In the meantime, could I suggest adding a few retries to the file downloads? Something like this worked for me (in the Project class of swcc.models.project):
def download_with_retries(self, item, *args, retries=100):
for i in range(retries+1):
try:
item.download(*args)
return
except requests.exceptions.ConnectionError:
if i == retries:
raise
print(f"Error downloading {item}, retry {i+1}... ")
def download(self, folder: Union[Path, str]):
session = current_session()
self.download_with_retries(self.file, folder)
r: requests.Response = session.get(f'{self._endpoint}/{self.id}/download/')
raise_for_status(r)
data = r.json()
files = data['download_paths']
print(f'Downloading {len(files)} files...')
print_progress_bar(0, len(files))
for index, (path, url) in enumerate(files.items()):
file_item: FileType = FileType(url=url)
self.download_with_retries(file_item, Path(folder, *path.split('/')[:-1]))
print_progress_bar(index + 1, len(files))
session.close()
print()
Not sure if I'm somehow doing something wrong, but I am not able to get RunUseCase.py to download data. My authentication with the ShapeWorks data portal works fine, I just always get a ConnectionResetError before the data is finished downloading.
Here is my output: