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

Class ExecutorFuture

awscli/s3transfer/futures.py:508–542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506
507
508class ExecutorFuture:
509 def __init__(self, future):
510 """A future returned from the executor
511
512 Currently, it is just a wrapper around a concurrent.futures.Future.
513 However, this can eventually grow to implement the needed functionality
514 of concurrent.futures.Future if we move off of the library and not
515 affect the rest of the codebase.
516
517 :type future: concurrent.futures.Future
518 :param future: The underlying future
519 """
520 self._future = future
521
522 def result(self):
523 return self._future.result()
524
525 def add_done_callback(self, fn):
526 """Adds a callback to be completed once future is done
527
528 :param fn: A callable that takes no arguments. Note that is different
529 than concurrent.futures.Future.add_done_callback that requires
530 a single argument for the future.
531 """
532
533 # The done callback for concurrent.futures.Future will always pass a
534 # the future in as the only argument. So we need to create the
535 # proper signature wrapper that will invoke the callback provided.
536 def done_callback(future_passed_to_callback):
537 return fn()
538
539 self._future.add_done_callback(done_callback)
540
541 def done(self):
542 return self._future.done()
543
544
545class BaseExecutor:

Callers 4

test_resultMethod · 0.90
test_doneMethod · 0.90
submitMethod · 0.85

Calls

no outgoing calls

Tested by 3

test_resultMethod · 0.72
test_doneMethod · 0.72