当前位置: 首页>>代码示例>>Python>>正文


Python conf.SHARE_JOBS类代码示例

本文整理汇总了Python中oozie.conf.SHARE_JOBS的典型用法代码示例。如果您正苦于以下问题:Python SHARE_JOBS类的具体用法?Python SHARE_JOBS怎么用?Python SHARE_JOBS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SHARE_JOBS类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_coordinator_workflow_access_permissions

  def test_coordinator_workflow_access_permissions(self):
    oozie_api.OozieApi = MockOozieCoordinatorApi
    oozie_api._api_cache = None

    self.wf.is_shared = True
    self.wf.save()

    # Login as someone else not superuser
    client_another_me = make_logged_in_client(username='another_me', is_superuser=False, groupname='test')
    grant_access("another_me", "test", "oozie")
    coord = create_coordinator(self.wf, client_another_me)

    response = client_another_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
    assert_true('Editor' in response.content, response.content)
    assert_true('value="Save"' in response.content, response.content)

    # Check can schedule a non personal/shared workflow
    workflow_select = '%s</option>' % self.wf
    response = client_another_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
    assert_true(workflow_select in response.content, response.content)

    self.wf.is_shared = False
    self.wf.save()

    response = client_another_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
    assert_false(workflow_select in response.content, response.content)

    self.wf.is_shared = True
    self.wf.save()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_another_me.post(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_true(workflow_select in response.content, response.content)
      assert_true('value="Save"' in response.content, response.content)
    finally:
      finish()

    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_another_me.post(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_true('This field is required' in response.content, response.content)
      assert_false(workflow_select in response.content, response.content)
      assert_true('value="Save"' in response.content, response.content)
    finally:
      finish()
开发者ID:kthguru,项目名称:hue,代码行数:47,代码来源:tests.py

示例2: test_edit_workflow

  def test_edit_workflow(self):
    response = self.c.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
    assert_true('Editor' in response.content, response.content)
    assert_true('Workflow wf-name-1' in response.content, response.content)

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = self.c.post(reverse('oozie:edit_workflow', args=[self.wf.id]), {})
      assert_true('jHueNotify.error' in response.content, response.content)
    finally:
      finish()

    # Build POST dict from the forms and test this
    raise SkipTest

    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = self.c.post(reverse('oozie:edit_workflow', args=[self.wf.id]), WORKFLOW_DICT)
      assert_false('jHueNotify.error' in response.content, response.content)
    finally:
      finish()
开发者ID:kthguru,项目名称:hue,代码行数:22,代码来源:tests.py

示例3: list_trashed_workflows

def list_trashed_workflows(request):
  data = Workflow.objects.trashed().filter(managed=True)

  if not SHARE_JOBS.get() and not request.user.is_superuser:
    data = data.filter(owner=request.user)
  else:
    data = data.filter(Q(is_shared=True) | Q(owner=request.user))

  data = data.order_by('-last_modified')

  return render('editor/list_trashed_workflows.mako', request, {
    'jobs': list(data),
    'json_jobs': json.dumps(list(data.values_list('id', flat=True))),
  })
开发者ID:yjkim,项目名称:hue,代码行数:14,代码来源:editor.py

示例4: list_bundles

def list_bundles(request):
  data = Bundle.objects.available()

  if not SHARE_JOBS.get() and not request.user.is_superuser:
    data = data.filter(owner=request.user)
  else:
    data = data.filter(Q(is_shared=True) | Q(owner=request.user))

  data = data.order_by('-last_modified')

  return render('editor/list_bundles.mako', request, {
    'jobs': list(data),
    'json_jobs': json.dumps(list(data.values_list('id', flat=True))),
  })
开发者ID:2013Commons,项目名称:HUE-SHARK,代码行数:14,代码来源:editor.py

示例5: test_workflow_action_permissions

  def test_workflow_action_permissions(self):
    # Login as someone else
    client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test')
    grant_access("not_me", "test", "oozie")

    action1 = Node.objects.get(name='action-name-1')

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_action', args=[action1.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:edit_action', args=[action1.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Delete
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:delete_action', args=[action1.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    action1.workflow.is_shared = True
    action1.workflow.save()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_action', args=[action1.id]))
      assert_false('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:edit_action', args=[action1.id]))
      assert_true('Not allowed' in response.content, response.content)
    finally:
      finish()

    # Delete
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:delete_action', args=[action1.id]))
      assert_true('Not allowed' in response.content, response.content)
    finally:
      finish()
开发者ID:kthguru,项目名称:hue,代码行数:57,代码来源:tests.py

示例6: list_coordinators

def list_coordinators(request, workflow_id=None):
  data = Coordinator.objects
  if workflow_id is not None:
    data = data.filter(workflow__id=workflow_id)

  if not SHARE_JOBS.get() and not request.user.is_superuser:
    data = data.filter(owner=request.user)
  else:
    data = data.filter(Q(is_shared=True) | Q(owner=request.user))

  data = data.order_by('-last_modified')

  return render('editor/list_coordinators.mako', request, {
    'jobs': list(data),
    'json_jobs': json.dumps(list(data.values_list('id', flat=True))),
  })
开发者ID:yjkim,项目名称:hue,代码行数:16,代码来源:editor.py

示例7: list_workflows

def list_workflows(request):
  show_setup_app = True
  data = Workflow.objects

  if not SHARE_JOBS.get() and not request.user.is_superuser:
    data = data.filter(owner=request.user)
  else:
    data = data.filter(Q(is_shared=True) | Q(owner=request.user))

  data = data.order_by('-last_modified')

  return render('editor/list_workflows.mako', request, {
    'jobs': list(data),
    'currentuser': request.user,
    'show_setup_app': show_setup_app,
  })
开发者ID:zwqjsj0404,项目名称:hue,代码行数:16,代码来源:editor.py

示例8: list_workflows

def list_workflows(request):
    show_setup_app = True
    data = Workflow.objects

    if not SHARE_JOBS.get() and not request.user.is_superuser:
        data = data.filter(owner=request.user)
    else:
        data = data.filter(Q(is_shared=True) | Q(owner=request.user))

    data = data.order_by("-last_modified")

    return render(
        "editor/list_workflows.mako",
        request,
        {"jobs": list(data), "currentuser": request.user, "show_setup_app": show_setup_app},
    )
开发者ID:romainr,项目名称:hue,代码行数:16,代码来源:editor.py

示例9: test_coordinator_permissions

  def test_coordinator_permissions(self):
    coord = create_coordinator(self.wf)

    response = self.c.get(reverse('oozie:edit_coordinator', args=[coord.id]))
    assert_true('Editor' in response.content, response.content)
    assert_true('value="Save"' in response.content, response.content)

    # Login as someone else
    client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test')
    grant_access("not_me", "test", "oozie")

    # List
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:list_coordinators'))
      assert_false('MyCoord' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:list_coordinators'))
      assert_false('MyCoord' in response.content, response.content)
    finally:
      finish()

    # View
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_false('MyCoord' in response.content, response.content)
    finally:
      finish()

    # Share it !
    coord.is_shared = True
    coord.save()
    coord.workflow.is_shared = True
    coord.workflow.save()

    # List
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:list_coordinators'))
      assert_equal(200, response.status_code)
      assert_true('MyCoord' in response.content, response.content)
    finally:
      finish()

    # View
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_false('Permission denied' in response.content, response.content)
      assert_false('value="Save"' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_false('MyCoord' in response.content, response.content)
      assert_true('Not allowed' in response.content, response.content)
    finally:
      finish()

    # Submit
#    finish = SHARE_JOBS.set_for_testing(False)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#    try:
#      response = client_not_me.post(reverse('oozie:submit_coordinator', args=[coord.id]))
#      assert_true('Permission denied' in response.content, response.content)
#    finally:
#      finish()
#      finish_deployement()
#    finish = SHARE_JOBS.set_for_testing(True)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#    try:
#      response = client_not_me.post(reverse('oozie:submit_coordinator', args=[coord.id]))
#      assert_false('Permission denied' in response.content, response.content)
#    finally:
#      finish()
#      finish_deployement()
#
#    # Resubmit
#    # Monkey patch Lib Oozie with Mock API
#    finish = SHARE_JOBS.set_for_testing(False)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#.........这里部分代码省略.........
开发者ID:kthguru,项目名称:hue,代码行数:101,代码来源:tests.py

示例10: test_workflow_permissions

  def test_workflow_permissions(self):
    # Monkey patch Lib Oozie with Mock API
    oozie_api.OozieApi = MockOozieApi
    oozie_api._api_cache = None

    response = self.c.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
    assert_true('Editor' in response.content, response.content)
    assert_true('Workflow wf-name-1' in response.content, response.content)
    assert_false(self.wf.is_shared)

    # Login as someone else
    client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test')
    grant_access("not_me", "test", "oozie")

    # List
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:list_workflows'))
      assert_false('wf-name-1' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:list_workflows'))
      assert_false('wf-name-1' in response.content, response.content)
    finally:
      finish()

    # View
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Share it !
    self.wf.is_shared = True
    self.wf.save()

    # List
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:list_workflows'))
      assert_equal(200, response.status_code)
      assert_true('wf-name-1' in response.content, response.content)
    finally:
      finish()

    # View
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
      assert_false('Permission denied' in response.content, response.content)
      assert_false('Save' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:edit_workflow', args=[self.wf.id]))
      assert_true('Not allowed' in response.content, response.content)
    finally:
      finish()

    # Submit
#    finish = SHARE_JOBS.set_for_testing(False)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#    try:
#      response = client_not_me.post(reverse('oozie:submit_workflow', args=[self.wf.id]))
#      assert_true('Permission denied' in response.content, response.content)
#    finally:
#      finish()
#      finish_deployement()
#    finish = SHARE_JOBS.set_for_testing(True)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#    try:
#      response = client_not_me.post(reverse('oozie:submit_workflow', args=[self.wf.id]))
#      assert_false('Permission denied' in response.content, response.content)
#    finally:
#      finish()
#      finish_deployement()
#
#    # Resubmit
#    finish = SHARE_JOBS.set_for_testing(False)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#    try:
#.........这里部分代码省略.........
开发者ID:kthguru,项目名称:hue,代码行数:101,代码来源:tests.py


注:本文中的oozie.conf.SHARE_JOBS类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。