def wait_status(instance, status, timeout):
    platform = _get_platform()
    org = platform.get_organization(QUBELL["organization"])
    inst = org.get_instance(instance)
    timeout = int(timeout)
    # TODO case-insensitive
    accepted_states = ['Destroying', 'Active', 'Running', 'Executing', 'Unknown']
    try:
        waitForStatus(instance=inst, final=status, accepted=accepted_states, timeout=[timeout * 20, 3, 1])
    finally:
        _describe_instance_short(org.get_instance(instance))
def wait_status(instance, status, timeout):
    platform = _get_platform()
    org = platform.get_organization(QUBELL["organization"])
    inst = org.get_instance(instance)
    timeout = int(timeout)
    # TODO case-insensitive
    accepted_states = ['Launching', 'Destroying', 'Active', 'Running', 'Executing', 'Unknown', 'Requested']
    res = False
    try:
        res = waitForStatus(instance=inst, final=status, accepted=accepted_states, timeout=[timeout * 20, 3, 1])
    finally:
        _describe_instance_short(org.get_instance(instance))
    if not res:  # Exit non-zero if status not reached
        exit(1)
 def wait_status(self, final_status, accepted_status=_ALL_STATES, timeout=3):  # Shortcut for convenience. Timeout = 3 min (ask timeout*6 times every 10 sec)
     return waitForStatus(instance=self, final=final_status, accepted=accepted_status, timeout=[timeout * 20, 3, 1])
 def destroyed(self, timeout=3):  # Shortcut for convenience. Timeout = 3 min (ask timeout*6 times every 10 sec)
     accepted_states = ['Destroying', 'Active', 'Running', 'Executing', 'Unknown', 'Error']
     return waitForStatus(instance=self, final='Destroyed', accepted=accepted_states, timeout=[timeout*20, 3, 1])
 def failed(self, timeout=3):
     accepted_states = ['Active', 'Running', 'Unknown', 'Executing']
     return waitForStatus(instance=self, final='Error', accepted=accepted_states, timeout=[timeout*20, 3, 1])
 def ready(self, timeout=3):  # Shortcut for convinience. Timeout = 3 min (ask timeout*6 times every 10 sec)
     accepted_states = ['Launching', 'Requested', 'Executing', 'Unknown']
     return waitForStatus(instance=self, final=['Active', 'Running'],
                          accepted=accepted_states, timeout=[timeout*20, 3, 1])
 def destroyed(self, timeout=3):  # Shortcut for convinience. Temeout = 3 min (ask timeout*6 times every 10 sec)
     return waitForStatus(instance=self, final='Destroyed', accepted=['Destroying', 'Running'], timeout=[timeout*20, 3, 1])