MCPcopy Index your code
hub / github.com/aws/aws-cli / acquire

Method acquire

awscli/s3transfer/utils.py:625–639  ·  view source on GitHub ↗

Acquire the semaphore :param tag: A tag identifying what is acquiring the semaphore. Note that this is not really needed to directly use this class but is needed for API compatibility with the SlidingWindowSemaphore implementation. :param block: I

(self, tag, blocking=True)

Source from the content-addressed store, hash-verified

623 self._semaphore = threading.Semaphore(count)
624
625 def acquire(self, tag, blocking=True):
626 """Acquire the semaphore
627
628 :param tag: A tag identifying what is acquiring the semaphore. Note
629 that this is not really needed to directly use this class but is
630 needed for API compatibility with the SlidingWindowSemaphore
631 implementation.
632 :param block: If True, block until it can be acquired. If False,
633 do not block and raise an exception if cannot be acquired.
634
635 :returns: A token (can be None) to use when releasing the semaphore
636 """
637 logger.debug("Acquiring %s", tag)
638 if not self._semaphore.acquire(blocking):
639 raise NoResourcesAvailable(f"Cannot acquire tag '{tag}'")
640
641 def release(self, tag, acquire_token):
642 """Release the semaphore

Callers 5

_submit_transferMethod · 0.45
acquireMethod · 0.45
releaseMethod · 0.45
submitMethod · 0.45

Calls 1

Tested by

no test coverage detected