patch_task
Use the methods described in this topic to get and modify settings of existing tasks.
Required user role
See Required Enterprise Manager permissions.
Payload overview
The payload should be in JSON format and determines:
-
Setting values that will be changed
-
Settings that will be disabled
As the API reflects the behavior and functionality of the Replicate UI, some settings require certain parent settings to be enabled before they can be modified. For example, it is not possible to enable the Optimize handling when LOB size is less than option when the Replicate LOB columns option is disabled. Therefore, if you are not sure whether the parent settings are enabled, to prevent errors, best practice is to include operations for enabling the parent settings in the request payload as well. Examples of how to do this are provided below.
Changing a setting value
Syntax
The syntax for changing a setting value is as follows:
[
{ "op": "add", "path": "full path to setting", "value": new-value }
]Example
The following example shows how to change the Maximum number of tables setting in the Full Load Tuning tab.
[
{ "op": "add", "path": "/full_load_sub_tasks", "value": 100 }
]Reverting to the default setting value
You revert a setting to its default value by using the "remove" command. If the setting is dependent on other settings being enabled, you also need to enable those settings before you can revert the specific setting to its default. If you are aware that the related settings are already enabled, then you can simply use the "remove" operation.
Example
In the following example, the user wants to revert the Chunk size (KB) (lob_chunk_size) setting to its default value. Changing this setting or restoring its default requires the Replicate LOB columns and Allow unlimited LOB size settings to be enabled. Because the user is not sure they are enabled, he includes operations for enabling them in the request payload.
[
{ "op": "add", "path": "/common_settings/support_lobs", "value": true },
{ "op": "add", "path": "/common_settings/lob_max_size", "value": 0 },
{ "op": "remove", "path": "/common_settings/lob_chunk_size" }
]
If the user knew beforehand that the Replicate LOB columns and Allow unlimited LOB size settings were enabled, he would only need to include the "remove" operation in the request payload.
[
{ "op": "remove", "path": "/common_settings/lob_chunk_size" }
]Enabling or disabling a setting (the equivalent of selecting or clearing a check box)
You enable a setting using the "add" operation. You can disable a setting using the "remove" operation or by setting the value to "false".
Enabling a setting
Syntax
The syntax for enabling a setting is as follows:
[
{ "op": "add", "path": "path_to_setting", "value": true }
]Example
To enable the Replicate LOB columns option:
[
{ "op": "add", "path": "/common_settings/support_lobs", "value": true }
]Disabling a setting using the "remove" operation
Syntax
The syntax for disabling a setting using the "remove" operation is as follows:
[
{ "op": "remove", "path": "path_to_setting" }
]Example
To disable the Replicate LOB columns option:
[
{ "op": "remove", "path": "/common_settings/support_lobs" }
]Disabling a setting by setting its value to "false"
Syntax
The syntax for disabling a setting by setting its value to "false" is as follows:
[
{ "op": "add", "path": "path_to_setting", "value": false }
]Example
To disable the Replicate LOB columns option:
[
{ "op": "add", "path": "/common_settings/support_lobs", "value": false }
]
Configuring task settings
Call patch_task_settings to modify all supported task settings, except the task description.
Syntax
def patch_task_settings(self, payload, server, task)
Parameters
| Parameter | Type | Description |
|---|---|---|
| payload | STRING (JSON) |
A JSON payload containing the settings to modify. |
| server | STRING |
The Replicate server name as defined in Enterprise Manager. Example: myrepsrv1 |
| task | STRING |
The name of an existing task. |
Payloads for supported settings
Example
settings = json.dumps([{"op": "add", "path": "/common_settings/support_lobs", "value": True}])
example_program.aem_client.patch_task_settings(settings, 'MyServerName', 'MyTaskName')Setting or removing the task description
Call put_task_properties to set or remove the task description.
Syntax
def put_task_properties(payload, self, server, task)
Parameters
| Parameter | Type | Description |
|---|---|---|
| payload | AemTaskProperties |
The payload as shown below. |
| server | string |
The Replicate server name as defined in Enterprise Manager. Example: myrepsrv1 |
| task | string |
The name of an existing task. |
Payload
| Action | Payload with examples |
|---|---|
| Add a valid description |
Add a description (Uppercase/Lowercase/Numbers/Space/Special Characters) |
| Remove description |
Remove the description |
Example
description = AemTaskProperties({"description": "important task"})
example_program.aem_client.put_task_properties(description, 'MyServerName', 'MyTaskName')Configuring error handling
Call put_task_error_behavior to modify the error handling settings.
Syntax
def put_task_error_behavior(self, payload, server, task)
Parameters
| Parameter | Type | Description |
|---|---|---|
| payload | AemTaskErrorBehavior |
The JSON payload consisting of the error handling settings to change. |
| server | string |
The Replicate server name as defined in Enterprise Manager. Example: myrepsrv1 |
| task | string |
The name of an existing task. |
Payload
| Action | Payload with examples |
|---|---|
| Environmental errors |
Change the "Maximum retry count" value:
Restore the default "Maximum retry count"
Disable the "Maximum retry count" option
Enable the "Increase retry interval for long outages" option
Disable the "Increase retry interval for long outages" option
Change the "Maximum retry interval (seconds)" value |
| Data errors: For data truncation errors |
Set "For data truncation errors: Ignore record"
Set "For data truncation errors: Suspend table"
Set "For data truncation errors: Stop Task"
Set "For data truncation errors: Log record to the exceptions table"
|
| Data errors: For NOT NULL constraint violations: |
Enable "Check" option for "For NOT NULL constraint violations" Enable "Don't check" option for "For NOT NULL constraint violations" Enable "Endpoint-determined (Check)" option for "For NOT NULL constraint violations" Set "For NOT NULL constraint violations: Ignore record" Set "For NOT NULL constraint violations: Suspend table" Set "For NOT NULL constraint violations: Stop Task" Set "For NOT NULL constraint violations: Log record to the exceptions table" |
| Data errors: For other data errors |
Set "For data truncation errors: Ignore record" Set "For data truncation errors: Suspend table" Set "For data truncation errors: Stop Task" Set "For data truncation errors: Log record to the exceptions table" Enable "Escalate handling when data errors reach (per table)" checkbox Disable "Escalate handling when data errors reach (per table)" checkbox Set "Escalation action: Stop Task" for data errors Set "Escalation action: Suspend table" for data errors
|
| Table Errors |
Set "When encountering a table error: Stop Task" Set "When encountering a table error: Suspend table" Enable "Escalate handling when data errors reach (per table)" checkbox Disable "Escalate handling when data errors reach (per table)"checkbox |
| Apply conflict: No record found for applying DELETE |
Set "No record found for applying DELETE: Ignore record" Set "No record found for applying DELETE: Suspend table" Set "No record found for applying DELETE: Stop Task" Set "No record found for applying DELETE: Log record to the exceptions table" |
| Apply conflict: Duplicate key when applying INSERT |
Set "Duplicate key when applying INSERT: Ignore record" of Apply Conflict Set "Duplicate key when applying INSERT: Suspend table" Set "Duplicate key when applying INSERT: Stop Task" Set "Duplicate key when applying INSERT: Log record to the exceptions table" Set "Duplicate key when applying INSERT: UPDATE the existing target record" |
| Apply conflict: No record found for applying an UPDATE |
Set "No record found for applying an UPDATE: Ignore record" Set "No record found for applying an UPDATE: Suspend table" Set "No record found for applying an UPDATE: Stop Task" Set "No record found for applying an UPDATE: Log record to the exceptions table" Set "No record found for applying an UPDATE: INSERT the missing target record" |
| Apply conflict: Escalate handling when data errors reach (per table) |
Enable "Escalate handling when data errors reach (per table)" checkbox Disable "Escalate handling when data errors reach (per table)" checkbox Set "Escalation action: Stop Task" Set "Escalation action: Suspend table" Set "Escalation action: Log record to the exceptions table" |
Example
example_program = ExamplePythonProgram()
task_error_handling = {
"error_behavior": {
"apply_error_behavior": {
"delete_policy": "ERROR_POLICY_LOG_ERROR",
"insert_policy": "ERROR_POLICY_LOG_ERROR",
"update_policy": "ERROR_POLICY_LOG_ERROR",
"escalation_count": 0,
"escalation_policy": "ERROR_POLICY_SUSPEND_TABLE",
"full_load_ignore_conflicts": True
},
"table_error_behavior": {
"policy": "ERROR_POLICY_SUSPEND_TABLE",
"escalation_count": 0,
"escalation_policy": "ERROR_POLICY_STOP_TASK"
},
"data_error_behavior": {
"policy": "ERROR_POLICY_LOG_ERROR",
"escalation_count": 0,
"escalation_policy": "ERROR_POLICY_SUSPEND_TABLE",
"truncation_policy": "ERROR_POLICY_LOG_ERROR",
"nullability_policy": "ERROR_POLICY_SUSPEND_TABLE",
"nullability_check_data_error": "ENDPOINT_DETERMINED"
},
"recoverable_error_behavior": {
"count": -1,
"interval": 5,
"throttling": True,
"throttling_max": 1800,
"abnormal_count": 5,
"recovery_grace_period": 10,
"max_table_repeated_fail_count": 3
}
}
}
settings_json_string = json.dumps(task_error_handling)
aem_task_error_behavior = AemTaskErrorBehavior(settings_json_string)
example_program.aem_client.put_task_error_behavior(aem_task_error_behavior, "MyServerName", "MyTaskName")Configuring logging
Call put_task_loggers to modify the logging settings.
Syntax
def put_task_loggers(self, payload, server, task)
Parameters
| Parameter | Type | Description |
|---|---|---|
| payload | AemTaskLoggers |
The JSON payload consisting of the logging settings to change. |
| server | string |
The Replicate server name as defined in Enterprise Manager. Example: myrepsrv1 |
| task | string |
The name of an existing task. |
Payload
| Action | Payload with examples |
|---|---|
| Changing the global logging level |
Change the global logging level to TRACE: Change the global logging level to VERBOSE: Change the global logging level to WARNING: Change the global logging level to ERROR: |
| Change the logging level of a specific component |
Change "UTILITIES" to Trace level: |
| Change the global logging level and the logging level of a specific component |
Change the global logging level to TRACE and the logging level of a specific component to ERROR: |
| Change multiple components to different logging levels |
Change "ADDONS" to VERBOSE and "STREAM" to ERROR |
| Store trace/verbose logging in memory, but if an error occurs write to the logs |
Enable "Store trace/verbose logging in memory, but if an error occurs write to the logs" Disable "Store trace/verbose logging in memory, but if an error occurs write to the logs" Change the "Allocate memory up to (MB)" value: |
Example
task_loggers = AemTaskLoggers(json.dumps({"loggers":[{"logger_type": "AT_GLOBAL","log_level": "INFO"}]}))
example_program.aem_client.put_task_loggers(task_loggers, "MyServerName", "MyTaskName")
Getting all settings, except Replicate loggers, the task description, and error handling
Call task_settings_patch_template to get current values for all settings, except Replicate loggers, the task description, and error handling settings.
Syntax
def task_settings_patch_template(self, payload, server, task)
Parameters
| Parameter | Type | Description |
|---|---|---|
| payload | string |
The JSON payload consisting of the settings. Payload example: Find out if LOB support is enabled, the maximum LOB size, and the target schema: |
| server | string |
The Replicate server name as defined in Enterprise Manager. Example: myrepsrv1 |
| task | string |
The name of an existing task. |
Example
setting = json.dumps([{"path": "/common_settings/support_lobs"}])
print(example_program.aem_client.task_settings_patch_template(setting, "MyServerName", "MyTaskName"))
Getting the task description
Call get_task_properties to get the current task description.
Syntax
def get_task_properties(self, server, task)
Parameters
| Parameter | Type | Description |
|---|---|---|
| server | string |
The Replicate server name as defined in Enterprise Manager. Example: myrepsrv1 |
| task | string |
The name of an existing task. |
Example
example_program = ExamplePythonProgram()
task_properties = example_program.aem_client.get_task_properties("MyServerName", "MyTaskName")
print(json.dumps(AttUtil.attobject_to_json(task_properties), indent=3))Getting the task error settings
Call get_task_eror_behavior to get the current task error settings.
Syntax
def get_task_eror_behavior(self, server, task)
Parameters
| Parameter | Type | Description |
|---|---|---|
| server | string |
The Replicate server name as defined in Enterprise Manager. Example: myrepsrv1 |
| task | string |
The name of an existing task. |
Example
example_program = ExamplePythonProgram()
error_behavior = example_program.aem_client.get_task_error_behavior("MyServerName", "MyTaskName")
print(json.dumps(AttUtil.attobject_to_json(error_behavior), indent=3))Getting the task logger settings
Call get_task_loggers to get the current task logger settings.
Syntax
def get_task_loggers(self, server, task)
Parameters
| Parameter | Type | Description |
|---|---|---|
| server | string |
The Replicate server name as defined in Enterprise Manager. Example: myrepsrv1 |
| task | string |
The name of an existing task. |
Example
example_program = ExamplePythonProgram()
loggers = example_program.aem_client.get_task_loggers("MyServerName", "MyTaskName")
print(json.dumps(AttUtil.attobject_to_json(loggers), indent=3))Errors
Apart from specific errors related to settings that are not valid, you might also encounter general errors. For more information on these, see general errors.