From 82e077c0b2c8f1f3c3bb4cb2056dc8fb67c04f57 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 6 May 2024 15:59:18 +0000 Subject: [PATCH] Add changes for 6c743ee26e1a75c2afa4ceb638060f0556949662 --- _modules/sarracenia/flow.html | 186 ++++++++++++++++++++++++---------- 1 file changed, 133 insertions(+), 53 deletions(-) diff --git a/_modules/sarracenia/flow.html b/_modules/sarracenia/flow.html index 04cc4cfb3..f7f75731a 100644 --- a/_modules/sarracenia/flow.html +++ b/_modules/sarracenia/flow.html @@ -2120,15 +2120,20 @@

Source code for sarracenia.flow

                 (remote_offset == 0) and ( msg['local_offset'] == 0)
 
             if not self.o.dry_run:
-                if accelerated:
-                    len_written = self.proto[self.scheme].getAccelerated(
-                        msg, remote_file, new_inflight_path, block_length, remote_offset, exactLength)
-                    #FIXME: no onfly_checksum calculation during download.
-                else:
-                    self.proto[self.scheme].set_path(new_inflight_path)
-                    len_written = self.proto[self.scheme].get(
-                        msg, remote_file, new_inflight_path, remote_offset,
-                        msg['local_offset'], block_length, exactLength)
+                try:
+                    if accelerated:
+                        len_written = self.proto[self.scheme].getAccelerated(
+                            msg, remote_file, new_inflight_path, block_length, remote_offset, exactLength)
+                        #FIXME: no onfly_checksum calculation during download.
+                    else:
+                        self.proto[self.scheme].set_path(new_inflight_path)
+                        len_written = self.proto[self.scheme].get(
+                            msg, remote_file, new_inflight_path, remote_offset,
+                            msg['local_offset'], block_length, exactLength)
+                except Exception as ex:
+                    logger.error( f"could not get {remote_file}: {ex}" )
+                    return False
+
             else:
                 len_written = block_length
 
@@ -2207,9 +2212,8 @@ 

Source code for sarracenia.flow

                         self.proto[self.scheme].delete(remote_file)
                     logger.debug('file deleted on remote site %s' %
                                  remote_file)
-                except:
-                    logger.error('unable to delete remote file %s' %
-                                 remote_file)
+                except Exception as ex:
+                    logger.error( f'unable to delete remote file {remote_file}: {ex}' )
                     logger.debug('Exception details: ', exc_info=True)
 
             if (self.o.acceptSizeWrong or (block_length == 0)) and (len_written > 0):
@@ -2354,13 +2358,21 @@ 

Source code for sarracenia.flow

             cwd = None
             if hasattr(self.proto[self.scheme], 'getcwd'):
                 if not self.o.dry_run:
-                    cwd = self.proto[self.scheme].getcwd()
+                    try:
+                        cwd = self.proto[self.scheme].getcwd()
+                    except Exception as ex:
+                        logger.error( f"could not getcwd: {ex}" )
+                        return False
 
             if cwd != new_dir:
                 logger.debug("%s_transport send cd to %s" %
                              (self.scheme, new_dir))
                 if not self.o.dry_run:
-                    self.proto[self.scheme].cd_forced(775, new_dir)
+                    try:
+                        self.proto[self.scheme].cd_forced(775, new_dir)
+                    except Exception as ex:
+                        logger.error( f"could not chdir to {new_dir}: {ex}" )
+                        return False
 
             #=================================
             # delete event
@@ -2372,9 +2384,18 @@ 

Source code for sarracenia.flow

                         logger.debug("message is to remove %s" % new_file)
                         if not self.o.dry_run:
                             if 'directory' in msg['fileOp']: 
-                                self.proto[self.scheme].rmdir(new_file)
+                                try:
+                                    self.proto[self.scheme].rmdir(new_file)
+                                except Exception as ex:
+                                    logger.error( f"could not rmdir {new_file}: {ex}" )
+                                    return False
                             else:
-                                self.proto[self.scheme].delete(new_file)
+                                try:
+                                    self.proto[self.scheme].delete(new_file)
+                                except Exception as ex:
+                                    logger.error( f"could not delete {new_file}: {ex}" )
+                                    return False
+
                         msg.setReport(201, f'file or directory removed')
                         self.metrics['flow']['transferTxFiles'] += 1
                         self.metrics['flow']['transferTxLast'] = msg['report']['timeCompleted']
