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


Python credentials.Credentials类代码示例

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


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

示例1: edit_coordinator

def edit_coordinator(request):
  coordinator_id = request.GET.get('coordinator', request.GET.get('uuid'))
  doc = None
  workflow_uuid = None

  if coordinator_id:
    cid = {}
    if coordinator_id.isdigit():
      cid['id'] = coordinator_id
    else:
      cid['uuid'] = coordinator_id
    doc = Document2.objects.get(**cid)
    coordinator = Coordinator(document=doc)
  else:
    coordinator = Coordinator()
    coordinator.set_workspace(request.user)

  if request.GET.get('workflow'):
    workflow_uuid = request.GET.get('workflow')

  if workflow_uuid:
    coordinator.data['properties']['workflow'] = workflow_uuid

  api = get_oozie(request.user)
  credentials = Credentials()

  try:
    credentials.fetch(api)
  except Exception, e:
    LOG.error(smart_str(e))
开发者ID:cloudera,项目名称:hue,代码行数:30,代码来源:editor2.py

示例2: _update_properties

  def _update_properties(self, jobtracker_addr, deployment_dir=None):
    LOG.info('Using FS %s and JT %s' % (self.fs, self.jt))

    if self.jt and self.jt.logical_name:
      jobtracker_addr = self.jt.logical_name

    if self.fs.logical_name:
      fs_defaultfs = self.fs.logical_name
    else:
      fs_defaultfs = self.fs.fs_defaultfs

    self.properties.update({
      'jobTracker': jobtracker_addr,
      'nameNode': fs_defaultfs,
    })

    if self.job and deployment_dir:
      self.properties.update({
        self.job.PROPERTY_APP_PATH: self.fs.get_hdfs_path(deployment_dir),
        self.job.HUE_ID: self.job.id
      })

    # Generate credentials when using security
    if self.api.security_enabled:
      credentials = Credentials()
      credentials.fetch(self.api)
      self.properties['credentials'] = credentials.get_properties()
开发者ID:neiodavince,项目名称:hue,代码行数:27,代码来源:submission2.py

示例3: test_gen_properties

  def test_gen_properties(self):
    creds = Credentials(credentials=TestCredentials.CREDENTIALS.copy())

    metastore = {
      'thrift_uri': 'thrift://hue-koh-chang:9999',
      'kerberos_principal': 'hive',
    }

    finish = (
      beeswax.conf.HIVE_SERVER_HOST.set_for_testing('hue-koh-chang'),
      beeswax.conf.HIVE_SERVER_PORT.set_for_testing(12345),
    )

    try:
      assert_equal({
          'hcat': {
            'xml_name': 'hcat',
            'properties': [
                ('hcat.metastore.uri', 'thrift://hue-koh-chang:9999'),
                ('hcat.metastore.principal', 'hive')
            ]},
         'hive2': {
            'xml_name': 'hive2',
            'properties': [
                ('hive2.jdbc.url', 'jdbc:hive2://hue-koh-chang:12345/default'),
                ('hive2.server.principal', 'hive')
          ]},
         'hbase': {
             'xml_name': 'hbase',
             'properties': []
          }
        }, creds.get_properties(metastore))
    finally:
      for f in finish:
        f()
开发者ID:2013Commons,项目名称:hue,代码行数:35,代码来源:credentials_tests.py

示例4: _edit_workflow

def _edit_workflow(request, doc, workflow):
  workflow_data = workflow.get_data()

  api = get_oozie(request.user)
  credentials = Credentials()

  try:
    credentials.fetch(api)
  except Exception, e:
    LOG.error(smart_str(e))
开发者ID:cloudera,项目名称:hue,代码行数:10,代码来源:editor2.py

示例5: export_workflow

def export_workflow(request, workflow):
  mapping = dict([(param['name'], param['value']) for param in workflow.find_all_parameters()])

  oozie_api = get_oozie(request.user)
  credentials = Credentials()
  credentials.fetch(oozie_api)
  mapping['credentials'] = credentials.get_properties()

  zip_file = workflow.compress(mapping=mapping)

  response = HttpResponse(content_type="application/zip")
  response["Last-Modified"] = http_date(time.time())
  response["Content-Length"] = len(zip_file.getvalue())
  response['Content-Disposition'] = 'attachment; filename="workflow-%s-%d.zip"' % (workflow.name, workflow.id)
  response.write(zip_file.getvalue())
  return response
开发者ID:18600597055,项目名称:hue,代码行数:16,代码来源:editor.py

