|
16 | 16 | from tmll.common.models.timegraph.timegraph import TimeGraph |
17 | 17 | from tmll.common.models.trace import Trace |
18 | 18 | from tmll.common.models.experiment import Experiment |
| 19 | +from tmll.common.models.tree.node import NodeTree |
19 | 20 | from tmll.common.models.tree.tree import Tree |
20 | 21 |
|
21 | 22 | from tmll.tsp.tsp.indexing_status import IndexingStatus |
@@ -221,7 +222,22 @@ def fetch_outputs_with_tree(self, experiment: Experiment, custom_output_ids: Opt |
221 | 222 |
|
222 | 223 | # Get the trees of the outputs |
223 | 224 | match output.type: |
224 | | - case "TABLE" | "DATA_TREE": |
| 225 | + case "TABLE": |
| 226 | + response = self.tsp_client.fetch_virtual_table_columns(exp_uuid=experiment.uuid, output_id=output.id) |
| 227 | + if response.status_code != 200: |
| 228 | + self.logger.error(f"Failed to fetch table columns. Error: {response.status_text}") |
| 229 | + continue |
| 230 | + |
| 231 | + columns = response.model.model.columns |
| 232 | + tree = Tree([NodeTree(name=col.name, id=col.id, parent_id=-1) for col in columns]) |
| 233 | + fetched_outputs.append({ |
| 234 | + "output": output, |
| 235 | + "tree": tree |
| 236 | + }) |
| 237 | + self.logger.info(f"Output '{output.name}' and its tree fetched successfully.") |
| 238 | + continue |
| 239 | + |
| 240 | + case "DATA_TREE": |
225 | 241 | while True: |
226 | 242 | response = self.tsp_client.fetch_datatree(exp_uuid=experiment.uuid, output_id=output.id) |
227 | 243 | if response.status_code != 200: |
@@ -265,6 +281,10 @@ def fetch_outputs_with_tree(self, experiment: Experiment, custom_output_ids: Opt |
265 | 281 | self.logger.warning(f"Output type '{output.type}' is not supported.") |
266 | 282 | continue |
267 | 283 |
|
| 284 | + if response.model is None: |
| 285 | + self.logger.warning(f"Tree of the output '{output.name}' is None.") |
| 286 | + continue |
| 287 | + |
268 | 288 | model = response.model.model |
269 | 289 | if model is None: |
270 | 290 | self.logger.warning(f"Tree of the output '{output.name}' is None.") |
|
0 commit comments