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

Method schedule_consumption

awscli/s3transfer/bandwidth.py:320–344  ·  view source on GitHub ↗

Schedules a wait time to be able to consume an amount :type amt: int :param amt: The amount of bytes scheduled to be consumed :type token: RequestToken :param token: The token associated to the consumption request that is used to identify the request.

(self, amt, token, time_to_consume)

Source from the content-addressed store, hash-verified

318 return token in self._tokens_to_scheduled_consumption
319
320 def schedule_consumption(self, amt, token, time_to_consume):
321 """Schedules a wait time to be able to consume an amount
322
323 :type amt: int
324 :param amt: The amount of bytes scheduled to be consumed
325
326 :type token: RequestToken
327 :param token: The token associated to the consumption
328 request that is used to identify the request.
329
330 :type time_to_consume: float
331 :param time_to_consume: The desired time it should take for that
332 specific request amount to be consumed in regardless of previously
333 scheduled consumption requests
334
335 :rtype: float
336 :returns: The amount of time to wait for the specific request before
337 actually consuming the specified amount.
338 """
339 self._total_wait += time_to_consume
340 self._tokens_to_scheduled_consumption[token] = {
341 'wait_duration': self._total_wait,
342 'time_to_consume': time_to_consume,
343 }
344 return self._total_wait
345
346 def process_scheduled_consumption(self, token):
347 """Processes a scheduled consumption request that has completed

Calls

no outgoing calls