-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Java tutorial #2320
Add Java tutorial #2320
Conversation
dd1c5d4
to
af1b5d9
Compare
docs/java_tutorials.md
Outdated
Follow the tutorials below, give it a shot on trying exploring GraphScope Java. | ||
|
||
- [Querying graph via GraphScope JavaSDK](https://graphscope.io/docs/latest/java-tutorial-0-pie.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please use relative URLs, otherwise I cannot find these files in the preview or other deployments. (e.g., intranet in the future. )
- Please use the filename as unified underline
_
rather than-
.
You may want to check the preview on https://alibaba-graphscope-build-pr-2320.surge.sh/ |
docs/java-tutorial-1-giraph.md
Outdated
|
||
## Try some example giraph apps | ||
|
||
We provide some example giraph algorithms, i.e. SSSP, PageRank in [grape-demo.jar](https://graphscope.oss-cn-beijing.aliyuncs.com/jar/grape-demo-0.18.0-shaded.jar). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we provide this in the central repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, grape-demo.jar
is not provided in maven central repo, since users shall not use it in their project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
docs/java-tutorial-0-pie.md
Outdated
</dependency> | ||
``` | ||
|
||
To address the dependency issue in jar packaging, you shall package all your |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to give details about your reminder about packaging, may be step by step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
docs/java-tutorial-0-pie.md
Outdated
|
||
After computation, you can obtain the results stored in context with the help of [`Context`](https://graphscope.io/docs/reference/context.html#context). | ||
|
||
## GraphScope JavaSDK with Github Template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in addition to this file, is it possible to provide a .pynb for this doc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
docs/java-tutorial-1-giraph.md
Outdated
|
||
You can implement your algorithm towards Giraph' original API. Although almost all APIs are supported, there are indeed some limitation of Giraph-on-Graphscope. | ||
|
||
- Currently graph modification API is not supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you provide an example,
the java file comes from the examples from Giraph Repo.
build it and run on GS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean starting from examples in giraph repo, show users how to build and run them on GS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly!
docs/java-tutorial-1-giraph.md
Outdated
"""Or lauch session in k8s cluster""" | ||
sess = graphscope.session(cluster_type='hosts') | ||
|
||
graphscope_session.add_lib("path/to/grape-demo.jar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wonder if this is a path on local? or on the cluster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path on local. Coordinator will distribute the jar to cluster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, maybe speak it out
docs/java-tutorial-2-graphx.md
Outdated
|
||
## Run example GraphX apps | ||
|
||
Several GraphX algorithms are also contained in [grape-demo.jar](https://graphscope.oss-cn-beijing.aliyuncs.com/jar/grape-demo-0.18.0-shaded.jar). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wonder is this the Java way? maybe a central managed jar, import to their pom, would be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my point of view, the jar we provided contains some example algorithms, not like a SDK or some dependent jar.
If user include grape-demo.jar as dependency, then he still need to create a new project and then compile, to get a packed jar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am convinced.
docs/java-tutorial-2-graphx.md
Outdated
|
||
First, you also need to prepare the dataset. | ||
```bash | ||
git clone -b master --single-branch --depth=1 https://github.com/7br/gstest.git ${GS_TEST_DIR} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the we already has a "demo" jar, i suggest we include the small test data in the demo
to simplify the whole process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. But user still need to be aware of downloading data. What about let user just download one specific file we need? like
wget https://raw.githubusercontent.com/GraphScope/gstest/master/p2p-31.e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better.
docs/java-tutorial-2-graphx.md
Outdated
|
||
### Prepare Environment | ||
|
||
The GraphX-GraphScope integration depends on serveral environment variables. We provide a shell script, user shall `source` this script before submit a graphx job. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please organize this code, do not depend on copy-paste for users.
e.g., using graphscope/cli
generate a .graphscope_4spark.env
and then ask user to export a single file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created stubs for you:
https://github.com/GraphScope/cli/blob/main/src/spark_classpath_command.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No prob.
docs/java-tutorial-2-graphx.md
Outdated
### Submit to Spark | ||
|
||
```bash | ||
export EXTRA_CP=${GRAPHSCOPE_HOME}/lib/:${GRAPE_RUNTIME_JAR}:${GRAPHX_SDK_JAR} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is extra_cp
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will export this env var from cli script.
docs/java-tutorial-2-graphx.md
Outdated
--class com.alibaba.graphscope.example.graphx.BFSTest ${GRAPE_DEMO_JAR} ${GS_TEST_DIR}/p2p-31.e 2 1 | ||
``` | ||
|
||
Remember to replace the placeholders like `${master_url}` ,`${num_executors}` with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too complicated for users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it simple
docs/java-tutorial-2-graphx.md
Outdated
|
||
### Prepare Environment | ||
|
||
The GraphX-GraphScope integration depends on serveral environment variables. We provide a shell script, user shall `source` this script before submit a graphx job. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please double check and unify all the occurrence of
graphx, Graphx, to GraphX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked.
docs/java-tutorial-2-graphx.md
Outdated
```bash | ||
export EXTRA_CP=${GRAPHSCOPE_HOME}/lib/:${GRAPE_RUNTIME_JAR}:${GRAPHX_SDK_JAR} | ||
|
||
./bin/spark-submit --verbose \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible we generate this command for copy/paste
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I will export this as env variable in cli.
af1b5d9
to
ea05036
Compare
I also noticed that a file named |
Through this PR, the jvm opts specified by |
273c9ee
to
1a28ae0
Compare
2ad3255
to
8b34a40
Compare
dafc148
to
1acb803
Compare
update doc s project to simple f update doc graphx naming update tutorials mod graphx doc
1acb803
to
96cd830
Compare
😭 Deploy PR Preview ee5185e failed. Build logs 🤖 By surge-preview |
What do these changes do?
Related issue number
Add java tutorials for GRAPE-jdk.
Fix #2292