A quota group is a computing resource pool of MaxCompute. This topic describes how to use quota groups of MaxCompute.

Background information

MaxCompute allows you to use computing resources in a quota group in one of the following ways:
  • Specify a default quota group for a project. This way, all jobs that are committed in the project use this quota group for computation.
  • Specify a quota group at the job level. This way, you can specify different quota groups for jobs in a project for computation. Quota groups are classified into subscription quota groups and pay-as-you-go quota groups. The priority of a quota group that is specified at the job level is higher than the priority of the default quota group of a project.

Specify a default quota group for a project

If you specify a default quota group for a project, the jobs that are initiated in this project use the computing resources of the default quota group for computation by default. You do not need to configure additional settings. When you create a project, you can specify a default quota group for the project. You can also find the project and click Switch quota group in the Actions column on the Project management tab of the MaxCompute console to change the default quota group of the project. For more information, see Configure quota groups.

Specify a quota group at the job level

You can add a SET command before the SQL statement of a job to specify a quota group for the job. This feature checks whether the job owner has the permissions to use the quota group. The following section describes the procedure.

  1. Create a quota group.
    For more information about how to create a quota group, see Configure quota groups.
    Note We recommend that you use a combination of letters and digits when you specify a quota group name.
  2. Grant required permissions.
    By default, all Alibaba Cloud accounts, RAM users, and roles do not have permissions to specify a quota group for a job. An account can be used to specify a quota group for a job only after the account is granted the required permissions.
    1. Create a role.
      1. Log on to the MaxCompute console. In the top navigation bar, select a region. On the page that appears, click the Roles tab.
      2. On the Roles tab, click Create Role.
      3. In the Create Role dialog box, configure the Role Name parameter and enter the following policy document:
        {
            "Statement": [{
                    "Action": [
                        "odps:List",
                        "odps:Usage"],
                    "Effect": "Allow",
                    "Resource": ["acs:odps:*:regions/*/quotas/*"]}],
            "Version": "1"
        }
        The following table describes the parameters.
        Parameter Description
        Action The action that is allowed or denied. You can specify multiple actions for a single authorization operation based on your business requirements. If you specify multiple actions, separate the actions with commas (,). For more information about the supported actions, see Permissions.
        Note For more information about policy parameters, see Policy elements.
        Resource The authorized resource range.

        ["acs:odps:*:regions/*/quotas/*"] specifies all quota groups in all regions. You can specify a specific region and a specific quota group based on your business requirements.

      4. Click OK.
    2. Assign the role that you created to the account that you want to use to specify the quota group at the job level.
      Note By default, the Alibaba Cloud account or a RAM user that is assigned the tenant-level Super_Administrator role can perform the authorization operations.
      The authorization operations vary based on the type of the object to which permissions are granted:
      • Alibaba Cloud account
        To grant permissions to an Alibaba Cloud account, run the following commands:
        -- Add the Alibaba Cloud account to the current tenant and assign the specified role to the Alibaba Cloud account.
        Add tenant user <Aliyun$xxxx>;
        Grant tenant role <role_name> to user <Aliyun$xxxx>;
        -- View the permissions of the tenant-level role or user.
        Show grants for tenant role <role_name>;
        Show grants for tenant user <user_name>;
        Show principals for tenant [role] <role_name>;
      • RAM user
        1. In the MaxCompute console, click Users.
        2. Find the RAM user to which you want to grant permissions, and select the role that you created from the drop-down list in the Roles column to complete the authorization operation.
  3. Specify the quota group for a job.
    Add the following command before the SQL statement of the job to specify the previously created quota group for the job:
    set odps.task.wlm.quota=<quotaname>; 
    quotaname is the name of the quota group.