Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DM-55747.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed maxattemps not working in upload and download files from panda cache
22 changes: 9 additions & 13 deletions python/lsst/ctrl/bps/panda/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,13 +1015,11 @@ def create_archive_file(submit_path, archive_filename, files):
def copy_files_to_pandacache(filename):
from pandaclient import Client

attempt = 0
max_attempts = 3
done = False
while attempt < max_attempts and not done:
for _ in range(max_attempts):
status, out = Client.putFile(filename, True)
if status == 0:
done = True
break
print(f"copy_files_to_pandacache: status: {status}, out: {out}")
if out.startswith("NewFileName:"):
# found the same input sandbox to reuse
Expand Down Expand Up @@ -1063,19 +1061,17 @@ def download_extract_archive(filename, prefix=None):
# Otherwise, the PanDA client the environment setting will not be parsed.
from pandaclient import Client

attempt = 0
max_attempts = 3
while attempt < max_attempts:
for attempt in range(max_attempts):
status, output = Client.getFile(archive_basename, output_path=full_output_filename)
if status == 0:
break
if attempt <= 1:
secs = random.randint(1, 10)
elif attempt <= 2:
secs = random.randint(1, 60)
else:
secs = random.randint(1, 120)
time.sleep(secs)
if attempt < max_attempts - 1:
if attempt < 2:
secs = random.randint(1, 10)
else:
secs = random.randint(1, 60)
time.sleep(secs)
print(f"Download archive file from pandacache status: {status}, output: {output}")
if status != 0:
raise RuntimeError("Failed to download archive file from pandacache")
Expand Down
Loading