diff --git a/dagflow/dagflow.py b/dagflow/dagflow.py index 27349b2..ef51024 100644 --- a/dagflow/dagflow.py +++ b/dagflow/dagflow.py @@ -60,11 +60,11 @@ NODE_EXECUTION_TABLE = { {"name": "ctx_ext", "type": "text"}, {"name": "status", "type": "str", "length": 16}, {"name": "error", "type": "text"}, - {"name": "input", "type": "text"}, - {"name": "output", "type": "text"}, + {"name": "input", "type": "text"}, + {"name": "output", "type": "text"}, {"name": "subinst_id", "type": "str", "length": 32}, {"name": "role", "type": "str", "length": 64}, - {"name": "assignee", "type": "str", "length": 64}, + {"name": "assignee", "type": "str", "length": 64}, {"name": "running_at", "type": "timestamp"}, {"name": "stopping_at", "type": "timestamp"}, {"name": "created_at", "type": "timestamp"} @@ -112,23 +112,23 @@ from ahserver.serverenv import ServerEnv import re def extract_some_value(s): - """ - 从 'some(100)' 或 'some(50%)' 中提取数值。 - Args: - s (str): 输入的字符串 - - Returns: float类型值, 小于1的小数点数字(%模式)或其他 - """ - # 正则解释: 匹配 some( 后跟数字,然后是可选的 % 符号,最后是 ) - match = re.search(r'some\((\d+)(%)?\)', s) - if match: - value = float(match.group(1)) # 提取数字部分并转为整数 - unit = match.group(2) # 提取单位部分 (%) + """ + 从 'some(100)' 或 'some(50%)' 中提取数值。 + Args: + s (str): 输入的字符串 + + Returns: float类型值, 小于1的小数点数字(%模式)或其他 + """ + # 正则解释: 匹配 some( 后跟数字,然后是可选的 % 符号,最后是 ) + match = re.search(r'some\((\d+)(%)?\)', s) + if match: + value = float(match.group(1)) # 提取数字部分并转为整数 + unit = match.group(2) # 提取单位部分 (%) if unit == '%': return value / 100.0 return value - else: - return None + else: + return None class FlowEngine: @@ -415,7 +415,7 @@ where node_id in ${backnodes}$ set status = 'cancelled' where status in ['pending', 'running'] and node_id in ${backnodes}$ - and instance_id = ${instance_id}$""" + and instance_id = ${instance_id}$""" await sor.sqlExe(sql, { 'backnodes': backnodes, 'instance_id': inst['id'] @@ -426,8 +426,8 @@ where status in ['pending', 'running'] where instance_id=${instance_id}$ and to_node_id = ${node_id}$""" trecs = sor.sqlExe(sql, { - 'node_id': node['id'], - 'instance_id': inst['id'] + 'node_id': node['id'], + 'instance_id': inst['id'] }) if some >= 1 and some <= len(trecs): return True