I've been trying to determine a way to cancel any boto3 upload/download calls. When I was checking the underlying "manager" object in the S3Transfer, i found the "shutdown" method.
But calling this method results in an exception being thrown.
client = boto3.client( 's3' )
transfer = S3Transfer( client )
transfer.download_file( bucket, key, to_file )
# Call just after the download starts
transfer._manager.shutdown( True )
The thrown exception is
python-BaseException
Traceback (most recent call last):
File "/opt/.../lib/python3.8/site-packages/s3transfer/futures.py", line 278, in cancel
self._exception = exc_type(msg)
TypeError: 'str' object is not callable
From what I found, the shutdown command is calling a protected member. But the called method signature is different.
I've been trying to determine a way to cancel any boto3 upload/download calls. When I was checking the underlying "manager" object in the S3Transfer, i found the "shutdown" method.
But calling this method results in an exception being thrown.
The thrown exception is
From what I found, the shutdown command is calling a protected member. But the called method signature is different.
The location the shutdown call is here: https://github.com/boto/s3transfer/blob/960fc1617882b854b141e368c6b3fc4be6334847/s3transfer/manager.py#L588