1

我已将地精 ogm 示例写入我的 spark 应用程序,但我的任务已被破坏,但它正在等待处理!下面是我的代码 def savePartition(p): from goblin import element, properties

class Brand(element.Vertex):
    name = properties.Property(properties.String)

import asyncio

loop = asyncio.get_event_loop()

from goblin.app import Goblin
app = loop.run_until_complete(Goblin.open(loop))
app.register(Brand)

async def go(app):
    session = await app.session()

    for i in p:
        if i['brand']:
            traversal = session.traversal(Brand)
            result = await traversal.has(Brand.name, i['brand']).oneOrNone()

            if not result:
                brand = Brand()
                brand.name = i['brand']
                session.add(brand)

    await session.flush()

loop.run_until_complete(go(app))

rdd = rdd.foreachPartition(savePartition) 我想知道如何关闭上面代码中的响应。非常感谢。

4

0 回答 0