Skip to content

Commit

Permalink
able to run benchmark tools on interactive
Browse files Browse the repository at this point in the history
Committed-by: xiaolei.zl from Dev container
  • Loading branch information
zhanglei1949 committed Sep 24, 2024
1 parent 779507f commit 37ad09c
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 32 deletions.
2 changes: 1 addition & 1 deletion flex/interactive/examples/imdb/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# IMDB Graph

The `IMDB` graph is based on the [IMDB Dataset](http://homepages.cwi.nl/~boncz/job/imdb.tgz), designed for relational query benchmarking. We have preprocessed the dataset to ensure compatibility with a graph model. You can download the preprocessed dataset from [here](TBD).
The `IMDB` graph is based on the [IMDB Dataset](http://homepages.cwi.nl/~boncz/job/imdb.tgz), designed for relational query benchmarking. We have preprocessed the dataset to ensure compatibility with a graph model. You can download the preprocessed dataset from [here](https://graphscope.oss-accelerate-overseas.aliyuncs.com/dataset/imdb.tar.gz).

In this directory, you will find two files: `graph.yaml`, which defines the schema, and `import.yaml`, which outlines data loading. Example queries are also provided—explore the IMDB Graph!

Expand Down
17 changes: 9 additions & 8 deletions flex/interactive/examples/imdb/import.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ loading_config:
format:
type: csv
metadata:
delimiter: '|' # other loading configuration places here
header_row: true # whether to use the first row as the header
quoting: false
delimiter: ',' # other loading configuration places here
header_row: false # whether to use the first row as the header
quoting: true
quote_char: '"'
double_quote: true
double_quote: false
escape_char: '\'
escaping: false
escaping: true
block_size: 4MB
batch_reader: false
null_values: [""]
vertex_mappings:
- type_name: AKA_NAME
inputs:
Expand Down Expand Up @@ -180,13 +181,13 @@ edge_mappings:
- type_triplet:
edge: MOVIE_LINK_TITLE
source_vertex: MOVIE_LINK
destination_vertex: TILE
destination_vertex: TITLE
inputs:
- MOVIE_LINK_TITLE.csv
- type_triplet:
edge: MOVIE_LINK_LINK_TYPE
edge: MOVIE_LINK_LINKED_TYPE
source_vertex: MOVIE_LINK
destination_vertex: LINK_TYPE
inputs:
- MOVIE_LINK_LINK_TYPE.csv
- MOVIE_LINK_LINKED_TYPE.csv

12 changes: 6 additions & 6 deletions flex/storages/rt_mutable_graph/schema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,9 @@ static Status parse_vertex_schema(YAML::Node node, Schema& schema) {
// check the type_id equals to storage's label_id
int32_t type_id;
if (!get_scalar(node, "type_id", type_id)) {
LOG(ERROR) << "type_id is not set properly for type: " << label_name;
return Status(StatusCode::INVALID_SCHEMA,
"type_id is not set properly for type: " + label_name);
LOG(WARNING) << "type_id is not set properly for type: " << label_name
<< ", try to use incremental id";
type_id = schema.vertex_label_num() - 1;
}
auto label_id = schema.get_vertex_label_id(label_name);
if (label_id != type_id) {
Expand Down Expand Up @@ -1022,9 +1022,9 @@ static Status parse_edge_schema(YAML::Node node, Schema& schema) {
// check the type_id equals to storage's label_id
int32_t type_id;
if (!get_scalar(node, "type_id", type_id)) {
LOG(ERROR) << "type_id is not set properly for type: " << edge_label_name;
return Status(StatusCode::INVALID_SCHEMA,
"type_id is not set properly for type: " + edge_label_name);
LOG(WARNING) << "type_id is not set properly for type: " << edge_label_name
<< ", try to use incremental id";
type_id = schema.edge_label_num() - 1;
}
auto label_id = schema.get_edge_label_id(edge_label_name);
if (label_id != type_id) {
Expand Down
6 changes: 4 additions & 2 deletions interactive_engine/benchmark/bin/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

CURR_DIR=$(pwd)
SCRIPT_DIR=$(dirname $(readlink -f $0))
CURR_DIR=${SCRIPT_DIR}/../
CONF_DIR=$CURR_DIR/config/interactive-benchmark.properties
java -cp $CURR_DIR:lib/* com.alibaba.graphscope.gaia.benchmark.InteractiveBenchmark $CONF_DIR
JAR_PATH=$CURR_DIR/target/gaia-benchmark-0.0.1-SNAPSHOT.jar
java -cp ${JAR_PATH}:$CURR_DIR/target/libs/* com.alibaba.graphscope.gaia.benchmark.InteractiveBenchmark $CONF_DIR
cd $CURR_DIR
8 changes: 5 additions & 3 deletions interactive_engine/benchmark/bin/collect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

CURR_DIR=$(pwd)
SCRIPT_DIR=$(dirname $(readlink -f $0))
CURR_DIR=${SCRIPT_DIR}/../
CONF_DIR=$CURR_DIR/config/interactive-benchmark.properties
java -cp $CURR_DIR:lib/* com.alibaba.graphscope.gaia.benchmark.CollectResult $CONF_DIR
cd $CURR_DIR
JAR_PATH=$CURR_DIR/target/gaia-benchmark-0.0.1-SNAPSHOT.jar
echo "JAR_PATH: $JAR_PATH"
java -cp ${JAR_PATH}:$CURR_DIR/target/libs/* com.alibaba.graphscope.gaia.benchmark.CollectResult $CONF_DIR
18 changes: 18 additions & 0 deletions interactive_engine/benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/libs
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,47 @@ public static final void builderGraphElementFromYaml(
Map<String, GraphEdge> edgeMap,
Map<String, Integer> propNameToIdMap,
GSDataTypeConvertor<DataType> typeConvertor) {
int curVertexTypeId = 0;
int curEdgeTypeId = 0;
for (Object element : elementList) {
if (element instanceof Map) {
Map<String, Object> elementMap = (Map<String, Object>) element;
String label = (String) elementMap.get("type_name");
int labelId =
(int)
Objects.requireNonNull(
elementMap.get("type_id"),
"type_id not exist in yaml config");
int labelId = 0;
if (elementMap.get("type_id") != null) {
labelId = (int) elementMap.get("type_id");
// Expect the id is continuous
if (type.equals("VERTEX")) {
if (labelId != curVertexTypeId) {
throw new IllegalArgumentException(
"vertex type id is not continuous, expect "
+ curVertexTypeId
+ " but get "
+ labelId);
}
curVertexTypeId++;
} else {
if (labelId != curEdgeTypeId) {
throw new IllegalArgumentException(
"edge type id is not continuous, expect "
+ curEdgeTypeId
+ " but get "
+ labelId);
}
curEdgeTypeId++;
}
}
else {
if (type.equals("VERTEX")) {
labelId = curVertexTypeId++;
} else {
labelId = curEdgeTypeId++;
}
}
List<GraphProperty> propertyList = Lists.newArrayList();
List propertyNodes = (List) elementMap.get("properties");
if (propertyNodes != null) {
int propertyId = 0;
for (Object property : propertyNodes) {
if (property instanceof Map) {
Map<String, Object> propertyMap = (Map<String, Object>) property;
Expand All @@ -105,15 +134,22 @@ public static final void builderGraphElementFromYaml(
Objects.requireNonNull(
propertyMap.get("property_name"),
"property_name not exist in yaml config");
int propertyId =
(int)
Objects.requireNonNull(
propertyMap.get("property_id"),
"property_id not exist in yaml config");
propNameToIdMap.put(propertyName, propertyId);
int curPropertyId = 0;
if (propertyMap.get("property_id") != null) {
int tmpId = (int) propertyMap.get("property_id");
if (tmpId != propertyId) {
throw new IllegalArgumentException(
"property id is not continuous, expect "
+ propertyId
+ " but get "
+ tmpId);
}
}
curPropertyId = propertyId++;
propNameToIdMap.put(propertyName, curPropertyId);
propertyList.add(
new DefaultGraphProperty(
propertyId,
curPropertyId,
propertyName,
toDataType(
propertyMap.get("property_type"),
Expand Down

0 comments on commit 37ad09c

Please sign in to comment.