/usr/lib/rads/venv/lib/python3.13/site-packages/s3transfer/__pycache__
NameSizeModeActions
bandwidth.cpython-313.pyc179660644editdlrm
compat.cpython-313.pyc27020644editdlrm
constants.cpython-313.pyc6880644editdlrm
copies.cpython-313.pyc111430644editdlrm
crt.cpython-313.pyc428680644editdlrm
delete.cpython-313.pyc25350644editdlrm
download.cpython-313.pyc314410644editdlrm
exceptions.cpython-313.pyc19370644editdlrm
futures.cpython-313.pyc287040644editdlrm
manager.cpython-313.pyc262910644editdlrm
processpool.cpython-313.pyc414160644editdlrm
subscribers.cpython-313.pyc36730644editdlrm
tasks.cpython-313.pyc137110644editdlrm
upload.cpython-313.pyc314740644editdlrm
utils.cpython-313.pyc369150644editdlrm
__init__.cpython-313.pyc343430644editdlrm
Edit: /usr/lib/rads/venv/lib/python3.13/site-packages/s3transfer/__pycache__/processpool.cpython-313.pyc (41416B)
jҍSrSSKrSSKrSSKrSSKrSSKrSSKrSSKJr SSK r SSK J r SSK JrJr SSKJrJrJr SSKJrJr SSKJrJr SS KJrJrJrJrJrJ r \RB"\"5r#S r$\RJ"S /S Q5r&\RJ"S /SQ5r'\RPS5r)Sr*"SS5r+"SS5r,"SS\5r-"SS\5r."SS5r/"SS5r0"SS5r1"SS \5r2\2RgS\05 "S!S"\Rh5r5"S#S$\55r6"S%S&\55r7g)'aCSpeeds up S3 throughput by using processes Getting Started =============== The :class:`ProcessPoolDownloader` can be used to download a single file by calling :meth:`ProcessPoolDownloader.download_file`: .. code:: python from s3transfer.processpool import ProcessPoolDownloader with ProcessPoolDownloader() as downloader: downloader.download_file('mybucket', 'mykey', 'myfile') This snippet downloads the S3 object located in the bucket ``mybucket`` at the key ``mykey`` to the local file ``myfile``. Any errors encountered during the transfer are not propagated. To determine if a transfer succeeded or failed, use the `Futures`_ interface. The :class:`ProcessPoolDownloader` can be used to download multiple files as well: .. code:: python from s3transfer.processpool import ProcessPoolDownloader with ProcessPoolDownloader() as downloader: downloader.download_file('mybucket', 'mykey', 'myfile') downloader.download_file('mybucket', 'myotherkey', 'myotherfile') When running this snippet, the downloading of ``mykey`` and ``myotherkey`` happen in parallel. The first ``download_file`` call does not block the second ``download_file`` call. The snippet blocks when exiting the context manager and blocks until both downloads are complete. Alternatively, the ``ProcessPoolDownloader`` can be instantiated and explicitly be shutdown using :meth:`ProcessPoolDownloader.shutdown`: .. code:: python from s3transfer.processpool import ProcessPoolDownloader downloader = ProcessPoolDownloader() downloader.download_file('mybucket', 'mykey', 'myfile') downloader.download_file('mybucket', 'myotherkey', 'myotherfile') downloader.shutdown() For this code snippet, the call to ``shutdown`` blocks until both downloads are complete. Additional Parameters ===================== Additional parameters can be provided to the ``download_file`` method: * ``extra_args``: A dictionary containing any additional client arguments to include in the `GetObject `_ API request. For example: .. code:: python from s3transfer.processpool import ProcessPoolDownloader with ProcessPoolDownloader() as downloader: downloader.download_file( 'mybucket', 'mykey', 'myfile', extra_args={'VersionId': 'myversion'}) * ``expected_size``: By default, the downloader will make a HeadObject call to determine the size of the object. To opt-out of this additional API call, you can provide the size of the object in bytes: .. code:: python from s3transfer.processpool import ProcessPoolDownloader MB = 1024 * 1024 with ProcessPoolDownloader() as downloader: downloader.download_file( 'mybucket', 'mykey', 'myfile', expected_size=2 * MB) Futures ======= When ``download_file`` is called, it immediately returns a :class:`ProcessPoolTransferFuture`. The future can be used to poll the state of a particular transfer. To get the result of the download, call :meth:`ProcessPoolTransferFuture.result`. The method blocks until the transfer completes, whether it succeeds or fails. For example: .. code:: python from s3transfer.processpool import ProcessPoolDownloader with ProcessPoolDownloader() as downloader: future = downloader.download_file('mybucket', 'mykey', 'myfile') print(future.result()) If the download succeeds, the future returns ``None``: .. code:: python None If the download fails, the exception causing the failure is raised. For example, if ``mykey`` did not exist, the following error would be raised .. code:: python botocore.exceptions.ClientError: An error occurred (404) when calling the HeadObject operation: Not Found .. note:: :meth:`ProcessPoolTransferFuture.result` can only be called while the ``ProcessPoolDownloader`` is running (e.g. before calling ``shutdown`` or inside the context manager). Process Pool Configuration ========================== By default, the downloader has the following configuration options: * ``multipart_threshold``: The threshold size for performing ranged downloads in bytes. By default, ranged downloads happen for S3 objects that are greater than or equal to 8 MB in size. * ``multipart_chunksize``: The size of each ranged download in bytes. By default, the size of each ranged download is 8 MB. * ``max_request_processes``: The maximum number of processes used to download S3 objects. By default, the maximum is 10 processes. To change the default configuration, use the :class:`ProcessTransferConfig`: .. code:: python from s3transfer.processpool import ProcessPoolDownloader from s3transfer.processpool import ProcessTransferConfig config = ProcessTransferConfig( multipart_threshold=64 * 1024 * 1024, # 64 MB max_request_processes=50 ) downloader = ProcessPoolDownloader(config=config) Client Configuration ==================== The process pool downloader creates ``botocore`` clients on your behalf. In order to affect how the client is created, pass the keyword arguments that would have been used in the :meth:`botocore.Session.create_client` call: .. code:: python from s3transfer.processpool import ProcessPoolDownloader from s3transfer.processpool import ProcessTransferConfig downloader = ProcessPoolDownloader( client_kwargs={'region_name': 'us-west-2'}) This snippet ensures that all clients created by the ``ProcessPoolDownloader`` are using ``us-west-2`` as their region. N)deepcopy)Config)MAXINT BaseManager)ALLOWED_DOWNLOAD_ARGSMBPROCESS_USER_AGENT)CancelledErrorRetriesExceededError)BaseTransferFutureBaseTransferMeta)S3_RETRYABLE_DOWNLOAD_ERRORSCallArgsOSUtilscalculate_num_partscalculate_range_parametercreate_nested_clientSHUTDOWNDownloadFileRequest transfer_idbucketkeyfilename extra_args expected_size GetObjectJob)rrr temp_filenameroffsetrc#r# [5nSv [R"[RU5 g7fN)"_add_ignore_handler_for_interruptssignalSIGINT)original_handlers I/usr/lib/rads/venv/lib/python3.13/site-packages/s3transfer/processpool.py ignore_ctrl_cr's$9;  MM&--!12s57ch[R"[R[R5$r!)r#r$SIG_IGNr&r"r" s == 77r+c0\rSrSrS\-S\-S4SjrSrg)ProcessTransferConfigi c(XlX lX0lg)aEConfiguration for the ProcessPoolDownloader :param multipart_threshold: The threshold for which ranged downloads occur. :param multipart_chunksize: The chunk size of each ranged download. :param max_request_processes: The maximum number of processes that will be making S3 API transfer-related requests at a time. N)multipart_thresholdmultipart_chunksizemax_request_processes)selfr1r2r3s r&__init__ProcessTransferConfig.__init__s $7 #6 %:"r+)r3r2r1N)__name__ __module__ __qualname____firstlineno__rr5__static_attributes__r*r+r&r-r-sFF ;r+r-c\rSrSrSSjrSSjrSrSrSrSr S r S r S r S r S rSrSrSrSrSrSrSrg)ProcessPoolDownloaderi%NcbUc0n[U5UlX lUc[5Ul[R "S5Ul[R "S5Ul[5Ul SUl [R"5Ul SUlSUlSUl/Ulg)amDownloads S3 objects using process pools :type client_kwargs: dict :param client_kwargs: The keyword arguments to provide when instantiating S3 clients. The arguments must match the keyword arguments provided to the `botocore.session.Session.create_client()` method. :type config: ProcessTransferConfig :param config: Configuration for the downloader NiF) ClientFactory_client_factory_transfer_configr-multiprocessingQueue_download_request_queue _worker_queuer_osutil_started threadingLock _start_lock_manager_transfer_monitor _submitter_workers)r4 client_kwargsconfigs r&r5ProcessPoolDownloader.__init__&s  M,]; & >$9$;D !'6'<'>+ !% r+c @UR5 Uc0nURU5 URR5n[ UUUUUUS9n[ R SU5 URRU5 [UUUUUS9nURXh5n U $)aDownloads the object's contents to a file :type bucket: str :param bucket: The name of the bucket to download from :type key: str :param key: The name of the key to download from :type filename: str :param filename: The name of a file to download to. :type extra_args: dict :param extra_args: Extra arguments that may be passed to the client operation :type expected_size: int :param expected_size: The expected size in bytes of the download. If provided, the downloader will not call HeadObject to determine the object's size and use the provided value instead. The size is needed to determine whether to do a multipart download. :rtype: s3transfer.futures.TransferFuture :returns: Transfer future representing the download rz%Submitting download file request: %s.)rrrrr) _start_if_needed_validate_all_known_argsrLnotify_new_transferrloggerdebugrDputr_get_transfer_future) r4rrrrrrdownload_file_request call_argsfutures r& download_file#ProcessPoolDownloader.download_fileGs6   J %%j1,,@@B 3#!' !   35J  $$(()>?!'  **;B r+c$UR5 g)zXShutdown the downloader It will wait till all downloads are complete before returning. N)_shutdown_if_neededr4s r&shutdownProcessPoolDownloader.shutdown}s   "r+cU$r!r*ras r& __enter__ProcessPoolDownloader.__enter__s r+c[U[5(a'URbURR5 UR 5 gr!) isinstanceKeyboardInterruptrLnotify_cancel_all_in_progressrb)r4exc_type exc_valueargss r&__exit__ProcessPoolDownloader.__exit__s7 i!2 3 3%%1&&DDF r+cUR UR(dUR5 SSS5 g!,(df  g=fr!)rJrG_startras r&rS&ProcessPoolDownloader._start_if_neededs'   ==    "8 AcrUR5 UR5 UR5 SUlg)NT)_start_transfer_monitor_manager_start_submitter_start_get_object_workersrGras r&rqProcessPoolDownloader._starts- ,,.  &&( r+cvUH3nU[;dMSR[5n[SUSU35e g)Nz, zInvalid extra_args key 'z', must be one of: )rjoin ValueError)r4providedkwarg download_argss r&rT.ProcessPoolDownloader._validate_all_known_argssGE11 $ *? @  .ug6''4o7r+c@[X!S9n[URUS9nU$)N)r[r)monitormeta)ProcessPoolTransferMetaProcessPoolTransferFuturerL)r4rr[rr\s r&rY*ProcessPoolDownloader._get_transfer_futures-& +**  r+c[RS5 [5UlURR [ 5 URR 5Ulg)Nz$Starting the TransferMonitorManager.)rVrWTransferMonitorManagerrKstartr"TransferMonitorrLras r&ru5ProcessPoolDownloader._start_transfer_monitor_managersC ;<.0 >?!%!>!>!@r+c [RS5 [URURUR UR URURS9Ul URR5 g)Nz Starting the GetObjectSubmitter.)transfer_configclient_factorytransfer_monitorosutildownload_request_queue worker_queue) rVrWGetObjectSubmitterrAr@rLrFrDrErMrras r&rv&ProcessPoolDownloader._start_submittersa 78, 11//!33<<#'#?#?++   r+cb[RSURR5 [ URR5Hbn[ UR URURURS9nUR5 URRU5 Md g)NzStarting %s GetObjectWorkers.)queuerrr) rVrWrAr3rangeGetObjectWorkerrEr@rLrFrrNappendr4_workers r&rw/ProcessPoolDownloader._start_get_object_workerss +  ! ! 7 7 t,,BBCA$((#33!%!7!7|| F LLN MM  (Dr+cUR UR(aUR5 SSS5 g!,(df  g=fr!)rJrG _shutdownras r&r`)ProcessPoolDownloader._shutdown_if_neededs(   }}   rscrUR5 UR5 UR5 SUlg)NF)_shutdown_submitter_shutdown_get_object_workers"_shutdown_transfer_monitor_managerrGras r&rProcessPoolDownloader._shutdowns-   " ))+ //1 r+cb[RS5 URR5 g)Nz)Shutting down the TransferMonitorManager.)rVrWrKrbras r&r8ProcessPoolDownloader._shutdown_transfer_monitor_managers @A  r+c[RS5 URR[5 UR R 5 g)Nz%Shutting down the GetObjectSubmitter.)rVrWrDrXSHUTDOWN_SIGNALrMrzras r&r)ProcessPoolDownloader._shutdown_submitters3 <= $$((9 r+c[RS5 URH"nURR [ 5 M$ URHnUR 5 M g)Nz#Shutting down the GetObjectWorkers.)rVrWrNrErXrrzrs r&r2ProcessPoolDownloader._shutdown_get_object_workerssH :;A    " "? 3mmF KKM$r+) r@rDrKrFrJrGrMrArLrErN)NN)r7r8r9r:r5r]rbrernrSrqrTrYrurvrwr`rrrrr;r*r+r&r=r=%saDEI4l#   A   )!  ! r+r=c<\rSrSrSr\S5rSrSrSr Sr g) ricXlX lg)a0The future associated to a submitted process pool transfer request :type monitor: TransferMonitor :param monitor: The monitor associated to the process pool downloader :type meta: ProcessPoolTransferMeta :param meta: The metadata associated to the request. This object is visible to the requester. N)_monitor_meta)r4rrs r&r5"ProcessPoolTransferFuture.__init__s  r+cUR$r!)rras r&rProcessPoolTransferFuture.metas zzr+c`URRURR5$r!)ris_donerrras r&doneProcessPoolTransferFuture.dones!}}$$TZZ%;%;<D ! !+ . NNa N __s :A Ac4URUR$)zDetermine a particular transfer is complete :param transfer_id: Unique identifier for the transfer :return: True, if done. False, otherwise. )rrrs r&rTransferMonitor.is_doneas $$[1666r+c>URUR5 g)zaNotify a particular transfer is complete :param transfer_id: Unique identifier for the transfer N)rset_doners r& notify_doneTransferMonitor.notify_doneis k*335r+cURUR5 URURnU(aUeg)zPoll for the result of a transfer :param transfer_id: Unique identifier for the transfer :return: If the transfer succeeded, it will return the result. If the transfer failed, it will raise the exception associated to the failure. N)rwait_till_done exceptionr4rrs r&rTransferMonitor.poll_for_resultps< k*99;))+6@@ Or+c*X RUlg)zNotify an exception was encountered for a transfer :param transfer_id: Unique identifier for the transfer :param exception: The exception encountered for that transfer Nrrrs r&r TransferMonitor.notify_exception~s8Ak*4r+cURR5H%nUR(aM[5UlM' gr!)rvaluesrr r)r4transfer_states r&rj-TransferMonitor.notify_cancel_all_in_progresss2"33::[TU]5 XlSUlgr!)superr5r@_client)r4r __class__s r&r5BaseS3TransferProcess.__init__s - r+cURR5Ul[5 UR 5 SSS5 g!,(df  g=fr!)r@rr,r'_do_runras r&runBaseS3TransferProcess.runs4++99; _ LLN__s A Ac[S5e)Nz _do_run())NotImplementedErrorras r&r0BaseS3TransferProcess._do_runs !+..r+)r,r@) r7r8r9r:r5r1r0r; __classcell__r-s@r&r)r)s "//r+r)cX^\rSrSrU4SjrSrSrSrSrSr Sr S r S r S r U=r$) ric`>[TU]U5 XlX0lX@lXPlX`lg)aSubmit GetObjectJobs to fulfill a download file request :param transfer_config: Configuration for transfers. :param client_factory: ClientFactory for creating S3 clients. :param transfer_monitor: Monitor for notifying and retrieving state of transfer. :param osutil: OSUtils object to use for os-related behavior when performing the transfer. :param download_request_queue: Queue to retrieve download file requests. :param worker_queue: Queue to submit GetObjectJobs for workers to perform. N)r+r5rArLrFrDrE)r4rrrrrrr-s r&r5GetObjectSubmitter.__init__s/, ( /!1 '=$)r+cURR5nU[:Xa[R S5 gUR U5 MN![ akn[R SUUSS9 URRURU5 URRUR5 SnANrSnAff=f)NTz#Submitter shutdown signal received.zFException caught when submitting jobs for download file request %s: %sexc_info) rDrrrVrW_submit_get_object_jobs ExceptionrLrrr)r4rZes r&r0GetObjectSubmitter._do_runs$($@$@$D$D$F !$7 BC ,,-BC   3)! &&77)55q&&22)55 sA CA!CCcURU5nURX5nX RR:aUR X5 gUR XU5 gr!) _get_size_allocate_temp_filerAr1_submit_single_get_object_job_submit_ranged_get_object_jobsr4rZsizers r&r>*GetObjectSubmitter._submit_get_object_jobs0sZ~~34001FM '';; ;  . .%   / /%d r+cURnUc@URR"SURURS.UR D6SnU$)NBucketKey ContentLengthr*)rr, head_objectrrr)r4rZrs r&rCGetObjectSubmitter._get_size<s`-;;   LL44,33)--(22 M r+cURRUR5nURRX25 U$r!)rFget_temp_filenamerallocaterGs r&rD&GetObjectSubmitter._allocate_temp_fileFs9 66 ! * *  m2r+c URURS5 URURURURUSUR UR S9 g)Nrrrrrrrrr)_notify_jobs_to_completer_submit_get_object_jobrrrr)r4rZrs r&rE0GetObjectSubmitter._submit_single_get_object_jobMsa %%&;&G&GK ##-99(//%))',77*33 $ r+c zURRn[X45nURURU5 [ U5HonXd-n[ XFU5nSU0n U RUR5 URURURURUUU URS9 Mq g)NRangerV) rAr2rrWrrrupdaterrXrrr) r4rZrrH part_size num_partsirrange_parameterget_object_kwargss r&rF1GetObjectSubmitter._submit_ranged_get_object_jobs[s))== '8  %% ! - -y y!A]F7iO")/ :   $ $%:%E%E F  ' '1==,33)--+,.77 ( "r+c LURR[S0UD65 g)Nr*)rErXr)r4get_object_job_kwargss r&rX)GetObjectSubmitter._submit_get_object_jobts |D.CDEr+ch[RSUU5 URRX5 g)Nz3Notifying %s job(s) to complete for transfer_id %s.)rVrWrLr)r4rrs r&rW+GetObjectSubmitter._notify_jobs_to_completews0 A   ??  r+)rDrFrArLrE)r7r8r9r:r5r0r>rCrDrErFrXrWr;r6r7s@r&rrs6*:.   2F  r+rcZ^\rSrSrSrS\-rU4SjrSrSr Sr Sr S r S r S rU=r$) ricT>[TU]U5 XlX lX0lX@lg)aFulfills GetObjectJobs Downloads the S3 object, writes it to the specified file, and renames the file to its final location if it completes the final job for a particular transfer. :param queue: Queue for retrieving GetObjectJob's :param client_factory: ClientFactory for creating S3 clients :param transfer_monitor: Monitor for notifying :param osutil: OSUtils object to use for os-related behavior when performing the transfer. N)r+r5_queuer@rLrF)r4rrrrr-s r&r5GetObjectWorker.__init__s( ( -!1 r+cURR5nU[:Xa[R S5 gUR R UR5(dURU5 O[R SU5 UR RUR5n[R SUUR5 U(d1URURURUR5 GM )Nz Worker shutdown signal received.zBSkipping get object job %s because there was a previous exception.z%%s jobs remaining for transfer_id %s.) rlrrrVrWrLrr_run_get_object_jobr_finalize_downloadrr)r4job remainings r&r0GetObjectWorker._do_runs++//#Co% ?@))77HH((- ! ..BBI LL7  ''OOS%6%6 -r+c6URURURURURUR S9 g![ aFn[RSUUSS9 URRURU5 SnAgSnAff=f)N)rrrrrzBException caught when downloading object for get object job %s: %sTr<) _do_get_objectrrrrrr?rVrWrLrr)r4rqr@s r&ro#GetObjectWorker._run_get_object_jobs H   zzGG!//>>zz   H LL(    " " 3 3COOQ G G HsAA B220 # :E&&! "# #s3A B(&BBc^^[US5nURU5 [UU4SjS5nUHnURU5 M SSS5 g!,(df  g=f)Nzrb+c:>TRTR5$r!)read _IO_CHUNKSIZE)bodyr4sr&0GetObjectWorker._write_to_file..s$))D,>,>"?r+r+)openseekiterwrite)r4rrrfchunkschunks` ` r&r{GetObjectWorker._write_to_filesH (E "a FF6N?EF # " "s =A A#cURRU5(aURRU5 OUR XU5 URR U5 gr!)rLrrF remove_file_do_file_renamer)r4rrrs r&rp"GetObjectWorker._finalize_downloadsO  ! ! / / < < LL $ $] 3  X F **;7r+cURRX#5 g![a@nURR X5 URR U5 SnAgSnAff=fr!)rF rename_filer?rLrr)r4rrrr@s r&rGetObjectWorker._do_file_renamesR 4 LL $ $] = 4  " " 3 3K C LL $ $] 3 3 4s A(6A##A()r@rFrlrL)r7r8r9r:ryrrr5r0rorur{rprr;r6r7s@r&rrs<MFM&6H&3*844r+r)8r collections contextlibloggingrBr#rHcopyrbotocore.sessionrbotocore.configrs3transfer.compatrrs3transfer.constantsrrr s3transfer.exceptionsr r s3transfer.futuresr r s3transfer.utilsrrrrrr getLoggerr7rVr namedtuplerrcontextmanagerr'r"r-r=rrr?rrrregisterProcessr)rrr*r+r&rsUun "1NNFC   8 $ ",, %%  " 33 8 ;;,CCL- 2- `"."*JJ2]O]O@-*-*` [  1?C/O33/6D .D No4+o4r+