diff --git a/aliyun/log/scheduled_sql.py b/aliyun/log/scheduled_sql.py index 0e98191..5dcd0e9 100644 --- a/aliyun/log/scheduled_sql.py +++ b/aliyun/log/scheduled_sql.py @@ -63,6 +63,8 @@ def __init__(self): self.__fromTime = 0 self.__toTime = 0 self.__dataFormat = "log2log" + self.__forceComplete = False + self.__usingExactlyOnce = False self.__parameters = ScheduledSQLParameters() def configurationToDict(self): @@ -84,10 +86,24 @@ def configurationToDict(self): "toTime": self.__toTime, "dataFormat": self.__dataFormat, "parameters": self.__parameters if isinstance(self.__parameters, dict) else self.__parameters.toDict( - self.__dataFormat) + self.__dataFormat), + "forceComplete": self.__forceComplete, + "usingExactlyOnce": self.__usingExactlyOnce } return config + def getForceComplete(self): + return self.__forceComplete + + def setForceComplete(self, forceComplete): + self.__forceComplete = forceComplete + + def getUsingExactlyOnce(self): + return self.__usingExactlyOnce + + def setUsingExactlyOnce(self, usingExactlyOnce): + self.__usingExactlyOnce = usingExactlyOnce + def getSourceLogstore(self): return self.__sourceLogstore diff --git a/tests/e2e/schedule_sql/schedule_sql_demo_test.py b/tests/e2e/schedule_sql/schedule_sql_demo_test.py index 74579dc..413534e 100644 --- a/tests/e2e/schedule_sql/schedule_sql_demo_test.py +++ b/tests/e2e/schedule_sql/schedule_sql_demo_test.py @@ -9,7 +9,7 @@ accessKeyId = "" # The AccessKeyId accessKeySecret = "" # The AccessKeySecret -endpoint = "cn-shanghai.log.aliyuncs.com" # The source endpoint of the project's region +endpoint = "cn-heyuan.log.aliyuncs.com" # The source endpoint of the project's region roleArn = "" # The roleArn project = "etl-project" # The source project name source_logstore = "" # The source logstore name @@ -34,7 +34,7 @@ delay_seconds = 0 # the delay seconds for schedule sql # three possible values for the variable data_format : "log2log" , "log2metric" ,"metric2metric" -data_format = "log2log" +data_format = "log2metric" # Possible values for the variable schedule_type: "FixedRate", "Daily", "Weekly", "Hourly", "Cron" # schedule_type = "FixedRate" @@ -79,6 +79,8 @@ def generate_schedule_sql(): config.setToTime(0) config.setDataFormat(data_format) config.setParameters(parameters) + config.setForceComplete(True) + config.setUsingExactlyOnce(True) schedule_sql.setSchedule(schedule_rule) schedule_sql.setConfiguration(config) @@ -314,6 +316,7 @@ def update_schedule_sql(): configuration['fromTimeExpr'] = '@m-3m' configuration['maxRetries'] = 25 + configuration['usingExactlyOnce'] = True schedule['type'] = 'Cron' schedule['timeZone'] = '+0800' @@ -331,11 +334,10 @@ def update_schedule_sql(): schedule_sql.setName(job_name) schedule_sql.setDisplayName(display_name) schedule_sql.setDescription(description) - update_schedule_sql_response = client.update_scheduled_sql(project, schedule_sql) update_schedule_sql_response.log_print() if __name__ == "__main__": - create_schedule_sql() + update_schedule_sql() pass