'Terminates this flow.'

def Terminate(self, status=None):

    try:
        self.queue_manager.DestroyFlowStates(self.session_id)
    except queue_manager.MoreDataException:
        pass
    if (self.context.state != rdf_flows.FlowContext.State.RUNNING):
        return
    if self.runner_args.request_state.session_id:
        response = (status or rdf_flows.GrrStatus())
        client_resources = self.context.client_resources
        user_cpu = client_resources.cpu_usage.user_cpu_time
        sys_cpu = client_resources.cpu_usage.system_cpu_time
        response.cpu_time_used.user_cpu_time = user_cpu
        response.cpu_time_used.system_cpu_time = sys_cpu
        response.network_bytes_sent = self.context.network_bytes_sent
        response.child_session_id = self.session_id
        request_state = self.runner_args.request_state
        request_state.response_count += 1
        msg = rdf_flows.GrrMessage(session_id=request_state.session_id, request_id=request_state.id, response_id=request_state.response_count, auth_state=rdf_flows.GrrMessage.AuthorizationState.AUTHENTICATED, type=rdf_flows.GrrMessage.Type.STATUS, payload=response)
        try:
            self.queue_manager.QueueResponse(msg)
        finally:
            self.QueueNotification(session_id=request_state.session_id)
    self.context.state = rdf_flows.FlowContext.State.TERMINATED
    self.flow_obj.Flush()
