Skip to content

Commit

Permalink
Merge pull request #576 from GraphScope/fix-graphy-readme
Browse files Browse the repository at this point in the history
add dataset name from filename and remove interactive import from README
  • Loading branch information
pomelo-nwu authored Nov 14, 2024
2 parents 726aa5f + 2b0fe47 commit 5774161
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
16 changes: 0 additions & 16 deletions python/graphy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,22 +234,6 @@ curl -X POST http://0.0.0.0:9999/api/dataset/graphy -H "Content-Type: applicatio
}' --output graph.zip
```

Additional option is to import the graphied data into [GraphScope Interactive](https://graphscope.io/docs/latest/flex/interactive/getting_started). Start Interactive service and then export the required ports as [instructed](https://graphscope.io/docs/latest/flex/interactive/getting_started). Then the following `POST/GET/DELETE` APIs can be called.

```bash
curl -X POST http://0.0.0.0:9999/api/dataset/graphy/interactive -H "Content-Type: application/json" -d '{
"dataset_id": "8547eb64-a106-5d09-8950-8a47fb9292dc"
}'
```

```bash
curl -X GET 'http://0.0.0.0:9999/api/dataset/graphy/interactive?dataset_id=b4280bb9-3603-5b1d-bed8-6b2080092e31'
```

```bash
curl -X DELETE http://0.0.0.0:9999/api/dataset/graphy/interactive/b4280bb9-3603-5b1d-bed8-6b2080092e31
```

# Tests and Benchmark

The project can be tested by running the following command:
Expand Down
12 changes: 9 additions & 3 deletions python/graphy/apps/demo_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,11 @@ def get_persist_store(self, dataset_id):
persist_store.use("")
return persist_store

def init_metadata(self, dataset_id):
def init_metadata(self, dataset_id, dataset_name):
metadata = {}
persist_store = self.get_persist_store(dataset_id)
metadata["id"] = dataset_id
metadata["name"] = dataset_name
metadata["config"] = {}
metadata["entity"] = []
metadata["status"] = STATUS.INITIALIZED.value
Expand Down Expand Up @@ -537,6 +538,7 @@ def create_dataset():

# Create a unique identifier for the dataset
dataset_id = hash_id(file.filename)
dataset_name = file.filename.split(".")[0]

# Create directory to store the dataset files
upload_path = os.path.join(self.app.config["UPLOAD_FOLDER"], dataset_id)
Expand All @@ -562,10 +564,14 @@ def create_dataset():
400,
)

self.init_metadata(dataset_id)
self.init_metadata(dataset_id, dataset_name)
self.cache.setdefault(dataset_id, {})
# Return the unique identifier
return jsonify(create_json_response({"dataset_id": dataset_id}))
return jsonify(
create_json_response(
{"dataset_id": dataset_id, "dataset_name": dataset_name}
)
)

def allowed_file(filename):
# Helper function to check allowed file types
Expand Down
Binary file modified python/graphy/inputs/figs/graphy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5774161

Please sign in to comment.