@inlineCallbacks
def cleanup_cluster(client, timeout=None):
 containers_configuration = (yield client.list_containers_configuration())
 results = []
 for container in containers_configuration:
  print 'deleting container', container.name
  results.append(client.delete_container(container.name))
 (yield gather_deferreds(results))
 datasets_configuration = (yield client.list_datasets_configuration())
 results = []
 for dataset in datasets_configuration:
  print 'deleting dataset with id', dataset.dataset_id
  results.append(client.delete_dataset(dataset.dataset_id))
 (yield gather_deferreds(results))
 if (timeout is not None):
  print 'waiting for all containers to get deleted'
  (yield loop_until(client._reactor, (lambda : client.list_containers_state().addCallback((lambda containers: (not containers)))), repeat(1, timeout)))
  print 'waiting for all datasets to get deleted'
  (yield loop_until(client._reactor, (lambda : client.list_datasets_state().addCallback((lambda datasets: (not datasets)))), repeat(1, timeout)))

@ inlineCallbacks def cleanup_cluster ( client , timeout = None ) : containers_configuration = ( yield client . list_containers_configuration ( ) ) results = [ ] for container in containers_configuration : print 'deleting container' , container . name results . append ( client . delete_container ( container . name ) ) ( yield gather_deferreds ( results ) ) datasets_configuration = ( yield client . list_datasets_configuration ( ) ) results = [ ] for dataset in datasets_configuration : print 'deleting dataset with id' , dataset . dataset_id results . append ( client . delete_dataset ( dataset . dataset_id ) ) ( yield gather_deferreds ( results ) ) if ( timeout is not None ) : print 'waiting for all containers to get deleted' ( yield loop_until ( client . _reactor , ( lambda : client . list_containers_state ( ) . addCallback ( ( lambda containers : ( not containers ) ) ) ) , repeat ( 1 , timeout ) ) ) print 'waiting for all datasets to get deleted' ( yield loop_until ( client . _reactor , ( lambda : client . list_datasets_state ( ) . addCallback ( ( lambda datasets : ( not datasets ) ) ) ) , repeat ( 1 , timeout ) ) )
delete all containers and datasets in the given cluster .