MCPcopy Create free account
hub / github.com/aws/aws-cli / _main

Method _main

awscli/s3transfer/tasks.py:245–290  ·  view source on GitHub ↗

:type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future associated with the transfer request that tasks are being submitted for :param kwargs: Any additional kwargs that you may want to pass to the _submit

(self, transfer_future, **kwargs)

Source from the content-addressed store, hash-verified

243 """
244
245 def _main(self, transfer_future, **kwargs):
246 """
247 :type transfer_future: s3transfer.futures.TransferFuture
248 :param transfer_future: The transfer future associated with the
249 transfer request that tasks are being submitted for
250
251 :param kwargs: Any additional kwargs that you may want to pass
252 to the _submit() method
253 """
254 try:
255 self._transfer_coordinator.set_status_to_queued()
256
257 # Before submitting any tasks, run all of the on_queued callbacks
258 on_queued_callbacks = get_callbacks(transfer_future, 'queued')
259 for on_queued_callback in on_queued_callbacks:
260 on_queued_callback()
261
262 # Once callbacks have been ran set the status to running.
263 self._transfer_coordinator.set_status_to_running()
264
265 # Call the submit method to start submitting tasks to execute the
266 # transfer.
267 self._submit(transfer_future=transfer_future, **kwargs)
268 except BaseException as e:
269 # If there was an exception raised during the submission of task
270 # there is a chance that the final task that signals if a transfer
271 # is done and too run the cleanup may never have been submitted in
272 # the first place so we need to account accordingly.
273 #
274 # Note that BaseException is caught, instead of Exception, because
275 # for some implementations of executors, specifically the serial
276 # implementation, the SubmissionTask is directly exposed to
277 # KeyboardInterupts and so needs to cleanup and signal done
278 # for those as well.
279
280 # Set the exception, that caused the process to fail.
281 self._log_and_set_exception(e)
282
283 # Wait for all possibly associated futures that may have spawned
284 # from this submission task have finished before we announce the
285 # transfer done.
286 self._wait_for_all_submitted_futures_to_complete()
287
288 # Announce the transfer as done, which will run any cleanups
289 # and done callbacks as well.
290 self._transfer_coordinator.announce_done()
291
292 def _submit(self, transfer_future, **kwargs):
293 """The submission method to be implemented

Callers

nothing calls this directly

Calls 7

_submitMethod · 0.95
get_callbacksFunction · 0.90
announce_doneMethod · 0.80
set_status_to_queuedMethod · 0.45
set_status_to_runningMethod · 0.45

Tested by

no test coverage detected