Ejemplo n.º 1
0
def get_operation_execution_details(request):
    response = {'status': -1}

    operation_id = json.loads(request.POST.get('operation_id'))

    client = WorkfloadAnalyticsClient(request.user)
    data = client.get_operation_execution_details(operation_id=operation_id)

    if data:
        response['status'] = 0
        response['data'] = data
    else:
        response['message'] = 'Workload Analytics: %s' % data['details']

    return JsonResponse(response)
Ejemplo n.º 2
0
def get_impala_query(request):
    response = {'status': -1}

    cluster = json.loads(request.POST.get('cluster'))
    query_id = json.loads(request.POST.get('query_id'))

    client = WorkfloadAnalyticsClient(request.user)
    data = client.get_impala_query(cluster=cluster, query_id=query_id)

    if data:
        response['status'] = 0
        response['data'] = data
    else:
        response['message'] = 'Workload Analytics: %s' % data['details']

    return JsonResponse(response)
Ejemplo n.º 3
0
Archivo: dataeng.py Proyecto: ztwu/hue
    def get_log(self, notebook, snippet, startFrom=0, size=None):
        logs = WorkfloadAnalyticsClient(self.user).get_mr_task_attempt_log(
            operation_execution_id='cedb71ae-0956-42e1-8578-87b9261d4a37',
            attempt_id='attempt_1499705340501_0045_m_000000_0')

        return ''.join(
            re.findall(
                '(?<=>>> Invoking Beeline command line now >>>)(.*?)(?=<<< Invocation of Beeline command completed <<<)',
                logs['stdout'], re.DOTALL))
Ejemplo n.º 4
0
def get_environment(request):
  response = {'status': -1}

  crn = json.loads(request.POST.get('crn'))

  client = WorkfloadAnalyticsClient(request.user)
  data = client.list_environments()

  if data:
    env = [_env for _env in data['environments'] if _env['crn'] == crn]
    if not env:
      response['message'] = 'Workload Analytics: %s environment not found' % crn
    else:
      response['status'] = 0
      response['data'] = env[0]
  else:
    response['message'] = 'Workload Analytics: %s' % data['details']

  return JsonResponse(response)