

def stop_instances(self, parameters):
    "\n    Stop one of more EC2 instances. The input instance IDs are\n    fetched from the 'instance_ids' parameters in the input map. (Also\n    see documentation for the BaseAgent class)\n\n    Args:\n      parameters: A dictionary of parameters.\n    "
    instance_ids = parameters[self.PARAM_INSTANCE_IDS]
    conn = self.open_connection(parameters)
    conn.stop_instances(instance_ids)
    AppScaleLogger.log(('Stopping instances: ' + ' '.join(instance_ids)))
    if (not self.wait_for_status_change(parameters, conn, 'stopped', max_wait_time=120)):
        AppScaleLogger.log(('re-stopping instances: ' + ' '.join(instance_ids)))
        conn.stop_instances(instance_ids)
        if (not self.wait_for_status_change(parameters, conn, 'stopped', max_wait_time=120)):
            self.handle_failure(('ERROR: could not stop instances: ' + ' '.join(instance_ids)))

dataset/ETHPy150Open AppScale/appscale-tools/lib/agents/ec2_agent.py EC2Agent.stop_instances/original