Skip to content

Commit

Permalink
permanently fail when source file: missing
Browse files Browse the repository at this point in the history
  • Loading branch information
petersilva committed Jan 27, 2025
1 parent e07314a commit b2b4bd0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion sarracenia/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2259,9 +2259,13 @@ def download(self, msg, options) -> int:
if accelerated:
self.proto[self.scheme].update_file(new_inflight_path)
elif len_written < 0:
logger.error("failed to download %s" % new_file)
if (self.o.inflight != None) and os.path.isfile(new_inflight_path):
os.remove(new_inflight_path)
if len_written == -2: # permanent failure
logger.error("permanent failure to download %s" % new_file)
return -1

logger.error("temporary failure to download %s" % new_file)
return 0
else:
if block_length == 0:
Expand Down
7 changes: 6 additions & 1 deletion sarracenia/transfer/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def get(self,

if not os.path.exists(remote_path):
logger.warning("file to read not found %s" % (remote_path))
return -1
return -2

src = self.local_read_open(remote_path, remote_offset)
dst = self.local_write_open(local_file, local_offset)
Expand All @@ -147,6 +147,11 @@ def getAccelerated(self, msg, remote_file, local_file, length=0, remote_offset=0
arg1 = arg1.replace(' ', '\\ ')
arg2 = local_file

try:
isz = os.stat(arg1).st_size
except FileNotFoundError:
return -2

cmd = self.o.accelCpCommand.replace('%s', arg1)
cmd = cmd.replace('%d', arg2).split()

Expand Down

0 comments on commit b2b4bd0

Please sign in to comment.