Skip to content

Commit

Permalink
Use more attempts to download bursts
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Pechnikov committed Aug 23, 2024
1 parent d6b74ad commit 063b321
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pygmtsar/pygmtsar/ASF.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ def download_bursts(self, basedir, bursts, session=None, n_jobs=8, joblib_backen
# supress asf_search 'UserWarning: File already exists, skipping download'
warnings.filterwarnings("ignore", category=UserWarning)
# repeat failed downloads
retries = 100
retries_timeout = 2
retries = 300
retries_timeout = 3

def filter_azimuth_time(items, start_utc_dt, stop_utc_dt, delta=3):
return [item for item in items if
Expand Down Expand Up @@ -400,7 +400,7 @@ def download_burst(result, basedir, session):
print(f"Failed attempt {retry+1} to download {tmp_file}: {e}")
time.sleep(retries_timeout)
# check if the file is really downloaded
assert os.path.exists(tmp_file), f'ERROR: TiFF file {tmp_file} is not downloaded and validated'
assert os.path.exists(tmp_file), f'ERROR: TiFF file {tmp_file} is not downloaded and validated in {retries} retries'
# move to persistent name
os.rename(tmp_file, tif_file)

Expand Down Expand Up @@ -437,7 +437,7 @@ def download_burst(result, basedir, session):
print(f"Failed attempt {retry+1} to download and parse {manifest_file}: {e}")
time.sleep(retries_timeout)
# check if the file is really downloaded
assert os.path.exists(manifest_file), f'ERROR: manifest file {manifest_file} is not downloaded and validated'
assert os.path.exists(manifest_file), f'ERROR: manifest file {manifest_file} is not downloaded and validated in {retries} retries'
# parse xml
with open(manifest_file, 'r') as file:
xml_content = file.read()
Expand Down

0 comments on commit 063b321

Please sign in to comment.