• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python models.get_api函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: close_notebook

def close_notebook(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))

  response['status'] = 0
  for snippet in notebook['snippets']:
    try:
      if snippet['result']['handle']:
        get_api(request.user, snippet).close(snippet)
    except QueryExpired:
      pass
  response['message'] = _('Notebook closed !')

  return JsonResponse(response)
开发者ID:JamesLiChina,项目名称:hue,代码行数:15,代码来源:api.py


示例2: close_session

def close_session(request):
  response = {'status': -1}

  session = json.loads(request.POST.get('session', '{}'))

  response['session'] = get_api(request.user, {'type': session['type']}).close_session(session=session)
  response['status'] = 0

  return JsonResponse(response)
开发者ID:GorillaTester,项目名称:hue,代码行数:9,代码来源:api.py


示例3: create_session

def create_session(request):
  response = {'status': -1}

  snippet = json.loads(request.POST.get('snippet', '{}'))

  response['session'] = get_api(request.user, snippet).create_session(lang=snippet['type'])
  response['status'] = 0

  return JsonResponse(response)
开发者ID:JamesLiChina,项目名称:hue,代码行数:9,代码来源:api.py


示例4: check_status

def check_status(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))

  response['query_status'] = get_api(request.user, snippet).check_status(notebook, snippet)
  response['status'] = 0

  return JsonResponse(response)
开发者ID:GorillaTester,项目名称:hue,代码行数:10,代码来源:api.py


示例5: execute

def execute(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))

  response['handle'] = get_api(request.user, snippet).execute(notebook, snippet)
  response['status'] = 0

  return JsonResponse(response)
开发者ID:GorillaTester,项目名称:hue,代码行数:10,代码来源:api.py


示例6: cancel_statement

def cancel_statement(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))

  response['result'] = get_api(request.user, snippet).cancel(notebook, snippet)
  response['status'] = 0

  return JsonResponse(response)
开发者ID:GorillaTester,项目名称:hue,代码行数:10,代码来源:api.py


示例7: fetch_result_metadata

def fetch_result_metadata(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))

  response['result'] = get_api(request.user, snippet).fetch_result_metadata(notebook, snippet)
  response['status'] = 0

  return JsonResponse(response)
开发者ID:GorillaTester,项目名称:hue,代码行数:10,代码来源:api.py


示例8: close_notebook

def close_notebook(request):
  response = {'status': -1, 'result': []}

  notebook = json.loads(request.POST.get('notebook', '{}'))

  for session in notebook['sessions']:
    try:
      response['result'].append(get_api(request.user, session).close_session(session))
    except QueryExpired:
      pass
    except Exception, e:
      LOG.exception('Error closing session %s' % e.message)
开发者ID:GorillaTester,项目名称:hue,代码行数:12,代码来源:api.py


示例9: fetch_result_data

def fetch_result_data(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))
  rows = json.loads(request.POST.get('rows', 100))
  start_over = json.loads(request.POST.get('startOver', False))

  response['result'] = get_api(request.user, snippet).fetch_result(notebook, snippet, rows, start_over)
  response['status'] = 0

  return JsonResponse(response)
开发者ID:GorillaTester,项目名称:hue,代码行数:12,代码来源:api.py


示例10: close_statement

def close_statement(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))

  try:
    response['result'] = get_api(request.user, snippet).close(snippet)
  except QueryExpired:
    pass
  response['status'] = 0

  return JsonResponse(response)
开发者ID:JamesLiChina,项目名称:hue,代码行数:13,代码来源:api.py


示例11: close_statement

def close_statement(request):
  response = {'status': -1}

  # Passed by check_document_access_permission but unused by APIs
  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))

  try:
    response['result'] = get_api(request.user, snippet).close_statement(snippet)
  except QueryExpired:
    pass

  response['status'] = 0
  response['message'] = _('Statement closed !')

  return JsonResponse(response)
开发者ID:GorillaTester,项目名称:hue,代码行数:16,代码来源:api.py


示例12: get_logs

def get_logs(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))

  db = get_api(request.user, snippet)
  response['logs'] = db.get_log(snippet)
  response['progress'] = db._progress(snippet, response['logs']) if snippet['status'] != 'available' else 100
  response['job_urls'] = [{
      'name': job,
      'url': reverse('jobbrowser.views.single_job', kwargs={'job': job})
    } for job in db._get_jobs(response['logs'])]
  response['status'] = 0

  return JsonResponse(response)
开发者ID:JamesLiChina,项目名称:hue,代码行数:16,代码来源:api.py


示例13: create_session

def create_session(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))

  session = [session for session in notebook['sessions'] if snippet['type'] == session['type']]
  if any(session) and 'properties' in session[0]:
    properties = session[0]['properties']
  else:
    properties = None

  response['session'] = get_api(request.user, snippet).create_session(lang=snippet['type'], properties=properties)
  response['status'] = 0

  return JsonResponse(response)
开发者ID:renxiawang,项目名称:hue,代码行数:16,代码来源:api.py


示例14: create_session

def create_session(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))
  session = json.loads(request.POST.get('session', '{}'))

  properties = session.get('properties', [])

  # If not properties look for previously used notebook session
  if not properties:
    old_session = [_session for _session in notebook['sessions'] if _session['type'] == session['type']]
    if any(old_session) and 'properties' in old_session[0]:
      properties = old_session[0]['properties']

  response['session'] = get_api(request.user, session).create_session(lang=session['type'], properties=properties)
  response['status'] = 0

  return JsonResponse(response)
开发者ID:neiodavince,项目名称:hue,代码行数:18,代码来源:api.py


示例15: get_logs

def get_logs(request):
  response = {'status': -1}

  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))

  startFrom = request.POST.get('from')
  startFrom = int(startFrom) if startFrom else None

  size = request.POST.get('size')
  size = int(size) if size else None

  db = get_api(request.user, snippet)
  response['logs'] = db.get_log(notebook, snippet, startFrom=startFrom, size=size)
  response['progress'] = db._progress(snippet, response['logs']) if snippet['status'] != 'available' and snippet['status'] != 'success' else 100
  response['job_urls'] = [{
      'name': job,
      'url': reverse('jobbrowser.views.single_job', kwargs={'job': job})
    } for job in db._get_jobs(response['logs'])]
  response['status'] = 0

  return JsonResponse(response)
开发者ID:GorillaTester,项目名称:hue,代码行数:22,代码来源:api.py


示例16: download

def download(request):
  notebook = json.loads(request.POST.get('notebook', '{}'))
  snippet = json.loads(request.POST.get('snippet', '{}'))
  file_format = request.POST.get('format', 'csv')

  return get_api(request.user, snippet).download(notebook, snippet, file_format)
开发者ID:javachengwc,项目名称:hue,代码行数:6,代码来源:views.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python stimulus_model.StimulusModel类代码示例发布时间:2022-05-27
下一篇:
Python job_server_api.get_spark_api函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap