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
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
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'))
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
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
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}
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}
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' }
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
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
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, }
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)
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)
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
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, }
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 }
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")
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")
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}
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
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 }
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")
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")
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(),
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)
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(),