"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "b6d7e31d10df675d86c6fe7838044712c6dca4e9"
Unverified Commit cbb6f502 authored by Hongzhi (Steve), Chen's avatar Hongzhi (Steve), Chen Committed by GitHub
Browse files

[Graphbolt] Add proper error message for BuildinDataset. (#6690)


Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-28-63.ap-northeast-1.compute.internal>
parent 8a852530
...@@ -352,6 +352,7 @@ class OnDiskDataset(Dataset): ...@@ -352,6 +352,7 @@ class OnDiskDataset(Dataset):
yaml_path = preprocess_ondisk_dataset(path, include_original_edge_id) yaml_path = preprocess_ondisk_dataset(path, include_original_edge_id)
with open(yaml_path) as f: with open(yaml_path) as f:
self._yaml_data = yaml.load(f, Loader=yaml.loader.SafeLoader) self._yaml_data = yaml.load(f, Loader=yaml.loader.SafeLoader)
self._loaded = False
def _convert_yaml_path_to_absolute_path(self): def _convert_yaml_path_to_absolute_path(self):
"""Convert the path in YAML file to absolute path.""" """Convert the path in YAML file to absolute path."""
...@@ -384,6 +385,7 @@ class OnDiskDataset(Dataset): ...@@ -384,6 +385,7 @@ class OnDiskDataset(Dataset):
self._feature = TorchBasedFeatureStore(self._meta.feature_data) self._feature = TorchBasedFeatureStore(self._meta.feature_data)
self._tasks = self._init_tasks(self._meta.tasks) self._tasks = self._init_tasks(self._meta.tasks)
self._all_nodes_set = self._init_all_nodes_set(self._graph) self._all_nodes_set = self._init_all_nodes_set(self._graph)
self._loaded = True
return self return self
@property @property
...@@ -394,26 +396,31 @@ class OnDiskDataset(Dataset): ...@@ -394,26 +396,31 @@ class OnDiskDataset(Dataset):
@property @property
def tasks(self) -> List[Task]: def tasks(self) -> List[Task]:
"""Return the tasks.""" """Return the tasks."""
self._check_loaded()
return self._tasks return self._tasks
@property @property
def graph(self) -> SamplingGraph: def graph(self) -> SamplingGraph:
"""Return the graph.""" """Return the graph."""
self._check_loaded()
return self._graph return self._graph
@property @property
def feature(self) -> TorchBasedFeatureStore: def feature(self) -> TorchBasedFeatureStore:
"""Return the feature.""" """Return the feature."""
self._check_loaded()
return self._feature return self._feature
@property @property
def dataset_name(self) -> str: def dataset_name(self) -> str:
"""Return the dataset name.""" """Return the dataset name."""
self._check_loaded()
return self._dataset_name return self._dataset_name
@property @property
def all_nodes_set(self) -> Union[ItemSet, ItemSetDict]: def all_nodes_set(self) -> Union[ItemSet, ItemSetDict]:
"""Return the itemset containing all nodes.""" """Return the itemset containing all nodes."""
self._check_loaded()
return self._all_nodes_set return self._all_nodes_set
def _init_tasks(self, tasks: List[OnDiskTaskData]) -> List[OnDiskTask]: def _init_tasks(self, tasks: List[OnDiskTaskData]) -> List[OnDiskTask]:
...@@ -432,6 +439,12 @@ class OnDiskDataset(Dataset): ...@@ -432,6 +439,12 @@ class OnDiskDataset(Dataset):
) )
return ret return ret
def _check_loaded(self):
assert self._loaded, (
"Please ensure that you have called the OnDiskDataset.load() method"
+ " to properly load the data."
)
def _load_graph( def _load_graph(
self, graph_topology: OnDiskGraphTopology self, graph_topology: OnDiskGraphTopology
) -> FusedCSCSamplingGraph: ) -> FusedCSCSamplingGraph:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment