Step 2. Create Mapper and Reducer Functions

Last updated: 2020-05-09 18:24:21

    Creating Mapper Function

    Creating in console through template function

    1. Log in to the SCF Console and enter the Functions page.

    2. Select the Beijing region and click Create to enter the function creating page.

    3. Enter the following parameter information and click Next as shown below:

      • Creation Method: select "Template function".
      • Function Name: enter "Mapper".
      • Filter: select the "map_function" template for the "Python 2.7" language.
      • Move the cursor over the template function to view its details. The download operation is supported.
    4. Keep the default configuration and click Complete to complete the function creation.

    5. In the Function Code tab, you can browse the code information. If you want to modify the parameter values such as variables, you can modify and save them online.

    Configuring COS trigger

    Select "COS trigger" as the trigger type, select "srcmr" as the COS bucket, select "Create All" as the event type, and keep the default values for other parameters.

    Select the Triggers tab and click Add Trigger to add the COS trigger for the function.

    Creating Reducer Function

    Creating in console through template function

    1. Log in to the SCF Console and enter the Functions page.
    2. Select the Beijing region and click Create to enter the function creating page.
    3. Just like creating a mapper function, enter the following parameter information and click Next.
      • Creation Method: select "Template function".
      • Function Name: enter "Reducer".
      • Filter: select the "reduce_function" template for the "Python 2.7" language.
      • Move the cursor over the template function to view its details. The download operation is supported.
    4. Keep the default configuration and click Complete to complete the function creation.
    5. In the Function Code tab, you can browse the code information. If you want to modify the parameter values such as variables, you can modify and save them online.

    Configuring COS trigger

    Select "COS trigger" as the trigger type, select "middlestagebucket" as the COS bucket, select "Create All" as the event type, and keep the default values for other parameters.

    Select the Triggers tab and click Add Trigger to add the COS trigger for the function.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help