我已经将goblin ogm样本写入我的火花应用程序,但我得到的任务被破坏但它正在等待! 下面是我的代码 def savePartition(p): 来自goblin import元素,属性
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) 我很想知道如何在上面的代码中关闭响应。非常感谢。