Kevin Hu
commited on
Commit
·
542bb2e
1
Parent(s):
2ab9fa3
Fix exec sql exception issue. (#3982)
Browse files### What problem does this PR solve?
#3978
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- agent/canvas.py +10 -13
- agent/component/exesql.py +1 -1
agent/canvas.py
CHANGED
@@ -206,7 +206,12 @@ class Canvas(ABC):
|
|
206 |
waiting.append(c)
|
207 |
continue
|
208 |
yield "*'{}'* is running...🕞".format(self.get_compnent_name(c))
|
209 |
-
|
|
|
|
|
|
|
|
|
|
|
210 |
self.path[-1].append(c)
|
211 |
ran += 1
|
212 |
|
@@ -228,20 +233,12 @@ class Canvas(ABC):
|
|
228 |
switch_out = cpn["obj"].output()[1].iloc[0, 0]
|
229 |
assert switch_out in self.components, \
|
230 |
"{}'s output: {} not valid.".format(cpn_id, switch_out)
|
231 |
-
|
232 |
-
|
233 |
-
yield {"content": m, "running_status": True}
|
234 |
-
except Exception as e:
|
235 |
-
logging.exception("Canvas.run got exception")
|
236 |
-
raise e
|
237 |
continue
|
238 |
|
239 |
-
|
240 |
-
|
241 |
-
yield {"content": m, "running_status": True}
|
242 |
-
except Exception as e:
|
243 |
-
logging.exception("Canvas.run got exception")
|
244 |
-
raise e
|
245 |
|
246 |
if ran >= len(self.path[-1]) and waiting:
|
247 |
without_dependent_checking = waiting
|
|
|
206 |
waiting.append(c)
|
207 |
continue
|
208 |
yield "*'{}'* is running...🕞".format(self.get_compnent_name(c))
|
209 |
+
try:
|
210 |
+
ans = cpn.run(self.history, **kwargs)
|
211 |
+
except Exception as e:
|
212 |
+
logging.exception(f"Canvas.run got exception: {e}")
|
213 |
+
self.path[-1].append(c)
|
214 |
+
raise e
|
215 |
self.path[-1].append(c)
|
216 |
ran += 1
|
217 |
|
|
|
233 |
switch_out = cpn["obj"].output()[1].iloc[0, 0]
|
234 |
assert switch_out in self.components, \
|
235 |
"{}'s output: {} not valid.".format(cpn_id, switch_out)
|
236 |
+
for m in prepare2run([switch_out]):
|
237 |
+
yield {"content": m, "running_status": True}
|
|
|
|
|
|
|
|
|
238 |
continue
|
239 |
|
240 |
+
for m in prepare2run(cpn["downstream"]):
|
241 |
+
yield {"content": m, "running_status": True}
|
|
|
|
|
|
|
|
|
242 |
|
243 |
if ran >= len(self.path[-1]) and waiting:
|
244 |
without_dependent_checking = waiting
|
agent/component/exesql.py
CHANGED
@@ -64,7 +64,7 @@ class ExeSQL(ComponentBase, ABC):
|
|
64 |
self._loop += 1
|
65 |
|
66 |
ans = self.get_input()
|
67 |
-
ans = "".join(ans["content"]) if "content" in ans else ""
|
68 |
ans = re.sub(r'^.*?SELECT ', 'SELECT ', repr(ans), flags=re.IGNORECASE)
|
69 |
ans = re.sub(r';.*?SELECT ', '; SELECT ', ans, flags=re.IGNORECASE)
|
70 |
ans = re.sub(r';[^;]*$', r';', ans)
|
|
|
64 |
self._loop += 1
|
65 |
|
66 |
ans = self.get_input()
|
67 |
+
ans = "".join([str(a) for a in ans["content"]]) if "content" in ans else ""
|
68 |
ans = re.sub(r'^.*?SELECT ', 'SELECT ', repr(ans), flags=re.IGNORECASE)
|
69 |
ans = re.sub(r';.*?SELECT ', '; SELECT ', ans, flags=re.IGNORECASE)
|
70 |
ans = re.sub(r';[^;]*$', r';', ans)
|