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


Python QueryHistory.server_id方法代码示例

本文整理汇总了Python中beeswax.models.QueryHistory.server_id方法的典型用法代码示例。如果您正苦于以下问题:Python QueryHistory.server_id方法的具体用法?Python QueryHistory.server_id怎么用?Python QueryHistory.server_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在beeswax.models.QueryHistory的用法示例。


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

示例1: execute_directly

# 需要导入模块: from beeswax.models import QueryHistory [as 别名]
# 或者: from beeswax.models.QueryHistory import server_id [as 别名]
def execute_directly(user, query_msg, design=None, notify=False):
  """
  execute_directly(user, query_msg [,design]) -> QueryHistory object

  This method also creates a QueryHistory object and saves it.
  user - Django user.
  query_msg - The thrift Query object.
  design - The SavedQuery object (i.e. design) associated with this query.
  notify - Whether to notify the user upon completion.
  """
  query_history = QueryHistory(
                            owner=user,
                            query=query_msg.query,
                            last_state=QueryHistory.STATE.submitted.index,
                            design=design,
                            notify=notify)
  query_history.save()
  LOG.debug("Made new QueryHistory id %s user %s query: %s..." %
            (query_history.id, user, query_history.query[:25]))

  # Now submit it
  try:
    handle = db_client().query(query_msg)
    if not handle or not handle.id or not handle.log_context:
      # It really shouldn't happen
      msg = "BeeswaxServer returning invalid handle for query id %d [%s]..." % \
            (query_history.id, query_msg.query[:40])
      raise Exception(msg)
  except BeeswaxException, bex:
    # Kind of expected (hql compile/syntax error, etc.)
    if bex.handle:
      query_history.server_id = bex.handle.id
      query_history.log_context = bex.handle.log_context
    query_history.save_state(QueryHistory.STATE.failed)
    raise bex
开发者ID:ConduitTeam,项目名称:hue,代码行数:37,代码来源:db_utils.py

示例2: execute_directly

# 需要导入模块: from beeswax.models import QueryHistory [as 别名]
# 或者: from beeswax.models.QueryHistory import server_id [as 别名]
def execute_directly(user, query_msg, query_server=None, design=None, notify=False):
  """
  execute_directly(user, query_msg [,design]) -> QueryHistory object

  This method also creates a QueryHistory object and saves it.
  user - Django user.
  query_msg - The thrift Query object.
  design - The SavedQuery object (i.e. design) associated with this query.
  notify - Whether to notify the user upon completion.
  """
  if query_server is None:
    query_server = get_query_server(support_ddl=True) # For convenience with DDL queries only

  query_history = QueryHistory(
                            owner=user,
                            query=query_msg.query,
                            server_host='%(server_host)s' % query_server,
                            server_port='%(server_port)d' % query_server,
                            server_name='%(server_name)s' % query_server,
                            last_state=QueryHistory.STATE.submitted.index,
                            design=design,
                            notify=notify)
  query_history.save()
  LOG.debug("Made new QueryHistory id %s user %s query: %s..." %
            (query_history.id, user, query_history.query[:25]))

  # Now submit it
  try:
    handle = db_client(query_server).query(query_msg)
    if not handle or not handle.id:
      # It really shouldn't happen
      msg = _("BeeswaxServer returning invalid handle for query id %(id)d [%(query)s]...") % \
            {'id': query_history.id, 'query': query_msg.query[:40]}
      raise Exception(msg)
  except BeeswaxException, bex:
    # Kind of expected (hql compile/syntax error, etc.)
    if bex.handle:
      query_history.server_id = bex.handle.id
      query_history.log_context = bex.handle.log_context
    query_history.save_state(QueryHistory.STATE.failed)
    raise bex
开发者ID:DatalakeInc,项目名称:hortonworks-sandbox,代码行数:43,代码来源:db_utils.py


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