All Products
Search
Document Center

:Create a wrapper

Last Updated:Aug 29, 2023

Before you can use a wrapper, you must create and configure the wrapper, deploy the wrapper to and test it in the development environment, and then deploy the wrapper to the production environment.

Background information

A wrapper defines the core processing logic of nodes. You can use only Java to develop processing logic in a wrapper. For example, after you write an SQL statement in the code editor for an ODPS SQL node and commit the statement, DataWorks uses the wrapper for ODPS SQL nodes to parse and execute the statement. Before you create a custom node, you must create a wrapper to develop the processing logic of the node.

Procedure

  1. Create a wrapper.

    1. Log on to the DataWorks console.

    2. In the left-side navigation pane, click Workspaces.

    3. In the top navigation bar, select the region in which your workspace resides. Find your workspace and choose Shortcuts > Data Development in the Actions column.

    4. In the top navigation bar of the DataStudio page, click Node Config. The Wrappers page appears.

    5. In the upper-right corner of the Wrappers page, click Create.

    6. In the Select Wrapper Type dialog box, select a wrapper type and click OK. In this example, Engine Type is selected.

      You can select one of the following wrapper types:

      • Engine Type: If you select this wrapper type, you must upload a code package, such as a JAR package, to define the functionality of the wrapper. In most cases, a wrapper of this type is applicable to a node that uses a custom compute engine.

      • Business Type: If you select this wrapper type, you must use a manually triggered workflow to define the functionality of the wrapper. In most cases, a wrapper of this type is used to encapsulate multiple nodes to implement specific business logic.

  2. In the Basic Settings step, configure the parameters. The following table describes the parameters.

    基本设置

    Parameter

    Description

    Name

    The name of the wrapper. The name can contain only letters, underscores (_), and digits, and must start with a letter.

    Owner

    The owner of the wrapper. You can select yourself or another member of the current workspace. If you select another member as the owner, take note of the following points:

    • If you are the administrator of the current workspace, you cannot edit the wrapper after it is created.

    • If you are the owner of the current workspace, you can edit the wrapper after it is created.

    Resource File

    The resource file that defines the functionality of the wrapper. You can use one of the following methods to specify a resource file: Upload local files, Using oss files, and AppStudio.

    Note
    • This parameter is available only when you select Engine Type in the Select Wrapper Type dialog box.

    • The size of a local file can be up to 50 MB, and the size of a file that is stored in an Object Storage Service (OSS) bucket can be up to 200 MB.

    Class Name

    The full path of the class for implementing the wrapper.

    Note

    This parameter is available only when you select Engine Type in the Select Wrapper Type dialog box.

    Parameter Example

    The parameters that are designed based on the specified resource file.

    Note

    This parameter is available only when you select Engine Type in the Select Wrapper Type dialog box.

    Manual business process

    The manually triggered workflow that defines the functionality of the wrapper. Click Select manual business process. In the Select manual business process dialog box, select a manually triggered workflow from the drop-down list and click OK.

    Note

    This parameter is available only when you select Business Type in the Select Wrapper Type dialog box.

    Version

    If you create a wrapper, select Create Version 1. If you edit or roll back a version, select Overwrite Version 1.

    Description

    The description of the wrapper.

  3. Click Save and then Next.

    After you click Save, the configurations in this step are saved by the system. If you are modifying a wrapper, take note of the following points:

    • If you modify the basic settings of the wrapper, the modification takes effect after you click Save. You do not need to deploy the wrapper again.

    • If you modify the resource file, such as the JAR package, of the wrapper, the modification takes effect only after you deploy the wrapper again.

  4. In the Deploy in Development Environment step, confirm the configurations and click Deploy in Development Environment. The real-time deployment progress appears.

  5. Wait until the deployment is complete and click Next.

  6. Test the wrapper in the development environment.

    1. In the Test in Development Environment step, configure the Arguments, Environment Variables, and Code parameters.

    2. Click Test.

    3. Confirm the test result and select the Test Passed check box.

    4. Click Next.

  7. In the Deploy in Production Environment step, click Deploy in Production Environment. The real-time deployment progress appears.

    Note

    The wrapper to be deployed to the production environment must be of the latest version, has been deployed to the development environment, and has passed the test. Otherwise, a message appears, which indicates that the deployment to the production environment fails.

  8. Click Complete. The Wrappers page appears.

    The created wrapper appears on this page. You can configure the wrapper, view the version information about the wrapper, or delete the wrapper.

    • Settings: You can click Settings in the Actions column to configure the wrapper. After you click Settings, you are directed to a step in the configuration wizard of the wrapper based on existing configurations of the wrapper.

    • View Versions: You can click View Versions in the Actions column to view the version information about the wrapper. After you click View Versions, the View Versions dialog box appears. You can perform the following operations on each version:

      • View: View the basic information about the current version.

      • Roll Back: Roll back the wrapper from the current version to a selected version. After you click Roll Back, the system creates a new version for the wrapper. In the new version, the wrapper uses the basic settings and resource file of the selected version. The new version number equals the latest version number among all the versions plus 1.

      • Download: Download the resource file of the current version.

    • Delete: You can click Delete in the Actions column to delete the wrapper. After you click Delete, the Delete Wrapper message appears. Click OK.

      Important

      You cannot delete a wrapper that is associated with a node.