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


Python Order.order_source方法代码示例

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


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

示例1: enter_new_order

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import order_source [as 别名]
def enter_new_order(email, order_source, scene_list, option_string, note=""):
    """Places a new espa order in the database"""
    order = Order()
    order.orderid = generate_order_id(email)
    order.email = email
    order.note = note
    order.status = "ordered"
    order.order_date = datetime.datetime.now()
    order.product_options = option_string
    order.order_source = order_source
    order.save()

    for s in set(scene_list):
        scene = Scene()
        scene.name = s
        scene.order = order
        scene.order_date = datetime.datetime.now()
        scene.status = "submitted"
        scene.save()

    return order
开发者ID:USGS-EROS,项目名称:espa-junk-drawer,代码行数:23,代码来源:core.py

示例2: load_ee_orders

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import order_source [as 别名]
def load_ee_orders():
    """ Loads all the available orders from lta into our database and updates their status """
    lta_service = lta.LtaServices()

    # This returns a dict that contains a list of dicts{}
    # key:(order_num,email) = list({sceneid:, unit_num:})
    orders = lta_service.get_available_orders()

    # This sets (hard codes) the product options that comes in from EE when someone
    # is requesting processing via their interface
    ee_options = {
        "include_sourcefile": False,
        "include_source_metadata": False,
        "include_sr_toa": False,
        "include_sr_thermal": False,
        "include_sr": True,
        "include_sr_browse": False,
        "include_sr_ndvi": False,
        "include_sr_ndmi": False,
        "include_sr_nbr": False,
        "include_sr_nbr2": False,
        "include_sr_savi": False,
        "include_sr_evi": False,
        "include_solr_index": False,
        "include_cfmask": False,
        "reproject": False,
        "resize": False,
        "image_extents": False,
    }

    # Capture in our db
    for eeorder, email in orders:

        # create the orderid based on the info from the eeorder
        order_id = generate_ee_order_id(email, eeorder)
        order = None

        # go look to see if it already exists in the db
        try:
            order = Order.objects.get(orderid=order_id)
        except:
            # Didn't find it in the db... make the order now
            order = Order()
            order.orderid = generate_ee_order_id(email, eeorder)
            order.email = email
            order.chain = "sr_ondemand"
            order.status = "ordered"
            order.note = "EarthExplorer order id: %s" % eeorder
            order.product_options = json.dumps(ee_options)
            order.ee_order_id = eeorder
            order.order_source = "ee"
            order.order_date = datetime.datetime.now()
            order.save()

        for s in orders[eeorder, email]:
            # go look for the scene by ee_unit_id.  This will stop
            # duplicate key update collisions

            scene = None
            try:
                scene = Scene.objects.get(order=order, ee_unit_id=s["unit_num"])
                if scene.status == "complete":
                    success, msg, status = lta_service.update_order(eeorder, s["unit_num"], "C")
                    if not success:
                        log_msg = "Error updating lta for [eeorder:%s ee_unit_num:%s scene name:%s order:%s" % (
                            eeorder,
                            s["unit_num"],
                            scene.name,
                            order.orderid,
                        )
                        helperlogger(log_msg)
                        log_msg = "Error detail: lta return message:%s  lta return status code:%s" % (msg, status)
                        helperlogger(log_msg)
                elif scene.status == "unavailable":
                    success, msg, status = lta_service.update_order(eeorder, s["unit_num"], "R")
                    if not success:
                        log_msg = "Error updating lta for [eeorder:%s ee_unit_num:%s scene name:%s order:%s" % (
                            eeorder,
                            s["unit_num"],
                            scene.name,
                            order.orderid,
                        )
                        helperlogger(log_msg)
                        log_msg = "Error detail: lta return message:%s  lta return status code:%s" % (msg, status)
                        helperlogger(log_msg)
            except:
                scene = Scene()
                scene.name = s["sceneid"]
                scene.ee_unit_id = s["unit_num"]
                scene.order = order
                scene.order_date = datetime.datetime.now()
                scene.status = "submitted"
                scene.save()

            # Update LTA
            success, msg, status = lta_service.update_order(eeorder, s["unit_num"], "I")
            if not success:
                log_msg = "Error updating lta for [eeorder:%s ee_unit_num:%s scene name:%s order:%s" % (
                    eeorder,
                    s["unit_num"],
#.........这里部分代码省略.........
开发者ID:USGS-EROS,项目名称:espa-junk-drawer,代码行数:103,代码来源:core.py


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