mirror of
https://github.com/ansible/awx.git
synced 2026-07-02 20:08:02 -02:30
Give new primary key constraint unique name, create first live partition
This commit is contained in:
@@ -1009,7 +1009,6 @@ def truncate_stdout(stdout, size):
|
||||
|
||||
return stdout + u'\u001b[0m' * (set_count - reset_count)
|
||||
|
||||
|
||||
def deepmerge(a, b):
|
||||
"""
|
||||
Merge dict structures and return the result.
|
||||
@@ -1027,12 +1026,16 @@ def deepmerge(a, b):
|
||||
return b
|
||||
|
||||
|
||||
def create_partition(partition_label, start, end=None):
|
||||
"""Creates new partition tables for events."""
|
||||
def create_partition(start, end=None, partition_label=None):
|
||||
"""Creates new partition tables for events.
|
||||
If not specified, end is set to the end of the current hour."""
|
||||
if not end:
|
||||
end = (now() + timedelta(hours=1))
|
||||
start_timestamp = start.strftime('%Y-%m-%d %H:00:00.000000%z')
|
||||
end_timestamp = end.strftime('%Y-%m-%d %H:00:00.000000%z')
|
||||
end = start.replace(microsecond=0, second=0, minute=0) + timedelta(hours=1)
|
||||
start_timestamp = str(start)
|
||||
end_timestamp = str(end)
|
||||
|
||||
if not partition_label:
|
||||
partition_label = start.strftime('%Y_%m_%d_%H')
|
||||
|
||||
with connection.cursor() as cursor:
|
||||
# Only partitioning main_jobevent on first pass
|
||||
|
||||
Reference in New Issue
Block a user