When you develop code for an extension, DataWorks provides built-in and custom parameters to improve development efficiency. For example, you can use parameters to make an extension active only in specific workspaces.
Background information
When you develop code by using extension parameters, you must define the parameters in the registration information of the extension. Add the built-in or custom parameters that you may need during the code development process to the registration information. Extension developers can obtain the parameter configuration of the extension by calling the GetExtension API. In the Register Extension dialog box, you can select an event on the left, such as an event before code execution, an event before file deletion, an event before a table is committed to the development environment, an event before a table is committed to the production environment, or an event before file publishing. On the right, you must fill in the form with information such as Associated Event, Applicable Module, Owner, Test Workspace, Extension Details URL, Extension Documentation URL, Extension Parameter Configuration, and Description. In the Extension Parameter Configuration text area, enter parameters in the key=value format, with one parameter per line.
-
Add each parameter on a new line.
-
When you add a built-in parameter:
Built-in parameters follow the
key=valueformat. The following built-in parameters are supported:-
Built-in parameter 1: extension.project.disabled — workspace blocklist
-
Built-in parameter 2: extension.project.disabled.append — append to workspace blocklist
-
Built-in parameter 3: extension.project.{eventCode}.disabled — extension point blocklist
-
Built-in parameter 5: extension.fileType.{fileType}.{eventCode}.enabled
-
Built-in parameter 6:
extension.manualPass.enabled. This parameter controls the visibility of the Mark as Passed button for the extension.extension.manualPass.enabled=trueThis setting displays the Mark as Passed button in the action column for the extension.
-
-
When you add a custom parameter:
We recommend that you use the
key=valueformat.
Built-in parameter 1: extension.project.disabled — workspace blocklist
-
Use case:
Use this parameter to disable an extension in specified workspaces.
-
Parameter description:
extension.project.disabled=projectId1,projectId2,projectId3projectId is the ID of the workspace where the extension is disabled. You can obtain the ID by calling the ListProjects API or by viewing it on the workspace configuration page in the DataWorks console.
NoteYou can specify multiple workspace IDs for a single parameter. Separate the IDs with commas (,).
-
Code example:
extension.project.disabled=projectId1 -
Note:
Do not configure the same key more than once. If you do, only the last configuration takes effect.
Built-in parameter 2: extension.project.disabled.append — Workspace blocklist (append)
-
Use case:
Use this parameter to add workspaces to the blocklist without overwriting the list defined by
extension.project.disabled. The extension is disabled in the workspaces specified by both parameters. -
Parameter description:
extension.project.disabled.append=projectId1,projectId2,projectId3projectId is the ID of the workspace where the extension is disabled. You can obtain the ID by calling the ListProjects API or by viewing it on the workspace configuration page in the DataWorks console.
NoteYou can specify multiple workspace IDs for a single parameter. Separate the IDs with commas (,).
-
Code example:
extension.project.disabled.append=projectId1
Built-in parameter 3: extension.project.{eventCode}.disabled — extension point blocklist
-
Use case:
Use this parameter to disable an extension at a specific extension point for specified workspaces.
-
Parameter description:
extension.project.{eventCode}.disabled=projectId1,projectId2,projectId3Where:
-
eventCode: The event type of the extension point to disable. For a list of valid values, see Appendix: Event details (eventType).
-
projectId: The ID of the workspace where the extension is disabled. You can obtain the ID by calling the ListProjects API or by viewing it on the workspace configuration page in the DataWorks console.
NoteYou can specify multiple workspace IDs for a single parameter. Separate the IDs with commas (,).
-
-
Code example:
extension.project.commit-file.disabled=projectId1 extension.project.delete-file.disabled=projectId2,projectId3 -
Note:
Do not configure the same key more than once. If you do, only the last configuration takes effect.
Built-in parameter 4: extension.project.{eventCode}.disabled.append — Extension point blocklist (append)
-
Use case:
Use this parameter to add workspaces to the extension point blocklist without overwriting the list defined by
extension.project.{eventCode}.disabled. The extension is disabled at the specified extension point for the workspaces specified by both parameters. -
Parameter description:
extension.project.{eventCode}.disabled.append=projectId1,projectId2,projectId3Where:
-
eventCode: The event type of the extension point to disable. For a list of valid values, see Appendix: Event details (eventType).
-
projectId: The ID of the workspace where the extension is disabled. You can obtain the ID by calling the ListProjects API or by viewing it on the workspace configuration page in the DataWorks console.
NoteYou can specify multiple workspace IDs for a single parameter. Separate the IDs with commas (,).
-
-
Code example:
extension.project.commit-file.disabled.append=projectId1 extension.project.delete-file.disabled.append=projectId2,projectId3
Built-in parameter 5: extension.fileType.{fileType}.{eventCode}.enabled
-
Use case:
Use this parameter to enable or disable an extension for specific types of node tasks.
-
Parameter description:
extension.fileType.{fileType}.{eventCode}.enabledWhere:
-
fileType: The type code for a specific node task. You can call the ListFileType API to obtain the type code for a node task.
-
eventCode: The event type of the extension point to disable. For a list of valid values, see Appendix: Event details (eventType).
-
-
Code examples:
The following examples show how to configure an extension for ODPS SQL node tasks (type 10) and ODPS MR node tasks (type 11).
-
If all specified file types are set to
true, any unconfigured file types default tofalse.extension.fileType.10.run-file.enabled=true extension.fileType.11.run-file.enabled=true-
The extension is active for the ODPS SQL node task (10) and the ODPS MR node task (11). When these tasks run, they trigger the extension.
-
Other node tasks, such as a batch synchronization DI node task, do not trigger the extension.
-
-
If all specified file types are set to
false, any unconfigured file types default totrue.extension.fileType.10.run-file.enabled=false extension.fileType.11.run-file.enabled=false-
The extension is not active for the ODPS SQL node task (10) or the ODPS MR node task (11). When these tasks run, they do not trigger the extension.
-
All other node tasks, such as a batch synchronization DI node task, trigger the extension.
-
-
If you use a mixed configuration where at least one file type is set to
true, any unconfigured file types default tofalse.extension.fileType.10.run-file.enabled=false extension.fileType.11.run-file.enabled=true-
The extension is active for the ODPS MR node task (11). When this task runs, it triggers the extension.
-
The extension is not active for the ODPS SQL node task (10) or any other node task, such as a batch synchronization DI node task. These tasks do not trigger the extension.
-
-