Skip to content
  • Stavros Sachtouris's avatar
    Improve the blocking mechanism in kamaki clients · 80f20e72
    Stavros Sachtouris authored
    The "Waiter" class is now deprecated. A "wait" method is used
    instead. The new method is located at "kamaki.clients" and has
    this signature:
    wait(
        poll method, poll method params,
        stop method,
        delay=1, timeout=100,
        caller callback method=None)
    
    The poll method is provided by the caller and is typically the
    "get_details" method of each API client.
    
    The "poll method params" is a list of parameters for the polling
    method, typically just the item id (i.e., server_id, port_id,
    volume_id).
    
    The stop method returns a boolean, is called after each polling
    and decides whether the blocking should stop.
    
    The delay is the time between each call of the poll method
    
    The timeout is the total time after which the blocker stops
    
    The caller callback method is not a generator anymore, instead it
    is just a method that takes the results of the poll method as
    input and it is called at each iteration. It remains optional.
    Typically, the caller may use it to advance a progress bar.
    
    The CycladesComputeClient, CycladesNetworkClient and
    CycladesBlockStorageClient have been updated so that they make use
    of the new method, but they retain the ability to call the Waiter
    methods for two more versions, due to backwards compatibility
    policies.
    
    The CLI has been adjusted to use the new mechanism.
    80f20e72