@@ -2386,7 +2407,12 @@ 

Source code for sarracenia.flow

                     if hasattr(self.proto[self.scheme], 'delete'):
                         logger.debug( f"message is to rename {msg['fileOp']['rename']} to {new_file}" )
                         if not self.o.dry_run:
-                            self.proto[self.scheme].rename(msg['fileOp']['rename'], new_file)
+                            try:
+                                self.proto[self.scheme].rename(msg['fileOp']['rename'], new_file)
+                            except Exception as ex:
+                                logger.error( f"could not rename {new_file}: {ex}" )
+                                return False
+
                         msg.setReport(201, f'file renamed')
                         self.metrics['flow']['transferTxFiles'] += 1
                         self.metrics['flow']['transferTxLast'] = msg['report']['timeCompleted']
@@ -2400,7 +2426,11 @@ 

Source code for sarracenia.flow

                     if hasattr(self.proto[self.scheme], 'mkdir'):
                         logger.debug( f"message is to mkdir {new_file}")
                         if not self.o.dry_run:
-                            self.proto[self.scheme].mkdir(new_file)
+                            try:
+                                self.proto[self.scheme].mkdir(new_file)
+                            except Exception as ex:
+                                logger.error( f"could not mkdir {new_file}: {ex}" )
+                                return False
                         msg.setReport(201, f'directory created')
                         self.metrics['flow']['transferTxFiles'] += 1
                         self.metrics['flow']['transferTxLast'] = msg['report']['timeCompleted']
@@ -2419,7 +2449,11 @@ 

Source code for sarracenia.flow

                     if hasattr(self.proto[self.scheme], 'link'):
                         logger.debug("message is to link %s to: %s" % (new_file, msg['fileOp']['hlink']))
                         if not self.o.dry_run:
-                            self.proto[self.scheme].link(msg['fileOp']['hlink'], new_file)
+                            try:
+                                self.proto[self.scheme].link(msg['fileOp']['hlink'], new_file)
+                            except Exception as ex:
+                                logger.error( f"could not link {new_file}: {ex}" )
+                                return False
                         return True
                     logger.error("%s, hardlinks not supported" % self.scheme)
                     return False
@@ -2429,7 +2463,11 @@ 

Source code for sarracenia.flow

                     if hasattr(self.proto[self.scheme], 'symlink'):
                         logger.debug("message is to link %s to: %s" % (new_file, msg['fileOp']['link']))
                         if not self.o.dry_run:
-                             self.proto[self.scheme].symlink(msg['fileOp']['link'], new_file)
+                            try:
+                                self.proto[self.scheme].symlink(msg['fileOp']['link'], new_file)
+                            except Exception as ex:
+                                logger.error( f"could not symlink {new_file}: {ex}" )
+                                return False
                         msg.setReport(201, f'file linked')
                         self.metrics['flow']['transferTxFiles'] += 1
                         self.metrics['flow']['transferTxLast'] = msg['report']['timeCompleted']
@@ -2480,38 +2518,64 @@ 

Source code for sarracenia.flow

 
             if inflight == None or (('blocks' in msg) and
                                     (msg['blocks']['method'] != 'inplace')):
-                if not self.o.dry_run:
-                    if accelerated:
-                        len_written = self.proto[self.scheme].putAccelerated( msg, local_file, new_file)
-                    else:
-                        len_written = self.proto[self.scheme].put( msg, local_file, new_file)
+                try:
+                    if not self.o.dry_run:
+                        if accelerated:
+                            len_written = self.proto[self.scheme].putAccelerated( msg, local_file, new_file)
+                        else:
+                            len_written = self.proto[self.scheme].put( msg, local_file, new_file)
+                except Exception as ex:
+                    logger.error( f"could not send inflight=None {new_file}: {ex}" )
+                    return False
+                
             elif (('blocks' in msg)
                   and (msg['blocks']['method'] == 'inplace')):
                 if not self.o.dry_run:
