Parameter | Description |
Select Service | Select a service to provide resources for function invocation. All functions of a service share the same settings, such as service authorization and log configurations. If no service is available, create a service. For more information, see Create a service. |
Select Version Or Alias | Select the version or alias of the service that you want to use for subsequent function invocation. The default version is LATEST. Service version Function Compute provides the service-level versioning feature, which allows you to release one or more versions for a service. A version is similar to a service snapshot that contains the information such as the service settings, and the code and settings of functions that belong to the service. A version does not contain trigger information. When you release a version, the system generates a snapshot for the service and assigns a version number that is associated with the snapshot for future use. For more information about how to release a version, see Manage versions. Version alias Function Compute allows you to create an alias for a service version. An alias points to a specific version of a service. You can use an alias to perform version release, rollback, or canary release with ease. An alias is dependent on a service or a version. When you use an alias to access a service or function, Function Compute parses the alias into the version to which the alias points. This way, the invoker does not need to know the specific version to which the alias points. For information about how to create an alias, see Manage aliases.
|
Select Function | Select a function that you want to invoke to run the Function Compute node. If no function is available, create a function. For more information, see Create a function. Note DataWorks allows you to invoke only event functions. If you want to periodically schedule an event processing function in DataWorks, you must create an event function rather than an HTTP function to process event requests in Function Compute. For information about more function types, see Function type selection. In this example, the para_service_01_by_time_triggers function is selected. When you create such a function, use the sample code for triggering a function at a scheduling time. Code logic:
import json
import logging
logger = logging.getLogger()
def handler(event, context):
logger.info('event: %s', event)
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
For more information about the sample code of other functions, see Sample code. |
Invocation Method | The method to invoke a function. Valid values: Synchronous Invocation: When you synchronously invoke a function, an event directly triggers the function, and Function Compute executes the function and waits for a response. After the function is invoked, Function Compute returns the execution results of the function. Asynchronous Invocation: When you asynchronously invoke a function, Function Compute immediately returns a response after the request is persisted instead of returning a response only after the request execution is complete. If your function has the logic that is time-consuming, resource-consuming, or error-prone, you can use this method to allow your programs to respond to traffic spikes in an efficient and reliable manner. We recommend that you use this method for Function Compute tasks of which the running duration exceeds one hour.
|
Variable | Assign values to the variables in the function based on your business requirements. The data in this field corresponds to the content on the Create New Test Event tab of the Configure Test Parameters panel for the function in the Function Compute console. To go to the Configure Test Parameters panel, go to the details page of the function in the Function Compute console and choose on the Code tab. In this example, assign the following parameters to the variables as values in the para_service_01_by_time_triggers function. The ${} format is used to define the bizdate variable. You need to assign a value to the variable in Step 4.
{
"payload": "payload1",
"triggerTime": "${bizdate}",
"triggerName": "triggerName1"
}
|