All Products
Search
Document Center

DataWorks:Function Compute node

Last Updated:Mar 26, 2026

A Function Compute node lets you run custom serverless functions as part of a DataWorks data pipeline. Use it when your pipeline needs custom business logic, data transformation, or third-party API calls that go beyond what built-in node types support. Function Compute nodes support periodic scheduling, so you can trigger functions on a timed basis and combine them with other node types to build end-to-end data processing flows.

Prerequisites

Before you begin, make sure that you have:

  • Function Compute activated. See Activate Function Compute and What is Function Compute?

  • A service created. A service is the basic resource unit in Function Compute. You configure permissions, logs, and functions at the service level. See Create a service

  • An event function created within that service. DataWorks supports only event functions, not HTTP functions. Write code against the Function Compute function interface and deploy it as an event function. See Create a function and Function types

Limitations

LimitationDetails
Function typeDataWorks supports invoking only event functions. It does not support HTTP functions. Create an event function that handles event requests if you want to schedule it in DataWorks.
Region availabilityChina (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), China (Chengdu), China (Hong Kong), Singapore, Malaysia (Kuala Lumpur), Indonesia (Jakarta), Germany (Frankfurt), UK (London), US (Silicon Valley), US (Virginia)

Usage notes

Service list not appearing

When you select a service on the node configuration page, the service list may be empty for the following reasons:

  • Your account has an overdue payment. Add funds to your account, then refresh the page and try again.

  • Your account lacks the fc:ListServices permission or the AliyunFCFullAccess policy. Contact your Alibaba Cloud account owner to grant the permission. See Grant permissions to a RAM user.

Long-running functions

If a function runs for more than 1 hour in a DataWorks Function Compute node, you must set the invocation method to asynchronous invocation. For more information about asynchronous invocations in Function Compute, see Asynchronous invocation.

RAM user permissions

If a RAM user develops a Function Compute node, grant the user the following permissions:

Policy typePermissions
System policyAliyunFCFullAccess, AliyunFCReadOnlyAccess, AliyunFCInvocationAccess
Custom policyfc:GetAsyncTask, fc:StopAsyncTask, fc:GetService, fc:ListServices, fc:GetFunction, fc:InvokeFunction, fc:ListFunctions, fc:GetFunctionAsyncInvokeConfig, fc:ListServiceVersions, fc:ListAliases, fc:GetAlias, fc:ListFunctionAsyncInvokeConfigs, fc:GetStatefulAsyncInvocation, fc:StopStatefulAsyncInvocation

For the full list of permission policies, see Permission policies and examples (Function Compute 2.0) and Permission policies and examples (Function Compute 3.0).

Step 1: Go to the node creation page

  1. Log on to the DataWorks console. In the top navigation bar, select the desired region. In the left-side navigation pane, choose Data Development and O\&M \> Data Development. On the page that appears, select the desired workspace from the drop-down list and click Go to Data Development.

  2. Go to the node creation page. On the DataStudio page, you can create a Function Compute node using one of the following methods.函数计算节点创建入口

Step 2: Create and configure a Function Compute node

  1. Create a Function Compute node. After you go to the node creation page, follow the on-screen instructions to configure basic information for the new node, such as its path and name. Then, create the node.

  2. Configure the node parameters. On the node editing page, select the function to invoke and configure the invocation method and variables based on your requirements.配置节点参数

    ParameterDescription
    Select FunctionThe event function to invoke for this node. If no function is available, create one. See Create a function.
    Select Version or AliasThe service version or alias to use when invoking the function. Defaults to LATEST. See Publish a version and Create an alias.
    Invocation MethodHow DataWorks invokes the function. See the table below for guidance on which method to use.
    VariablesThe JSON payload passed to the function, corresponding to Test Function \> Configure Test Event in the Function Compute console. Define DataWorks scheduling variables in ${} format for dynamic values.

    Choosing an invocation method

    Invocation methodHow it worksWhen to use
    Synchronous callDataWorks triggers the function and waits for a result before continuing.Functions that complete within 1 hour.
    Asynchronous invocationDataWorks submits the event and receives an immediate acknowledgment. The function runs independently.Functions that run longer than 1 hour, consume large resources, or have error-prone logic.

    Example: synchronous invocation with a time-triggered function

    This example uses the para_service_01_by_time_triggers function, created from the platform's Time-triggered Function sample code:

    import json
    import logging
    
    logger = logging.getLogger()
    
    def handler(event, context):
        logger.info('event: %s', event)
    
        # Parse the JSON
        evt = json.loads(event)
        triggerName = evt["triggerName"]
        triggerTime = evt["triggerTime"]
        payload = evt["payload"]
    
        logger.info('triggerName: %s', triggerName)
        logger.info("triggerTime: %s", triggerTime)
        logger.info("payload: %s", payload)
    
        return 'Timer Payload: ' + payload

    The Variables field passes a JSON payload to the function. The ${bizdate} variable must be assigned a value in Step 4:

    {
      "payload": "payload1",
      "triggerTime": "${bizdate}",
      "triggerName": "triggerName1"
    }

    For more function code samples, see Sample code.

  3. (Optional) Test the node. After configuring the node, click the 运行 icon. Specify the resource group and assign constant values to the variables to test the node logic. The parameter format is key=value. Separate multiple parameters with commas (,).

    For details on testing a task, see Test a task.
  4. Configure the periodic scheduling properties. DataWorks scheduling parameters let you pass dynamic values to function variables at runtime. After defining variables in the Variables field using ${} syntax, go to the Scheduling Configuration tab to assign their values. In this example, bizdate is set to the previous day, so the function processes data from the previous day on each scheduled run. See Configure scheduling parameters.配置节点周期性调度 For details on all scheduling properties, see Overview of task scheduling properties.

Step 3: Commit and publish the node

A Function Compute node must be committed and published to the production environment before it can be automatically scheduled.

  1. Save and commit the node. Click the 保存 and 提交 icons to save and commit the node. When prompted, enter a change description.

    • (Optional) Enable code review so that a reviewer must approve the node code before it can be published. See Code review.

    • (Optional) Run a smoke test on the task before publishing to verify it runs as expected. See Smoke testing.

    Before committing, set the Rerun Property and Upstream Dependencies in the scheduling configuration.
  2. (Optional) Publish the node. If your workspace is in standard mode, click Publish in the upper-right corner to publish the node after committing. See Workspaces in standard mode and Publish a task.

What's next