示例#1
0
    def get_log(self, notebook, snippet, startFrom=0, size=None):
        job_id = snippet['result']['handle']['id']

        oozie_workflow = check_job_access_permission(self.request, job_id)
        logs, workflow_actions, is_really_done = self._get_log_output(
            oozie_workflow)
        return logs
示例#2
0
    def get_log(self, notebook, snippet, startFrom=0, size=None):
        job_id = snippet['result']['handle']['id']

        oozie_job = check_job_access_permission(self.request, job_id)
        logs = self._get_log_output(oozie_job)

        return logs if logs else oozie_job.log
示例#3
0
  def get_log(self, notebook, snippet, startFrom=0, size=None):
    job_id = snippet['result']['handle']['id']

    oozie_workflow = check_job_access_permission(self.request, job_id)
    logs, workflow_actions, is_really_done = self._get_output(oozie_workflow)

    return logs.get('pig', _('No result'))
示例#4
0
  def get_log(self, notebook, snippet, startFrom=0, size=None):
    job_id = snippet['result']['handle']['id']

    oozie_job = check_job_access_permission(self.request, job_id)
    status_resp = oozie_job.log

    return status_resp
示例#5
0
  def get_log(self, notebook, snippet, startFrom=0, size=None):
    job_id = snippet['result']['handle']['id']
    request = MockRequest(self.user, self.fs, self.jt)

    oozie_workflow = check_job_access_permission(MockRequest(self.user, self.fs, self.jt), job_id)
    logs, workflow_actions, is_really_done = api.get(self.jt, self.jt, self.user).get_log(request, oozie_workflow)

    return logs
示例#6
0
    def cancel(self, notebook, snippet):
        job_id = snippet['result']['handle']['id']

        job = check_job_access_permission(self, job_id)
        check_job_edition_permission(job, self.user)

        api.get(self.fs, self.jt, self.user).stop(job_id)

        return {'status': 0}
示例#7
0
    def cancel(self, notebook, snippet):
        job_id = snippet['result']['handle']['id']

        job = check_job_access_permission(self, job_id)
        oozie_job = check_job_edition_permission(job, self.user)

        oozie_job.kill()

        return {'status': 0}
示例#8
0
  def cancel(self, notebook, snippet):
    job_id = snippet['result']['handle']['id']

    job = check_job_access_permission(self, job_id)
    oozie_job = check_job_edition_permission(job, self.user)

    oozie_job.kill()

    return {'status': 0}
示例#9
0
  def cancel(self, notebook, snippet):
    job_id = snippet['result']['handle']['id']

    job = check_job_access_permission(self, job_id)
    check_job_edition_permission(job, self.user)

    api.get(self.fs, self.jt, self.user).stop(job_id)

    return {'status': 0}
示例#10
0
  def fetch_result(self, notebook, snippet, rows, start_over):
    job_id = snippet['result']['handle']['id']

    oozie_workflow = check_job_access_permission(MockRequest(self.user, self.fs, self.jt), job_id)
    output = get_workflow_output(oozie_workflow, self.fs)

    return {
        'data':  [hdfs_link(output)],
        'meta': [{'name': 'Header', 'type': 'STRING_TYPE', 'comment': ''}],
        'type': 'text'
    }
示例#11
0
  def check_status(self, notebook, snippet):
    response = {}
    job_id = snippet['result']['handle']['id']
    oozie_job = check_job_access_permission(self.request, job_id)

    if oozie_job.status in ('KILLED', 'FAILED'):
      raise QueryError(_('Job was %s') % oozie_job.status)

    response['status'] = 'running' if oozie_job.is_running() else 'available'

    return response
示例#12
0
    def check_status(self, notebook, snippet):
        response = {}
        job_id = snippet['result']['handle']['id']
        oozie_job = check_job_access_permission(self.request, job_id)

        if oozie_job.status in ('KILLED', 'FAILED'):
            raise QueryError(_('Job was %s') % oozie_job.status)

        response['status'] = 'running' if oozie_job.is_running(
        ) else 'available'

        return response
