This topic describes how to use MaxCompute Studio to develop Graph programs. This includes how to write, debug, package, upload, and run Graph programs.
Write a Graph program
- In the Project tool window, expand your MaxCompute Java module and choose . Then, right-click java and choose .
- Specify Name, select GraphLoader or Vertex, and then press Enter.
- Name: the name of the MaxCompute Java class that you want to create. If no package is created, enter packagename.classname. The system automatically creates a package.
- Select GraphLoader or Vertex as the class type.
- After the class is created, develop a Graph Java program in the editor.
Debug the Graph program
Locally run the Graph program and check whether the results meet your expectation.
- Right-click the compiled Java script and select Run.
- In the Run/Debug Configurations dialog box, configure the runtime parameters.
- MaxCompute project: the MaxCompute project in which you want to run the Graph program.
- Download Record limit: the maximum number of records that can be downloaded. Default value: 100.
- Click OK to run the UDF.Note
- The system reads the specified table data in warehouse as the input during the local run. You can view the log output in the console.
- The system downloads the table data from the specified MaxCompute project to the warehouse directory. If the data is already downloaded, the system does not perform this step.
Package and upload the Graph program
After you debug the Graph program, compress the Graph program into a JAR package and upload the package to the MaxCompute server as a resource. For more information, see Package, upload, and register.
Run the Graph program
Run the Graph program on the MaxCompute client.
- In the left-side navigation pane, click Project Explorer.
- Right-click the name of your project and select Open in Console.
- In the Console tool window, run the following command to start your Graph program. For more commands, see JAR command.
jar -libjars xxx.jar -classpath /Users/home/xxx.jar com.aliyun.odps.graph.examples.PageRank pagerank_in pagerank_out;