From d4efddc00cfd7a1b9a45247c5b3bd9a26d42d472 Mon Sep 17 00:00:00 2001 From: "Kevin H. Luu" Date: Mon, 30 Sep 2024 13:03:00 -0700 Subject: [PATCH] [1/n][pipeline-gen] Add default test commands (#37) * p Signed-off-by: kevin * P Signed-off-by: kevin --------- Signed-off-by: kevin --- scripts/pipeline_generator/utils.py | 15 +++++++++++++-- scripts/tests/pipeline_generator/test_utils.py | 8 +++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/pipeline_generator/utils.py b/scripts/pipeline_generator/utils.py index 51dd6eb..51f143d 100644 --- a/scripts/pipeline_generator/utils.py +++ b/scripts/pipeline_generator/utils.py @@ -15,6 +15,12 @@ PIPELINE_FILE_PATH = ".buildkite/pipeline.yaml" MULTI_NODE_TEST_SCRIPT = ".buildkite/run-multi-node-test.sh" +TEST_DEFAULT_COMMANDS = [ + "(command nvidia-smi || true)", # Sanity check for Nvidia GPU setup + "export VLLM_LOGGING_LEVEL=DEBUG", + "export VLLM_ALLOW_DEPRECATED_BEAM_SEARCH=1", +] + STEPS_TO_BLOCK = [] @@ -33,14 +39,19 @@ def get_agent_queue(no_gpu: Optional[bool], gpu_type: Optional[str], num_gpus: O return AgentQueue.AWS_SMALL_CPU if gpu_type == A100_GPU: return AgentQueue.A100 - return AgentQueue.AWS_1xL4 if num_gpus == 1 else AgentQueue.AWS_4xL4 + return AgentQueue.AWS_1xL4 if not num_gpus or num_gpus == 1 else AgentQueue.AWS_4xL4 def get_full_test_command(test_commands: List[str], step_working_dir: str) -> str: """Convert test commands into one-line command with the right directory.""" working_dir = step_working_dir or DEFAULT_WORKING_DIR test_commands_str = ";\n".join(test_commands) - return f"cd {working_dir};\n{test_commands_str}" + full_test_commands = [ + *TEST_DEFAULT_COMMANDS, + f"cd {working_dir}", + test_commands_str + ] + return ";\n".join(full_test_commands) def get_multi_node_test_command( diff --git a/scripts/tests/pipeline_generator/test_utils.py b/scripts/tests/pipeline_generator/test_utils.py index 5281a93..802468b 100644 --- a/scripts/tests/pipeline_generator/test_utils.py +++ b/scripts/tests/pipeline_generator/test_utils.py @@ -8,8 +8,10 @@ get_multi_node_test_command, AgentQueue, MULTI_NODE_TEST_SCRIPT, + TEST_DEFAULT_COMMANDS, ) +TEST_DEFAULT_COMMANDS_STR = ";\n".join(TEST_DEFAULT_COMMANDS) @pytest.mark.parametrize( ("no_gpu", "gpu_type", "num_gpus", "expected_result"), @@ -27,9 +29,9 @@ def test_get_agent_queue(no_gpu: bool, gpu_type: str, num_gpus: int, expected_re @pytest.mark.parametrize( ("test_commands", "step_working_dir", "expected_result"), [ - (["echo 'hello'"], None, "cd /vllm-workspace/tests;\necho 'hello'"), - (["echo 'hello'"], "/vllm-workspace/tests", "cd /vllm-workspace/tests;\necho 'hello'"), - (["echo 'hello1'", "echo 'hello2'"], None, "cd /vllm-workspace/tests;\necho 'hello1';\necho 'hello2'"), + (["echo 'hello'"], None, f"{TEST_DEFAULT_COMMANDS_STR};\ncd /vllm-workspace/tests;\necho 'hello'"), + (["echo 'hello'"], "/vllm-workspace/tests", f"{TEST_DEFAULT_COMMANDS_STR};\ncd /vllm-workspace/tests;\necho 'hello'"), + (["echo 'hello1'", "echo 'hello2'"], "/sample_tests", f"{TEST_DEFAULT_COMMANDS_STR};\ncd /sample_tests;\necho 'hello1';\necho 'hello2'"), ], ) def test_get_full_test_command(test_commands: List[str], step_working_dir: str, expected_result: str):