示例#13
0
  def fetch_result(self, notebook, snippet, rows, start_over):
    job_id = snippet['result']['handle']['id']

    oozie_workflow = check_job_access_permission(self.request, job_id)
    logs, workflow_actions, is_really_done = self._get_output(oozie_workflow)

    output = logs.get('pig', _('No result'))

    return {
        'data':  [[line] for line in output.split('\n')], # hdfs_link()
        'meta': [{'name': 'Header', 'type': 'STRING_TYPE', 'comment': ''}],
        'type': 'table',
        'has_more': False,
    }
示例#14
0
文件: views.py 项目: Web5design/hue
def stop(request):
  if request.method != 'POST':
    raise PopupException(_('POST request required.'))

  pig_script = PigScript.objects.get(id=request.POST.get('id'))
  job_id = pig_script.dict['job_id']

  job = check_job_access_permission(request, job_id)
  check_job_edition_permission(job, request.user)

  try:
    api.get(request.fs, request.jt, request.user).stop(job_id)
  except RestException, e:
    raise PopupException(_("Error stopping Pig script.") % e.message)
示例#15
0
文件: views.py 项目: ronglei/hue
def stop(request):
    if request.method != "POST":
        raise PopupException(_("POST request required."))

    spark_script = SparkScript.objects.get(id=request.POST.get("id"))
    job_id = spark_script.dict["job_id"]

    job = check_job_access_permission(request, job_id)
    check_job_edition_permission(job, request.user)

    try:
        api.get(request.fs, request.jt, request.user).stop(job_id)
    except RestException, e:
        raise PopupException(_("Error stopping Pig script.") % e.message)
示例#16
0
def stop(request):
    if request.method != 'POST':
        raise PopupException(_('POST request required.'))

    pig_script = PigScript.objects.get(id=request.POST.get('id'))
    job_id = pig_script.dict['job_id']

    job = check_job_access_permission(request, job_id)
    check_job_edition_permission(job, request.user)

    try:
        api.get(request.fs, request.jt, request.user).stop(job_id)
    except RestException, e:
        raise PopupException(_("Error stopping Pig script.") % e.message)
示例#17
0
  def get_jobs(self, notebook, snippet, logs):
    jobs = []
    job_id = snippet['result']['handle']['id']

    oozie_job = check_job_access_permission(self.request, job_id)
    actions = oozie_job.get_working_actions()
    for action in actions:
      if action.externalId is not None:
        jobs.append({
          'name': action.externalId,
          'url': reverse('jobbrowser.views.single_job', kwargs={'job': action.externalId}),
          'started': action.startTime is not None,
          'finished': action.endTime is not None
        })
    return jobs
示例#18
0
  def get_jobs(self, notebook, snippet, logs):
    jobs = []
    job_id = snippet['result']['handle']['id']

    oozie_job = check_job_access_permission(self.request, job_id)
    actions = oozie_job.get_working_actions()
    for action in actions:
      if action.externalId is not None:
        jobs.append({
          'name': action.externalId,
          'url': reverse('jobbrowser.views.single_job', kwargs={'job': action.externalId}),
          'started': action.startTime is not None,
          'finished': action.endTime is not None
        })
    return jobs
示例#19
0
文件: pig_batch.py 项目: igloosec/hue
    def fetch_result(self, notebook, snippet, rows, start_over):
        job_id = snippet['result']['handle']['id']

        oozie_workflow = check_job_access_permission(self.request, job_id)
        logs, workflow_actions, is_really_done = self._get_output(
            oozie_workflow)

        output = logs.get('pig', _('No result'))

        return {
            'data': [[line] for line in output.split('\n')],  # hdfs_link()
            'meta': [{
                'name': 'Header',
                'type': 'STRING_TYPE',
                'comment': ''
            }],
            'type': 'table',
            'has_more': False,
        }
示例#20
0
  def check_status(self, notebook, snippet):
    job_id = snippet['result']['handle']['id']
    request = MockRequest(self.user, self.fs, self.jt)

    oozie_workflow = check_job_access_permission(request, job_id)
    logs, workflow_actions, is_really_done = api.get(self.jt, self.jt, self.user).get_log(request, oozie_workflow)

    if is_really_done and not oozie_workflow.is_running():
      if oozie_workflow.status in ('KILLED', 'FAILED'):
        raise QueryError(_('The script failed to run and was stopped'))
      status = 'available'
    elif oozie_workflow.is_running():
      status = 'running'
    else:
      status = 'failed'

    return {
        'status': status
    }
