Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion aliyun/log/scheduled_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

Expand Down
10 changes: 6 additions & 4 deletions tests/e2e/schedule_sql/schedule_sql_demo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -314,6 +316,7 @@ def update_schedule_sql():

configuration['fromTimeExpr'] = '@m-3m'
configuration['maxRetries'] = 25
configuration['usingExactlyOnce'] = True

schedule['type'] = 'Cron'
schedule['timeZone'] = '+0800'
Expand All @@ -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
Loading