DataWorks provides built-in parameters for you to reference when you develop extension code. You can also customize parameters. These parameters can help you improve the efficiency and effectiveness of extension code development. For example, you can configure a parameter to specify that an extension takes effect only for a specified workspace. This topic describes how to configure extension parameters.
Background information
If you want to reference extension parameters for the code development of an extension, you must first define the built-in or custom extension parameters in the registration information of the extension. Developers can call the GetExtension operation to obtain the configurations of the extension parameters.
You can define multiple parameters. Each parameter occupies a separate line.
When you define built-in parameters, take note of the following information:
Define built-in parameters in the
key=value
format. The following built-in parameters are supported:When you define custom parameters, take note of the following information:
We recommend that you define custom parameters in the
key=value
format.
Built-in parameter 1: extension.project.disabled
Scenarios:
You can configure this parameter to specify that an extension does not take effect for specified workspaces.
Variables:
extension.project.disabled=projectId1,projectId2,projectId3
projectId: the ID of the workspace for which the extension does not take effect. You can obtain the ID by calling the ListProjects operation or on the Workspaces page in the DataWorks console.
NoteYou can specify multiple workspace IDs in the setting of this parameter. Separate the workspace IDs with commas (,).
Sample code:
extension.project.disabled=projectId1
Usage notes:
Do not repeatedly configure this parameter unless the key is changed. If this parameter is repeatedly configured when the key remains the same, the last setting prevails.
Built-in parameter 2: extension.project.disabled.append
Scenarios:
You can configure this parameter to append the workspaces for which an extension does not take effect. You can use this parameter only when the
extension.project.disabled
parameter has only one value.Variables:
extension.project.disabled.append=projectId1,projectId2,projectId3
projectId: the ID of the workspace for which the extension does not take effect. You can obtain the ID by calling the ListProjects operation or on the Workspaces page in the DataWorks console.
NoteYou can specify multiple workspace IDs in the setting of this parameter. Separate the workspace IDs with commas (,).
Sample code:
extension.project.disabled.append=projectId1
Built-in parameter 3: extension.project.{eventCode}.disabled
Scenarios:
You can configure this parameter to specify that an extension does not take effect for the events that are related to the specified extension point in the specified workspaces.
Variables:
extension.project.{eventCode}.disabled=projectId1,projectId2,projectId3
eventCode: the type of event for which the extension does not take effect. For more information about valid values, see Valid values of eventType.
projectId: the ID of the workspace in which the extension does not take effect for the events that are related to the specified extension point. You can obtain the ID by calling the ListProjects operation or on the Workspaces page in the DataWorks console.
NoteYou can specify multiple workspace IDs in the setting of this parameter. Separate the workspace IDs with commas (,).
Sample code:
extension.project.commit-file.disabled=projectId1 extension.project.delete-file.disabled=projectId2,projectId3
Usage notes:
Do not repeatedly configure this parameter unless the key is changed. If this parameter is repeatedly configured when the key remains the same, the last setting prevails.
Built-in parameter 4: extension.project.{eventCode}.disabled.append
Scenarios:
You can configure this parameter to append the workspaces in which an extension does not take effect for the events that are related to the specified extension point. You can use this parameter only when the
extension.project.{eventCode}.disabled.append
parameter has only one value.Variables:
extension.project.{eventCode}.disabled.append=projectId1,projectId2,projectId3
eventCode: the type of event for which the extension does not take effect. For more information about valid values, see Valid values of eventType.
projectId: the ID of the workspace in which the extension does not take effect for the events that are related to the specified extension point. You can obtain the ID by calling the ListProjects operation or on the Workspaces page in the DataWorks console.
NoteYou can specify multiple workspace IDs in the setting of this parameter. Separate the workspace IDs with commas (,).
Sample code:
extension.project.commit-file.disabled.append=projectId1 extension.project.delete-file.disabled.append=projectId2,projectId3
Built-in parameter 5: extension.fileType.{fileType}.{eventCode}.enabled
Scenarios:
You can configure this parameter to specify that an extension does not take effect for specified types of nodes or takes effect for specified types of nodes.
Variables:
extension.fileType.{fileType}.{eventCode}.enabled
fileType: the code of the specified type of node. You can obtain the code by calling the ListFileType operation.
eventCode: the type of event for which the extension does not take effect. For more information about valid values, see Valid values of eventType.
Sample code:
The following sample code shows how to configure the built-in parameter for ODPS SQL nodes whose code is 10 and for ODPS MR nodes whose code is 11:
If you set filetype in the built-in parameter to 10 or 11 and set the built-in parameter for the specified nodes to true, the value of the built-in parameter in which filetype is not configured is false by default.
extension.fileType.10.run-file.enabled=true extension.fileType.11.run-file.enabled=true
In this case, the extension takes effect for ODPS SQL nodes and ODPS MR nodes. During execution of the two types of nodes, an extension point event that occurs on the nodes can trigger the extension.
During execution of other types of nodes, such as batch synchronization nodes in Data Integration, an extension point event that occurs on the nodes cannot trigger the extension.
If you set filetype in the built-in parameter to 10 or 11 and set the built-in parameter for the specified nodes to false, the value of the built-in parameter in which filetype is not configured is true by default.
extension.fileType.10.run-file.enabled=false extension.fileType.11.run-file.enabled=false
In this case, the extension does not take effect for ODPS SQL nodes or ODPS MR nodes. During execution of the two types of nodes, an extension point event that occurs on the nodes cannot trigger the extension.
During execution of other types of nodes, such as batch synchronization nodes in Data Integration, an extension point event that occurs on the nodes can trigger the extension.
If you set filetype in the built-in parameter to 10 or 11 and set the built-in parameter for ODPS SQL nodes to a value different from that for ODPS MR nodes, the value of the built-in parameter in which filetype is not configured is false by default.
extension.fileType.10.run-file.enabled=false extension.fileType.11.run-file.enabled=true
In this case, the extension takes effect for ODPS MR nodes. During execution of this type of node, an extension point event that occurs on the nodes can trigger the extension.
In this case, the extension does not take effect for ODPS SQL nodes or other types of nodes, such as batch synchronization nodes in Data Integration. During execution of these types of nodes, an extension point event that occurs on the nodes cannot trigger the extension.