This topic describes how to use MaxCompute Studio to develop Graph programs. This includes how to write, debug, package, upload, and run Graph programs.

Prerequisites

Before you begin, perform the following operations:

Write Graph programs

  1. In the Project tool window, expand your MaxCompute Java module and choose src > main > java. Then, right-click java and choose New > MaxCompute Java.
  2. Specify Name and Kind, and click OK.
    • Name: the name of the MaxCompute Java class. If no package is created, enter packagename.classname. The system automatically creates a package.
    • Kind: the category of the MaxCompute Java class. Graph supports GraphLoader and Vertex.
  3. After you create a Graph class, develop a Graph Java program in the editor. For more information about how to develop a Graph program, see (Optional) Submit Graph jobs.

Debug Graph programs

Perform local run to test the Graph program and check whether the results meet your expectation.

  1. Right-click the compiled Java script and select Run.
  2. In the Run/Debug Configurations dialog box, configure the running parameters.
    graph
    • MaxCompute project: the MaxCompute project where the Graph program runs.
    • Download Record limit: the maximum number of records that can be downloaded. The default value is 100.
  3. Click OK to run the Graph program.
    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.
    • A temporary directory is created in the existing project directory each time local debugging is performed.
    • For more information about warehouse, see warehouse directory.

Package and upload Graph programs

After you debug a 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 Graph programs

Use the MaxCompute client to run Graph programs.

  1. In the left-side navigation pane, click Project Explorer.
  2. Right-click your project name and select Open in Console.
  3. In the Console tool window, run the following command to start your Graph program. For more commands, see Job submission.
    jar -libjars xxx.jar -classpath /Users/home/xxx.jar com.aliyun.odps.graph.examples.PageRank pagerank_in pagerank_out;