Skip to content
Merged
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
9 changes: 9 additions & 0 deletions modules/python/clusterloader2/autoscale/autoscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def override_config_clusterloader2(
override_file,
warmup_deployment,
cl2_config_dir,
refresh_interval,
os_type="linux",
warmup_deployment_template="",
deployment_template="",
Expand Down Expand Up @@ -272,6 +273,7 @@ def override_config_clusterloader2(
file.write(f"CL2_SCALE_UP_TIMEOUT: {scale_up_timeout}\n")
file.write(f"CL2_SCALE_DOWN_TIMEOUT: {scale_down_timeout}\n")
file.write(f"CL2_LOOP_COUNT: {loop_count}\n")
file.write(f"CL2_REFRESH_INTERVAL: {refresh_interval}\n")

if enable_prometheus:
file.write("CL2_PROMETHEUS_TOLERATE_MASTER: true\n")
Expand Down Expand Up @@ -456,6 +458,12 @@ def main():
type=str2bool,
help="Enable Prometheus server in CL2",
)
parser_override.add_argument(
"--refresh_interval",
type=str,
default="5s",
help="Refresh interval for WaitForNodes and WaitForRunningPods measurements",
)
# Sub-command for execute_clusterloader2
parser_execute = subparsers.add_parser("execute", help="Execute scale up operation")
parser_execute.add_argument("cl2_image", type=str, help="Name of the CL2 image")
Expand Down Expand Up @@ -542,6 +550,7 @@ def main():
args.cl2_override_file,
args.warmup_deployment,
args.cl2_config_dir,
args.refresh_interval,
args.os_type,
args.warmup_deployment_template,
args.deployment_template,
Expand Down
5 changes: 3 additions & 2 deletions modules/python/tests/test_autoscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_override_config_clusterloader2(self, mock_open, mock_logger, mock_warmu
# Mock the CPU request calculation
mock_calculate_cpu_request.return_value = 1900

override_config_clusterloader2(2, 100, 1000, '5m', '5m', 1, 'autoscaler = true', '{autoscaler : true}', 'override_file', 'false', '/mock/path', 'linux', 'warmup_deployment.yaml', 'deployment_template.yaml')
override_config_clusterloader2(2, 100, 1000, '5m', '5m', 1, 'autoscaler = true', '{autoscaler : true}', 'override_file', 'false', '/mock/path', '5s', 'linux', 'warmup_deployment.yaml', 'deployment_template.yaml')
mock_open.assert_any_call('override_file', 'w', encoding='utf-8')
handle = mock_open()
handle.write.assert_any_call('CL2_DEPLOYMENT_CPU: 1900m\n')
Expand All @@ -124,7 +124,7 @@ def test_override_config_clusterloader2(self, mock_open, mock_logger, mock_warmu

# Test with warmup deployment true
mock_warmup.retun_value = None
override_config_clusterloader2(2, 100, 1000, '5m', '5m', 1, 'autoscaler = true', '{autoscaler : true}', 'override_file', 'true', '/mock/path', 'windows', 'warmup_deployment.yaml', 'deployment_template.yaml')
override_config_clusterloader2(2, 100, 1000, '5m', '5m', 1, 'autoscaler = true', '{autoscaler : true}', 'override_file', 'true', '/mock/path', '5s', 'windows', 'warmup_deployment.yaml', 'deployment_template.yaml')
mock_open.assert_any_call('override_file', 'w', encoding='utf-8')
handle = mock_open()
handle.write.assert_any_call('CL2_DEPLOYMENT_CPU: 1900m\n')
Expand Down Expand Up @@ -264,6 +264,7 @@ def test_override_command(self, mock_override):
'override.yaml',
'warmup-deploy',
'config-dir',
'5s',
'linux',
'',
'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ stages:
warmup_deployment_template: warmup_deployment.yaml
vm_size: Standard_D4_v5
capacity_type: on-demand
refresh_interval: "1s"
small-scale-spot:
cpu_per_node: 4
node_count: 10
Expand All @@ -88,6 +89,7 @@ stages:
warmup_deployment_template: warmup_deployment.yaml
vm_size: Standard_D4_v5
capacity_type: spot
refresh_interval: "1s"
max_parallel: 1
timeout_in_minutes: 560
credential_type: service_connection
Expand Down Expand Up @@ -120,6 +122,7 @@ stages:
warmup_deployment_template: warmup_deployment.yaml
vm_size: Standard_DS2_v2
capacity_type: on-demand
refresh_interval: "1s"
max_parallel: 1
timeout_in_minutes: 560
credential_type: service_connection
Expand Down Expand Up @@ -157,6 +160,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: Standard_D2ds_v4
capacity_type: on-demand
refresh_interval: "1s"
extra-small-scale-spot:
cpu_per_node: 2
node_count: 1
Expand All @@ -171,6 +175,7 @@ stages:
warmup_deployment_template: warmup_deployment.yaml
vm_size: Standard_D2ds_v4
capacity_type: spot
refresh_interval: "1s"
small-scale-on-demand:
cpu_per_node: 4
node_count: 10
Expand All @@ -185,6 +190,7 @@ stages:
warmup_deployment_template: warmup_deployment.yaml
vm_size: Standard_D4ds_v4
capacity_type: on-demand
refresh_interval: "1s"
small-scale-spot:
cpu_per_node: 4
node_count: 10
Expand All @@ -199,6 +205,7 @@ stages:
warmup_deployment_template: warmup_deployment.yaml
vm_size: Standard_D4ds_v4
capacity_type: spot
refresh_interval: "1s"
max_parallel: 1
timeout_in_minutes: 560
credential_type: service_connection
Expand Down Expand Up @@ -233,6 +240,7 @@ stages:
warmup_deployment_template: warmup_deployment.yaml
vm_size: Standard_D4_v3
capacity_type: on-demand
refresh_interval: "1s"
small-scale-spot:
cpu_per_node: 4
node_count: 10
Expand All @@ -246,6 +254,7 @@ stages:
warmup_deployment_template: warmup_deployment.yaml
vm_size: Standard_D4_v3
capacity_type: spot
refresh_interval: "1s"
max_parallel: 1
timeout_in_minutes: 560
credential_type: service_connection
Expand Down Expand Up @@ -283,6 +292,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: Standard_D2ds_v4
capacity_type: on-demand
refresh_interval: "1s"
medium-scale--spot:
cpu_per_node: 2
node_count: 500
Expand All @@ -297,6 +307,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: Standard_D2ds_v4
capacity_type: spot
refresh_interval: "1s"
max_parallel: 1
timeout_in_minutes: 360
credential_type: service_connection
Expand Down Expand Up @@ -334,6 +345,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: Standard_D2ds_v4
capacity_type: on-demand
refresh_interval: "1s"
large-scale-spot:
cpu_per_node: 2
node_count: 1000
Expand All @@ -348,6 +360,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: Standard_D2ds_v4
capacity_type: spot
refresh_interval: "1s"
max_parallel: 1
timeout_in_minutes: 360
credential_type: service_connection
Expand Down Expand Up @@ -382,6 +395,7 @@ stages:
warmup_deployment_template: warmup_deployment.yaml
vm_size: Standard_D2ds_v4
capacity_type: on-demand
refresh_interval: "1s"
large-scale-spot:
cpu_per_node: 2
node_count: 1000
Expand All @@ -395,6 +409,7 @@ stages:
warmup_deployment_template: warmup_deployment.yaml
vm_size: Standard_D2ds_v4
capacity_type: spot
refresh_interval: "1s"
max_parallel: 1
timeout_in_minutes: 360
credential_type: service_connection
Expand Down Expand Up @@ -432,6 +447,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: m5.xlarge
capacity_type: on-demand
refresh_interval: "1s"
extra-small-scale-spot:
cpu_per_node: 4
node_count: 1
Expand All @@ -446,6 +462,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: m5.xlarge
capacity_type: spot
refresh_interval: "1s"
small-scale-on-demand:
cpu_per_node: 4
node_count: 10
Expand All @@ -460,6 +477,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: m5.xlarge
capacity_type: on-demand
refresh_interval: "1s"
small-scale-spot:
cpu_per_node: 4
node_count: 10
Expand All @@ -474,6 +492,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: m5.xlarge
capacity_type: spot
refresh_interval: "1s"
max_parallel: 1
timeout_in_minutes: 560
credential_type: service_connection
Expand Down Expand Up @@ -511,6 +530,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: m5.large
capacity_type: on-demand
refresh_interval: "1s"
medium-scale-spot:
cpu_per_node: 2
node_count: 500
Expand All @@ -525,6 +545,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: m5.large
capacity_type: spot
refresh_interval: "1s"
max_parallel: 1
timeout_in_minutes: 360
credential_type: service_connection
Expand Down Expand Up @@ -562,6 +583,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: m5.large
capacity_type: on-demand
refresh_interval: "1s"
large-scale-spot:
cpu_per_node: 2
node_count: 1000
Expand All @@ -576,6 +598,7 @@ stages:
karpenter_cooldown: 900 #seconds
vm_size: m5.large
capacity_type: spot
refresh_interval: "1s"
max_parallel: 1
timeout_in_minutes: 360
credential_type: service_connection
Expand Down
2 changes: 1 addition & 1 deletion steps/engine/clusterloader2/autoscale/execute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ steps:
${CPU_PER_NODE:-0} ${NODE_COUNT:-0} ${POD_COUNT:-0} \
$SCALE_UP_TIMEOUT $SCALE_DOWN_TIMEOUT \
$LOOP_COUNT "${NODE_LABEL_SELECTOR:-""}" "$NODE_SELECTOR" ${CL2_CONFIG_DIR}/overrides.yaml ${WARMUP_DEPLOYMENT:-false} ${CL2_CONFIG_DIR} --os_type ${OS_TYPE:-linux} --warmup_deployment_template ${WARMUP_DEPLOYMENT_TEMPLATE:-""} --deployment_template ${DEPLOYMENT_TEMPLATE:-""} \
--pod_cpu_request ${POD_CPU_REQUEST:-0} --pod_memory_request ${POD_MEMORY_REQUEST:-""} --cl2_config_file ${CL2_CONFIG_FILE:-config.yaml} --enable_prometheus ${ENABLE_PROMETHEUS:-False}
--pod_cpu_request ${POD_CPU_REQUEST:-0} --pod_memory_request ${POD_MEMORY_REQUEST:-""} --cl2_config_file ${CL2_CONFIG_FILE:-config.yaml} --enable_prometheus ${ENABLE_PROMETHEUS:-False} --refresh_interval ${REFRESH_INTERVAL:-5s}

# Note: cluster loader2 newest image is conflicted with service monitors and prometheus
# to enable prometheus scraping, we need to clean up existing servicemonitors pod first
Expand Down
Loading