|
4 | 4 |
|
5 | 5 | from __future__ import annotations
|
6 | 6 |
|
7 |
| -from typing import ClassVar, List, Optional, Set, overload |
| 7 | +import sys |
| 8 | +from typing import ClassVar, Dict, List, Optional, Set, overload |
8 | 9 |
|
9 | 10 | from pydantic.v1 import Field, validator
|
10 | 11 |
|
@@ -71,29 +72,33 @@ def creator(
|
71 | 72 |
|
72 | 73 | @classmethod
|
73 | 74 | def processes_creator(
|
74 |
| - cls, client, a_i_model_guid: str, database_dict: dict[AIDatasetType, list] |
| 75 | + cls, |
| 76 | + a_i_model_guid: str, |
| 77 | + a_i_model_name: str, |
| 78 | + database_dict: Dict[AIDatasetType, list], |
75 | 79 | ) -> List[Process]:
|
76 | 80 | process_list = []
|
77 |
| - output_asset = client.asset.get_by_guid(guid=a_i_model_guid, asset_type=AIModel) |
78 | 81 | for key, value_list in database_dict.items():
|
79 | 82 | for value in value_list:
|
80 |
| - input_asset = client.asset.get_by_guid(guid=value.guid) |
| 83 | + asset_type = getattr( |
| 84 | + sys.modules.get("pyatlan.model.assets", {}), value.type_name, None |
| 85 | + ) |
81 | 86 | if key == AIDatasetType.OUTPUT:
|
82 |
| - process_name = f"{output_asset.name} -> {input_asset.name}" |
| 87 | + process_name = f"{a_i_model_name} -> {value.name}" |
83 | 88 | process_created = Process.creator(
|
84 | 89 | name=process_name,
|
85 | 90 | connection_qualified_name="default/ai/dataset",
|
86 | 91 | inputs=[AIModel.ref_by_guid(guid=a_i_model_guid)],
|
87 |
| - outputs=[value], |
| 92 | + outputs=[asset_type.ref_by_guid(guid=value.guid)], # type: ignore |
88 | 93 | process_id=str(get_epoch_timestamp()),
|
89 | 94 | )
|
90 | 95 | process_created.ai_dataset_type = key
|
91 | 96 | else:
|
92 |
| - process_name = f"{input_asset.name} -> {output_asset.name}" |
| 97 | + process_name = f"{value.name} -> {a_i_model_name}" |
93 | 98 | process_created = Process.creator(
|
94 | 99 | name=process_name,
|
95 | 100 | connection_qualified_name="default/ai/dataset",
|
96 |
| - inputs=[value], |
| 101 | + inputs=[asset_type.ref_by_guid(guid=value.guid)], # type: ignore |
97 | 102 | outputs=[AIModel.ref_by_guid(guid=a_i_model_guid)],
|
98 | 103 | process_id=str(get_epoch_timestamp()),
|
99 | 104 | )
|
|
0 commit comments