def poke(self, context):
    response = self.get_emr_response()
    if (not (response['ResponseMetadata']['HTTPStatusCode'] == 200)):
        self.log.info('Bad HTTP response: %s', response)
        return False
    state = self.state_from_response(response)
    self.log.info('Job flow currently %s', state)
    if (state in self.NON_TERMINAL_STATES):
        return False
    if (state in self.FAILED_STATE):
        final_message = 'EMR job failed'
        failure_message = self.failure_message_from_response(response)
        if failure_message:
            final_message += (' ' + failure_message)
        raise AirflowException(final_message)
    return True
def poke(self, context):
    response = self.get_emr_response()
    if (not (response['ResponseMetadata']['HTTPStatusCode'] == 200)):
        self.log.info('Bad HTTP response: %s', response)
        return False
    state = self.state_from_response(response)
    self.log.info('Job flow currently %s', state)
    if (state in self.NON_TERMINAL_STATES):
        return False
    if (state in self.FAILED_STATE):
        final_message = 'EMR job failed'
        failure_message = self.failure_message_from_response(response)
        if failure_message:
            final_message += (' ' + failure_message)
        raise AirflowException(final_message)
    return True