示例6: test_parse_oozie

  def test_parse_oozie(self):
    oozie_credentialclasses = """
           hbase=org.apache.oozie.action.hadoop.HbaseCredentials,
           hcat=org.apache.oozie.action.hadoop.HCatCredentials,
           hive2=org.apache.oozie.action.hadoop.Hive2Credentials
    """
    oozie_config = {'oozie.credentials.credentialclasses': oozie_credentialclasses}

    creds = Credentials()

    assert_equal({
        'hive2': 'org.apache.oozie.action.hadoop.Hive2Credentials',
        'hbase': 'org.apache.oozie.action.hadoop.HbaseCredentials',
        'hcat': 'org.apache.oozie.action.hadoop.HCatCredentials'
      }, creds._parse_oozie(oozie_config)
    )
开发者ID:2013Commons,项目名称:hue,代码行数:16,代码来源:credentials_tests.py

示例7: edit_coordinator

def edit_coordinator(request):
  coordinator_id = request.GET.get('coordinator', request.GET.get('uuid'))
  doc = None
  workflow_uuid = None

  if coordinator_id:
    cid = {}
    if coordinator_id.isdigit():
      cid['id'] = coordinator_id
    else:
      cid['uuid'] = coordinator_id
    doc = Document2.objects.get(**cid)
    coordinator = Coordinator(document=doc)
  else:
    coordinator = Coordinator()
    coordinator.set_workspace(request.user)

  # Automatically create the workflow of a scheduled document
  # To move to save coordinator
  document_uuid = request.GET.get('document')
  if document_uuid:
    # Has already a workflow managing the query for this user?
    workflows = Document2.objects.filter(type='oozie-workflow2', owner=request.user, is_managed=True, dependencies__uuid__in=[document_uuid])
    if workflows.exists():
      workflow_doc = workflows.get()
    else:
      document = Document2.objects.get_by_uuid(user=request.user, uuid=document_uuid)
      workflow_doc = WorkflowBuilder().create_workflow(document=document, user=request.user, managed=True)
      if doc:
        doc.dependencies.add(workflow_doc)
    workflow_uuid = workflow_doc.uuid
    coordinator.data['name'] = _('Schedule of %s') % workflow_doc.name
  elif request.GET.get('workflow'):
    workflow_uuid = request.GET.get('workflow')

  if workflow_uuid:
    coordinator.data['properties']['workflow'] = workflow_uuid

  api = get_oozie(request.user)
  credentials = Credentials()

  try:
    credentials.fetch(api)
  except Exception, e:
    LOG.error(smart_str(e))
开发者ID:EricChen2013,项目名称:hue,代码行数:45,代码来源:editor2.py

示例8: _update_properties

    def _update_properties(self, jobtracker_addr, deployment_dir):
        if self.fs and self.jt:
            self.properties.update(
                {
                    "jobTracker": self.jt.logical_name or jobtracker_addr,
                    "nameNode": self.fs.logical_name or self.fs.fs_defaultfs,
                }
            )

        if self.job:
            self.properties.update(
                {
                    self.job.get_application_path_key(): self.fs.get_hdfs_path(deployment_dir),
                    self.job.HUE_ID: self.job.id,
                }
            )

        # Generate credentials when using security
        if self.api.security_enabled:
            credentials = Credentials()
            credentials.fetch(self.api)
            self.properties["credentials"] = credentials.get_properties()
开发者ID:hahakubile,项目名称:hue,代码行数:22,代码来源:submittion.py

示例9: edit_workflow

def edit_workflow(request, workflow):
  history = History.objects.filter(submitter=request.user, job=workflow).order_by('-submission_date')
  workflow_form = WorkflowForm(instance=workflow)
  user_can_access_job = workflow.can_read(request.user)
  user_can_edit_job = workflow.is_editable(request.user)
  api = get_oozie(request.user)
  credentials = Credentials()
  credentials.fetch(api)

  return render('editor/edit_workflow.mako', request, {
    'workflow_form': workflow_form,
    'workflow': workflow,
    'history': history,
    'user_can_access_job': user_can_access_job,
    'user_can_edit_job': user_can_edit_job,
    'job_properties': extract_field_data(workflow_form['job_properties']),
    'link_form': LinkForm(),
    'default_link_form': DefaultLinkForm(action=workflow.start),
    'node_form': NodeForm(),
    'action_forms': [(node_type, design_form_by_type(node_type, request.user, workflow)())
                     for node_type in ACTION_TYPES.iterkeys()],
    'credentials': json.dumps(credentials.credentials.keys())
  })
开发者ID:Web5design,项目名称:hue,代码行数:23,代码来源:editor.py


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