Skip to content

Commit

Permalink
Add comments and fix variable substitution
Browse files Browse the repository at this point in the history
Signed-off-by: Partho Sarthi <[email protected]>
  • Loading branch information
parthosa committed Nov 16, 2023
1 parent 48c9b23 commit 6064615
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions user_tools/tests/spark_rapids_tools_ut/test_tool_argprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def test_with_platform_with_eventlogs(self, get_ut_data_dir, tool_name, csp):
# should pass: platform not provided; event logs are provided
tool_args = self.create_tool_args_should_pass(tool_name,
eventlogs=f'{get_ut_data_dir}/eventlogs')
# for qualification, cost savings should be disabled because cluster is not provided
self.validate_tool_args(tool_name=tool_name, tool_args=tool_args,
cost_savings_enabled=False,
expected_platform=CspEnv.ONPREM)
Expand All @@ -142,6 +143,7 @@ def test_with_platform_with_cluster_name_with_eventlogs(self, get_ut_data_dir, t
platform=csp,
cluster='my_cluster',
eventlogs=f'{get_ut_data_dir}/eventlogs')
# for qualification, cost savings should be enabled because cluster is provided
self.validate_tool_args(tool_name=tool_name, tool_args=tool_args,
cost_savings_enabled=True,
expected_platform=csp)
Expand All @@ -151,6 +153,7 @@ def test_with_platform_with_cluster_name_with_eventlogs(self, get_ut_data_dir, t
tool_args = self.create_tool_args_should_pass(tool_name,
platform=csp,
cluster='my_cluster')
# for qualification, cost savings should be enabled because cluster is provided
self.validate_tool_args(tool_name=tool_name, tool_args=tool_args,
cost_savings_enabled=True,
expected_platform=csp)
Expand Down Expand Up @@ -191,28 +194,30 @@ def test_with_platform_with_cluster_props(self, get_ut_data_dir, tool_name, csp,
# because the eventlogs can be retrieved from the cluster properties
tool_args = self.create_tool_args_should_pass(tool_name,
platform=csp,
cluster=f'{cluster_prop_file}')
cluster=cluster_prop_file)
# for qualification, cost savings should be enabled because cluster is provided
self.validate_tool_args(tool_name=tool_name, tool_args=tool_args,
cost_savings_enabled=True,
expected_platform=csp)

# should pass: platform not provided; missing eventlogs should be accepted for all CSPs (except onPrem)
# because the eventlogs can be retrieved from the cluster properties
tool_args = self.create_tool_args_should_pass(tool_name,
cluster=f'{cluster_prop_file}')
cluster=cluster_prop_file)
# for qualification, cost savings should be enabled because cluster is provided
self.validate_tool_args(tool_name=tool_name, tool_args=tool_args,
cost_savings_enabled=True,
expected_platform=csp)
else:
# should fail: onprem platform cannot retrieve eventlogs from cluster properties
self.create_tool_args_should_fail(tool_name,
platform=csp,
cluster=f'{cluster_prop_file}')
cluster=cluster_prop_file)

# should fail: platform not provided; defaults platform to onprem, cannot retrieve eventlogs from
# cluster properties
self.create_tool_args_should_fail(tool_name,
cluster=f'{cluster_prop_file}')
cluster=cluster_prop_file)

@pytest.mark.parametrize('tool_name', ['qualification', 'profiling'])
@pytest.mark.parametrize('csp,prop_path', all_cpu_cluster_props)
Expand All @@ -223,16 +228,18 @@ def test_with_platform_with_cluster_props_with_eventlogs(self, get_ut_data_dir,
cluster_prop_file = f'{get_ut_data_dir}/{prop_path}'
tool_args = self.create_tool_args_should_pass(tool_name,
platform=csp,
cluster=f'{cluster_prop_file}',
cluster=cluster_prop_file,
eventlogs=f'{get_ut_data_dir}/eventlogs')
# for qualification, cost savings should be enabled because cluster is provided (except for onprem)
self.validate_tool_args(tool_name=tool_name, tool_args=tool_args,
cost_savings_enabled=CspEnv(csp) != CspEnv.ONPREM,
expected_platform=csp)

# should pass: platform not provided; cluster properties and eventlogs are provided
tool_args = self.create_tool_args_should_pass(tool_name,
cluster=f'{get_ut_data_dir}/{prop_path}',
cluster=cluster_prop_file,
eventlogs=f'{get_ut_data_dir}/eventlogs')
# for qualification, cost savings should be enabled because cluster is provided (except for onprem)
self.validate_tool_args(tool_name=tool_name, tool_args=tool_args,
cost_savings_enabled=CspEnv(csp) != CspEnv.ONPREM,
expected_platform=csp)
Expand All @@ -247,11 +254,11 @@ def test_with_platform_with_autotuner(self, get_ut_data_dir, tool_name, csp, pro
autotuner_prop_file = f'{get_ut_data_dir}/{prop_path}'
self.create_tool_args_should_fail(tool_name,
platform=csp,
cluster=f'{autotuner_prop_file}')
cluster=autotuner_prop_file)

# should fail: platform not provided; autotuner needs eventlogs
self.create_tool_args_should_fail(tool_name,
cluster=f'{autotuner_prop_file}')
cluster=autotuner_prop_file)

@pytest.mark.parametrize('tool_name', ['profiling'])
@pytest.mark.parametrize('csp', all_csps)
Expand All @@ -263,16 +270,18 @@ def test_with_platform_with_autotuner_with_eventlogs(self, get_ut_data_dir, tool
autotuner_prop_file = f'{get_ut_data_dir}/{prop_path}'
tool_args = self.create_tool_args_should_pass(tool_name,
platform=csp,
cluster=f'{autotuner_prop_file}',
cluster=autotuner_prop_file,
eventlogs=f'{get_ut_data_dir}/eventlogs')
# cost savings should be disabled for profiling
self.validate_tool_args(tool_name=tool_name, tool_args=tool_args,
cost_savings_enabled=False,
expected_platform=csp)

# should pass: platform not provided; autotuner properties and eventlogs are provided
tool_args = self.create_tool_args_should_pass(tool_name,
cluster=f'{autotuner_prop_file}',
cluster=autotuner_prop_file,
eventlogs=f'{get_ut_data_dir}/eventlogs')
# cost savings should be disabled for profiling
self.validate_tool_args(tool_name=tool_name, tool_args=tool_args,
cost_savings_enabled=False,
expected_platform=CspEnv.ONPREM)
Expand Down

0 comments on commit 6064615

Please sign in to comment.