Step 2. Create Mapper and Reducer functions

Last updated: 2020-07-28 17:53:31

    Creating Mapper Function

    Creating in console through template function

    1. Log in to the SCF Console and select Function Service on the left sidebar.
    2. At the top of the "Function Service" page, select the Beijing region and click Create to enter the function creating page.
      Set the following parameter information and click Next as shown below:
      • Function Name: enter "Mapper".
      • Runtime Environment: select "Python 2.7".
      • Creation Method: select Template function.
      • Fuzzy Search: enter "map_function" to search and select the "map_function" template.
        Click View Details in the template to view relevant information in the pop-up "Template Details" window, which can be downloaded.
    3. Keep the default configuration and click Complete to complete the function creation.
    4. 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

    Note:

    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 Function Service 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.
      • Function Name: enter "Reducer".
      • Runtime Environment: select "Python 2.7".
      • Creation Method: select Template function.
      • Fuzzy Search: enter "reduce_function" to search and select the "reduce_function" template.
        Click View Details in the template to view relevant information in the pop-up "Template Details" window, which can be downloaded.
    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

    Note:

    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