sevenbridges.transfer package¶
Submodules¶
sevenbridges.transfer.download module¶
-
class
sevenbridges.transfer.download.
DPartedFile
(file_path, session, url, file_size, part_size, retry, timeout, pool)¶ Bases:
object
-
done
()¶
-
get_parts
()¶ Partitions the file and saves the part information in memory.
-
submit
()¶ Partitions the file into chunks and submits them into group of 4 for download on the api download pool.
-
-
class
sevenbridges.transfer.download.
Download
(url, file_path, part_size=5242880, retry_count=5, timeout=60, api=None)¶ Bases:
threading.Thread
-
add_callback
(callback=None, errorback=None)¶ Adds a callback that will be called when the download finishes successfully or when error is raised.
-
add_progress_callback
(callback=None)¶ Adds a progress callback that will be called each time a get_parts is successfully downloaded. The first argument of the progress callback will be a progress object described in sevenbridges.transfer.utils
Parameters: callback – Callback function
-
duration
¶
-
path
¶
-
pause
()¶ Pauses the download. :raises SbgError: If upload is not in RUNNING state.
-
progress
¶
-
resume
()¶ Resumes the download. :raises SbgError: If download is not in RUNNING state.
-
run
()¶ Runs the thread! Should not be used use start() method instead.
-
start
()¶ Starts the download. :raises SbgError: If download is not in PREPARING state.
-
start_time
¶
-
status
¶
-
stop
()¶ Stops the download. :raises SbgError: If download is not in PAUSED or RUNNING state.
-
wait
()¶ Blocks until download is completed.
-
sevenbridges.transfer.upload module¶
-
class
sevenbridges.transfer.upload.
UPartedFile
(fp, file_size, part_size, upload, retry_count, timeout, storage_session, api)¶ Bases:
object
-
done
()¶
-
get_parts
()¶ Partitions the file and saves the parts to be uploaded in memory.
-
submit
()¶ Partitions the file into chunks and submits them into group of 4 for upload on the api upload pool. :return: Futures
-
-
class
sevenbridges.transfer.upload.
Upload
(file_path, project, file_name=None, overwrite=False, part_size=5242880, retry_count=5, timeout=60, api=None)¶ Bases:
threading.Thread
-
add_callback
(callback=None, errorback=None)¶ Adds a callback that will be called when the upload finishes successfully or when error is raised.
-
add_progress_callback
(callback=None)¶ Adds a progress callback that will be called each time a get_parts is successfully uploaded. The first argument of the progress callback will be a progress object described in sevenbridges.transfer.utils
Parameters: callback – Callback function
-
duration
¶
-
file_name
¶
-
pause
()¶ Pauses the upload. :raises SbgError: If upload is not in RUNNING state.
-
progress
¶
-
result
()¶
-
resume
()¶ Resumes the upload that was paused. :raises SbgError: If upload is not in PAUSED state.
-
run
()¶ Runs the thread! Should not be used use start() method instead.
-
start
()¶ Starts the upload. :raises SbgError: If upload is not in PREPARING state.
-
start_time
¶
-
status
¶
-
stop
()¶ Stops the upload. :raises SbgError: If upload is not in PAUSED or RUNNING state.
-
wait
()¶ Blocks until upload is completed.
-
sevenbridges.transfer.utils module¶
-
class
sevenbridges.transfer.utils.
Progress
(num_of_parts, parts_done, bytes_done, file_size, duration)¶ Bases:
object
-
bandwidth
¶
-
bytes_done
¶
-
duration
¶
-
file_size
¶
-
num_of_parts
¶
-
parts_done
¶
-
progress
¶
-
-
sevenbridges.transfer.utils.
simple_progress_bar
(progress)¶
-
sevenbridges.transfer.utils.
total_parts
(file_size, part_size)¶