예제 #1
0
def view_log(_execution, _job, _url, _alias):
    """View workflow or job execution logs."""
    session = _get_session(_url, _alias)
    exc = Execution(session, _execution)
    logs = exc.job_logs(_job[0]) if _job else exc.logs()
    try:
        for line in logs:
            sys.stdout.write('%s\n' % (line.encode('utf-8'), ))
    except HTTPError:
        # Azkaban responds with 500 if the execution or job isn't found
        if _job:
            raise AzkabanError('Execution %s and/or job %s not found.',
                               _execution, _job)
        else:
            raise AzkabanError('Execution %s not found.', _execution)
예제 #2
0
파일: test_remote.py 프로젝트: ruor/azkaban
 def test_show_running_executions(self):
     exe = Execution.start(self.session, self.project, 'foo')
     sleep(2)
     d = self.session.get_workflow_executions(self.project, 'foo')
     running = [e for e in d['executions'] if e['status'] == 'RUNNING']
     eq_(len(running), 1)
     eq_(running[0]['execId'], exe.exec_id)
예제 #3
0
파일: __main__.py 프로젝트: dfdx/azkaban
def view_log(_execution, _job, _url, _alias):
  """View workflow or job execution logs."""
  session = Session(_url, _alias)
  exc = Execution(session, _execution)
  logs = exc.job_logs(_job[0]) if _job else exc.logs()
  try:
    for line in logs:
      sys.stdout.write('%s\n' % (line.encode('utf-8'), ))
  except HTTPError:
    # Azkaban responds with 500 if the execution or job isn't found
    if _job:
      raise AzkabanError(
        'Execution %s and/or job %s not found.', _execution, _job
      )
    else:
      raise AzkabanError('Execution %s not found.', _execution)
예제 #4
0
 def test_show_running_executions(self):
   exe = Execution.start(self.session, self.project, 'foo')
   sleep(2)
   d = self.session.get_workflow_executions(self.project, 'foo')
   running = [e for e in d['executions'] if e['status'] == 'RUNNING']
   eq_(len(running), 1)
   eq_(running[0]['execId'], exe.exec_id)
예제 #5
0
파일: test_remote.py 프로젝트: ruor/azkaban
 def test_show_executions(self):
     exe = Execution.start(self.session, self.project, 'foo')
     sleep(5)
     d = self.session.get_workflow_executions(self.project, 'foo')
     ok_(len(d['executions']))
     executions = [e for e in d['executions'] if e['execId'] == exe.exec_id]
     eq_(len(executions), 1)
     eq_(executions[0]['status'], 'SUCCEEDED')
예제 #6
0
 def test_show_executions(self):
   exe = Execution.start(self.session, self.project, 'foo')
   sleep(5)
   d = self.session.get_workflow_executions(self.project, 'foo')
   ok_(len(d['executions']))
   executions = [e for e in d['executions'] if e['execId'] == exe.exec_id]
   eq_(len(executions), 1)
   eq_(executions[0]['status'], 'SUCCEEDED')
예제 #7
0
 def _run_workflow(self, flow, **kwargs):
   with temppath() as path:
     self.project.build(path)
     self.session.upload_project(self.project, path)
   exe = Execution.start(self.session, self.project, flow, properties=kwargs)
   for i in range(5):
     # wait until workflow is launched
     sleep(1)
     try:
       status = exe.status
     except AzkabanError:
       pass
     else:
       if status['status'] != 'PREPARING':
         break
   return exe
예제 #8
0
 def _run_workflow(self, flow, **kwargs):
   with temppath() as path:
     self.project.build(path)
     self.session.upload_project(self.project, path)
   exe = Execution.start(self.session, self.project, flow, properties=kwargs)
   for i in range(5):
     # wait until workflow is launched
     sleep(1)
     try:
       status = exe.status
     except AzkabanError:
       pass
     else:
       if status['status'] != 'PREPARING':
         break
   return exe
예제 #9
0
파일: test_remote.py 프로젝트: ruor/azkaban
 def test_running(self):
     exe = Execution.start(self.session, self.project, 'foo')
     sleep(2)
     d = self.session.get_running_workflows(self.project, 'foo')
     eq_(d, {'execIds': [exe.exec_id]})
예제 #10
0
파일: test_remote.py 프로젝트: ruor/azkaban
 def test_execution_logs(self):
     exe = Execution.start(self.session, self.project, 'foo')
     sleep(1)
     logs = '\n'.join(exe.logs())
     ok_('Submitting job \'foo\' to run.' in logs)
예제 #11
0
파일: test_remote.py 프로젝트: ruor/azkaban
 def test_execution_cancel(self):
     exe = Execution.start(self.session, self.project, 'foo')
     sleep(1)
     exe.cancel()
     sleep(1)
     eq_(exe.status['status'], 'KILLED')
예제 #12
0
파일: test_remote.py 프로젝트: ruor/azkaban
 def test_execution_start(self):
     exe = Execution.start(self.session, self.project, 'foo')
     sleep(2)
     eq_(exe.status['status'], 'RUNNING')
     sleep(4)
     eq_(exe.status['status'], 'SUCCEEDED')
예제 #13
0
 def test_running(self):
   exe = Execution.start(self.session, self.project, 'foo')
   sleep(2)
   d = self.session.get_running_workflows(self.project, 'foo')
   eq_(d, {'execIds': [exe.exec_id]})
예제 #14
0
 def test_execution_logs(self):
   exe = Execution.start(self.session, self.project, 'foo')
   sleep(1)
   logs = '\n'.join(exe.logs())
   ok_('Submitting job \'foo\' to run.' in logs)
예제 #15
0
 def test_execution_cancel(self):
   exe = Execution.start(self.session, self.project, 'foo')
   sleep(1)
   exe.cancel()
   sleep(1)
   eq_(exe.status['status'],'KILLED')
예제 #16
0
 def test_execution_start(self):
   exe = Execution.start(self.session, self.project, 'foo')
   sleep(2)
   eq_(exe.status['status'], 'RUNNING')
   sleep(4)
   eq_(exe.status['status'],'SUCCEEDED')