-                    self.proto[self.scheme].put(msg, local_file, new_file, offset,
+                    try:
+                        self.proto[self.scheme].put(msg, local_file, new_file, offset,
                                             new_offset, msg['size'])
+                    except Exception as ex:
+                        logger.error( f"could not send inplace {new_file}: {ex}" )
+                        return False
+
             elif inflight == '.':
                 new_inflight_path = '.' + new_file
                 if not self.o.dry_run:
-                    if accelerated:
-                        len_written = self.proto[self.scheme].putAccelerated(
-                            msg, local_file, new_inflight_path)
-                    else:
-                        len_written = self.proto[self.scheme].put(
-                            msg, local_file, new_inflight_path)
-                    self.proto[self.scheme].rename(new_inflight_path, new_file)
+                    try:
+                        if accelerated:
+                            len_written = self.proto[self.scheme].putAccelerated(
+                                msg, local_file, new_inflight_path)
+                        else:
+                            len_written = self.proto[self.scheme].put(
+                                msg, local_file, new_inflight_path)
+                    except Exception as ex:
+                        logger.error( f"could not send inflight={inflight} {new_file}: {ex}" )
+                        return False
+                    try:
+                        self.proto[self.scheme].rename(new_inflight_path, new_file)
+                    except Exception as ex:
+                        logger.error( f"could not rename inflight={inflight} {new_file}: {ex}" )
+                        return False
                 else:
                     len_written = msg['size']
 
             elif inflight[0] == '.':
                 new_inflight_path = new_file + inflight
                 if not self.o.dry_run:
-                    if accelerated:
-                        len_written = self.proto[self.scheme].putAccelerated(
-                            msg, local_file, new_inflight_path)
-                    else:
-                        len_written = self.proto[self.scheme].put(msg, local_file, new_inflight_path)
-                    self.proto[self.scheme].rename(new_inflight_path, new_file)
+                    try:
+                        if accelerated:
+                            len_written = self.proto[self.scheme].putAccelerated(
+                                msg, local_file, new_inflight_path)
+                        else:
+                            len_written = self.proto[self.scheme].put(msg, local_file, new_inflight_path)
+                    except Exception as ex:
+                        logger.error( f"could not send inflight={inflight} {new_file}: {ex}" )
+                        return False
+                    try:
+                        self.proto[self.scheme].rename(new_inflight_path, new_file)
+                    except Exception as ex:
+                        logger.error( f"could not rename inflight={inflight} {new_file}: {ex}" )
+                        return False
             elif options.inflight[-1] == '/':
                 if not self.o.dry_run:
                     try:
@@ -2522,25 +2586,41 @@ 

Source code for sarracenia.flow

                         pass
                 new_inflight_path = options.inflight + new_file
                 if not self.o.dry_run:
-                    if accelerated:
-                        len_written = self.proto[self.scheme].putAccelerated(
-                            msg, local_file, new_inflight_path)
-                    else:
-                        len_written = self.proto[self.scheme].put(
-                            msg, local_file, new_inflight_path)
-                    self.proto[self.scheme].rename(new_inflight_path, new_file)
+                    try:
+                        if accelerated:
+                            len_written = self.proto[self.scheme].putAccelerated(
+                                msg, local_file, new_inflight_path)
+                        else:
+                            len_written = self.proto[self.scheme].put(
+                                msg, local_file, new_inflight_path)
+                    except Exception as ex:
+                        logger.error( f"could not send inflight={inflight} {new_file}: {ex}" )
+                        return False
+                    try:
+                        self.proto[self.scheme].rename(new_inflight_path, new_file)
+                    except Exception as ex:
+                        logger.error( f"could not rename inflight={inflight} {new_file}: {ex}" )
+                        return False
                 else:
                     len_written = msg['size']
             elif inflight == 'umask':
                 if not self.o.dry_run:
                     self.proto[self.scheme].umask()
-                    if accelerated:
-                        len_written = self.proto[self.scheme].putAccelerated(
-                            msg, local_file, new_file)
-                    else:
-                        len_written = self.proto[self.scheme].put(
-                            msg, local_file, new_file)
-                    self.proto[self.scheme].put(msg, local_file, new_file)
+                    try:
+                        if accelerated:
+                            len_written = self.proto[self.scheme].putAccelerated(
+                                msg, local_file, new_file)
+                        else:
+                            len_written = self.proto[self.scheme].put(
+                                msg, local_file, new_file)
+                    except Exception as ex:
+                        logger.error( f"could not send inflight={inflight} {new_file}: {ex}" )
+                        return False
+                    try:
+                        self.proto[self.scheme].put(msg, local_file, new_file)
+                    except Exception as ex:
+                        logger.error( f"could not rename inflight={inflight} {new_file}: {ex}" )
+                        return False
                 else:
                     len_written = msg['size']