示例#21
0
def watch(request, job_id):
    oozie_workflow = check_job_access_permission(request, job_id)
    logs, workflow_actions, is_really_done = api.get(
        request.fs, request.jt, request.user).get_log(request, oozie_workflow)
    output = get_workflow_output(oozie_workflow, request.fs)

    workflow = {
        'job_id':
        oozie_workflow.id,
        'status':
        oozie_workflow.status,
        'progress':
        oozie_workflow.get_progress(),
        'isRunning':
        oozie_workflow.is_running(),
        'killUrl':
        reverse('oozie:manage_oozie_jobs',
                kwargs={
                    'job_id': oozie_workflow.id,
                    'action': 'kill'
                }),
        'rerunUrl':
        reverse('oozie:rerun_oozie_job',
                kwargs={
                    'job_id':
                    oozie_workflow.id,
                    'app_path':
                    urllib.parse.quote(oozie_workflow.appPath.encode('utf-8'),
                                       safe=SAFE_CHARACTERS_URI_COMPONENTS)
                }),
        'actions':
        workflow_actions
    }

    response = {
        'workflow': workflow,
        'logs': logs,
        'isReallyDone': is_really_done,
        'output': hdfs_link(output)
    }

    return JsonResponse(response, content_type="text/plain")
示例#22
0
文件: views.py 项目: ronglei/hue
def watch(request, job_id):
    oozie_workflow = check_job_access_permission(request, job_id)
    logs, workflow_actions = api.get(request.jt, request.jt, request.user).get_log(request, oozie_workflow)
    output = get_workflow_output(oozie_workflow, request.fs)

    workflow = {
        "job_id": oozie_workflow.id,
        "status": oozie_workflow.status,
        "progress": oozie_workflow.get_progress(),
        "isRunning": oozie_workflow.is_running(),
        "killUrl": reverse("oozie:manage_oozie_jobs", kwargs={"job_id": oozie_workflow.id, "action": "kill"}),
        "rerunUrl": reverse(
            "oozie:rerun_oozie_job", kwargs={"job_id": oozie_workflow.id, "app_path": oozie_workflow.appPath}
        ),
        "actions": workflow_actions,
    }

    response = {"workflow": workflow, "logs": logs, "output": hdfs_link(output)}

    return HttpResponse(json.dumps(response), content_type="text/plain")
示例#23
0
文件: pig_batch.py 项目: igloosec/hue
    def check_status(self, notebook, snippet):
        job_id = snippet['result']['handle']['id']

        oozie_workflow = check_job_access_permission(self.request, job_id)
        logs, workflow_actions, is_really_done = self._get_output(
            oozie_workflow)

        if is_really_done and not oozie_workflow.is_running():
            if oozie_workflow.status in ('KILLED', 'FAILED'):
                raise QueryError(_('The script failed to run and was stopped'))
            if logs:
                status = 'available'
            else:
                status = 'running'  # Tricky case when the logs are being moved by YARN at job completion
        elif oozie_workflow.is_running():
            status = 'running'
        else:
            status = 'failed'

        return {'status': status}
示例#24
0
  def check_status(self, notebook, snippet):
    response = {'status': 'running'}

    job_id = snippet['result']['handle']['id']
    oozie_job = check_job_access_permission(self.request, job_id)

    if oozie_job.is_running():
      return response
    elif oozie_job.status in ('KILLED', 'FAILED'):
      raise QueryError(_('Job was %s') % oozie_job.status)
    else:
      # Check if job results are actually available, since YARN takes a while to move logs to JHS,
      log_output = self.get_log(notebook, snippet)
      if log_output:
        results = self._get_results(log_output, snippet['type'])
        if results:
          response['status'] = 'available'
      else:
        response['status'] = 'failed'

    return response
