Esempio n. 1
0
 def upload(self,
            fileobj,
            bucket,
            key,
            transfer_config=None,
            subscribers=None):
     ''' upload a file using Aspera '''
     check_io_access(fileobj, os.R_OK, True)
     return self._queue_task(bucket, [FilePair(key, fileobj)],
                             transfer_config, subscribers,
                             enumAsperaDirection.SEND)
Esempio n. 2
0
 def download(self,
              bucket,
              key,
              fileobj,
              transfer_config=None,
              subscribers=None):
     ''' download a file using Aspera '''
     check_io_access(os.path.dirname(fileobj), os.W_OK)
     return self._queue_task(bucket, [FilePair(key, fileobj)],
                             transfer_config, subscribers,
                             enumAsperaDirection.RECEIVE)
Esempio n. 3
0
 def download_directory(self,
                        bucket,
                        key,
                        directory,
                        transfer_config=None,
                        subscribers=None):
     ''' download a directory using Aspera '''
     check_io_access(directory, os.W_OK)
     return self._queue_task(bucket, [FilePair(key, directory)],
                             transfer_config, subscribers,
                             enumAsperaDirection.RECEIVE)
Esempio n. 4
0
    def set_log_details(aspera_log_path=None, sdk_log_level=logging.NOTSET):
        ''' set the aspera log path - used by th Ascp process
            set the internal aspera sdk activity - for debug purposes '''
        if aspera_log_path:
            check_io_access(aspera_log_path, os.W_OK)
            AsperaTransferCoordinator.set_log_location(aspera_log_path)

        if sdk_log_level != logging.NOTSET:
            if logger:
                if not len(logger.handlers):
                    handler = logging.StreamHandler()
                    _fmt = '%(asctime)s %(levelname)s %(message)s'
                    handler.setFormatter(logging.Formatter(_fmt))
                    logger.addHandler(handler)
                    logger.setLevel(sdk_log_level)