bugfix
This commit is contained in:
parent
0c44c5fc4c
commit
c5ea4b5e25
@ -358,7 +358,18 @@ where backid=${backid}$
|
|||||||
ne.running_at = timestampstr()
|
ne.running_at = timestampstr()
|
||||||
await sor.U('node_execution', ne.copy())
|
await sor.U('node_execution', ne.copy())
|
||||||
|
|
||||||
|
async def autorun_task(self, ne_id, params):
|
||||||
|
env = ServerEnv()
|
||||||
|
try:
|
||||||
|
data = await env.run_skillagent(params)
|
||||||
|
debug(f'任务完成,返回数据={data}')
|
||||||
|
self.self.task_success_callback(ne_id, data)
|
||||||
|
except Exception as e:
|
||||||
|
message = f'任务失败错误信息{e}'
|
||||||
|
self.self.task_error_callback(ne_id, message)
|
||||||
|
|
||||||
async def run_auto_task(self, ne):
|
async def run_auto_task(self, ne):
|
||||||
|
async def run_task(
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
users = await env.get_org_users(ne.org_id)
|
users = await env.get_org_users(ne.org_id)
|
||||||
if not users:
|
if not users:
|
||||||
@ -366,16 +377,12 @@ where backid=${backid}$
|
|||||||
return
|
return
|
||||||
sub_ctx = self.build_node_input_ctx(ne)
|
sub_ctx = self.build_node_input_ctx(ne)
|
||||||
try:
|
try:
|
||||||
f = partial(self.task_success_callback, ne.id)
|
|
||||||
ef = partial(self.task_error_callback, ne.id)
|
|
||||||
params = DictObject(**{
|
params = DictObject(**{
|
||||||
"prompt": sub_ctx,
|
"prompt": sub_ctx,
|
||||||
"callerid": users[0].id,
|
"callerid": users[0].id,
|
||||||
"callerorgid": users[0].orgid,
|
"callerorgid": users[0].orgid
|
||||||
"callback":f,
|
|
||||||
"errback": ef
|
|
||||||
})
|
})
|
||||||
asyncio.create_task(env.run_skillagent(params))
|
asyncio.create_task(self.autorun_task(ne_id, params))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await self.task_error_callback(ne.id, str(e))
|
await self.task_error_callback(ne.id, str(e))
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
|||||||
@ -22,11 +22,10 @@ async def run_skillagent(params):
|
|||||||
f = params['callback']
|
f = params['callback']
|
||||||
data = {'data1': 'test'}
|
data = {'data1': 'test'}
|
||||||
debug(f'任务模拟完成,返回数据={data}')
|
debug(f'任务模拟完成,返回数据={data}')
|
||||||
f(data)
|
return data
|
||||||
else:
|
else:
|
||||||
f = params['errback']
|
f = params['errback']
|
||||||
message = '任务模拟失败错误信息'
|
raise Exception('伪造的错误信息')
|
||||||
f(message)
|
|
||||||
|
|
||||||
async def dagbacktask(engines, app):
|
async def dagbacktask(engines, app):
|
||||||
tasks = []
|
tasks = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user