示例#25
0
  def check_status(self, notebook, snippet):
    job_id = snippet['result']['handle']['id']

    oozie_workflow = check_job_access_permission(self.request, job_id)
    logs, workflow_actions, is_really_done = self._get_output(oozie_workflow)

    if is_really_done and not oozie_workflow.is_running():
      if oozie_workflow.status in ('KILLED', 'FAILED'):
        raise QueryError(_('The script failed to run and was stopped'))
      if logs:
        status = 'available'
      else:
        status = 'running' # Tricky case when the logs are being moved by YARN at job completion
    elif oozie_workflow.is_running():
      status = 'running'
    else:
      status = 'failed'

    return {
        'status': status
    }
示例#26
0
    def check_status(self, notebook, snippet):
        response = {'status': 'running'}

        job_id = snippet['result']['handle']['id']
        oozie_job = check_job_access_permission(self.request, job_id)

        if oozie_job.is_running():
            return response
        elif oozie_job.status in ('KILLED', 'FAILED'):
            raise QueryError(_('Job was %s') % oozie_job.status)
        else:
            # Check if job results are actually available, since YARN takes a while to move logs to JHS,
            log_output = self.get_log(notebook, snippet)
            if log_output:
                results = self._get_results(log_output, snippet['type'])
                if results:
                    response['status'] = 'available'
            else:
                response['status'] = 'failed'

        return response
示例#27
0
def watch(request, job_id):
    oozie_workflow = check_job_access_permission(request, job_id)
    logs, workflow_actions, is_really_done = api.get(
        request.jt, request.jt, request.user).get_log(request, oozie_workflow)
    output = get_workflow_output(oozie_workflow, request.fs)

    workflow = {
        'job_id':
        oozie_workflow.id,
        'status':
        oozie_workflow.status,
        'progress':
        oozie_workflow.get_progress(),
        'isRunning':
        oozie_workflow.is_running(),
        'killUrl':
        reverse('oozie:manage_oozie_jobs',
                kwargs={
                    'job_id': oozie_workflow.id,
                    'action': 'kill'
                }),
        'rerunUrl':
        reverse('oozie:rerun_oozie_job',
                kwargs={
                    'job_id': oozie_workflow.id,
                    'app_path': oozie_workflow.appPath
                }),
        'actions':
        workflow_actions
    }

    response = {
        'workflow': workflow,
        'logs': logs,
        'isReallyDone': is_really_done,
        'output': hdfs_link(output)
    }

    return HttpResponse(json.dumps(response), content_type="text/plain")
示例#28
0
文件: views.py 项目: Web5design/hue
def watch(request, job_id):
  oozie_workflow = check_job_access_permission(request, job_id)
  logs, workflow_actions = api.get(request.jt, request.jt, request.user).get_log(request, oozie_workflow)
  output = get_workflow_output(oozie_workflow, request.fs)

  workflow = {
    'job_id': oozie_workflow.id,
    'status': oozie_workflow.status,
    'progress': oozie_workflow.get_progress(),
    'isRunning': oozie_workflow.is_running(),
    'killUrl': reverse('oozie:manage_oozie_jobs', kwargs={'job_id': oozie_workflow.id, 'action': 'kill'}),
    'rerunUrl': reverse('oozie:rerun_oozie_job', kwargs={'job_id': oozie_workflow.id, 'app_path': oozie_workflow.appPath}),
    'actions': workflow_actions
  }

  response = {
    'workflow': workflow,
    'logs': logs,
    'output': hdfs_link(output)
  }

  return HttpResponse(json.dumps(response), content_type="text/plain")
示例#29
0
    def progress(self, snippet, logs):
        job_id = snippet['result']['handle']['id']

        oozie_job = check_job_access_permission(self.request, job_id)
        return oozie_job.get_progress(),
示例#30
0
  def progress(self, snippet, logs):
    job_id = snippet['result']['handle']['id']

    oozie_job = check_job_access_permission(self.request, job_id)
    return oozie_job.get_progress(),
示例#31
0
  def get_log(self, notebook, snippet, startFrom=0, size=None):
    job_id = snippet['result']['handle']['id']

    oozie_job = check_job_access_permission(self.request, job_id)
    return self._get_log_output(oozie_job)
示例#32
0
  def progress(self, snippet, logs):
    job_id = snippet['result']['handle']['id']

    oozie_workflow = check_job_access_permission(MockRequest(self.user, self.fs, self.jt), job_id)
    return oozie_workflow.get_progress(),