From 717b163163b60e931900f93ab15ac115095c43da Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 19 Sep 2024 21:30:08 +0000 Subject: [PATCH 01/10] p Signed-off-by: kevin --- scripts/__init__.py | 0 scripts/__pycache__/__init__.cpython-311.pyc | Bin 0 -> 167 bytes scripts/pipeline_generator/__init__.py | 0 .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 186 bytes .../__pycache__/utils.cpython-311.pyc | Bin 0 -> 3138 bytes scripts/pipeline_generator/utils.py | 53 ++++++++++++++++ scripts/tests/__init__.py | 0 .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 173 bytes scripts/tests/pipeline_generator/__init__.py | 0 .../__pycache__/__init__.cpython-311.pyc | Bin 0 -> 192 bytes .../test_utils.cpython-311-pytest-8.1.1.pyc | Bin 0 -> 7918 bytes .../tests/pipeline_generator/test_utils.py | 57 ++++++++++++++++++ 12 files changed, 110 insertions(+) create mode 100644 scripts/__init__.py create mode 100644 scripts/__pycache__/__init__.cpython-311.pyc create mode 100644 scripts/pipeline_generator/__init__.py create mode 100644 scripts/pipeline_generator/__pycache__/__init__.cpython-311.pyc create mode 100644 scripts/pipeline_generator/__pycache__/utils.cpython-311.pyc create mode 100644 scripts/pipeline_generator/utils.py create mode 100644 scripts/tests/__init__.py create mode 100644 scripts/tests/__pycache__/__init__.cpython-311.pyc create mode 100644 scripts/tests/pipeline_generator/__init__.py create mode 100644 scripts/tests/pipeline_generator/__pycache__/__init__.cpython-311.pyc create mode 100644 scripts/tests/pipeline_generator/__pycache__/test_utils.cpython-311-pytest-8.1.1.pyc create mode 100644 scripts/tests/pipeline_generator/test_utils.py diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/__pycache__/__init__.cpython-311.pyc b/scripts/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5c7f8f2a99b65ad67d4aba6645245fba7f99d52 GIT binary patch literal 167 zcmZ3^%ge<81R_)4q=D$iAOZ#$p^VRLK*n^26oz01O-8?!3`I;p{%4TnFDw0w{M=Oi z(xlS7l2ZM$oSa@J%z~0){rLFIyv&mLc)fzk lUmP~M`6;D2sdh!IK%+pG74rj$56p~=j2{?aL=iJk3;;|xC`AAO literal 0 HcmV?d00001 diff --git a/scripts/pipeline_generator/__init__.py b/scripts/pipeline_generator/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/pipeline_generator/__pycache__/__init__.cpython-311.pyc b/scripts/pipeline_generator/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2750a53e48795264d1de74b946d95ba1eaccef7a GIT binary patch literal 186 zcmZ3^%ge<81Oijvq=D$iAOZ#$p^VRLK*n^26oz01O-8?!3`I;p{%4TnFJJwP{M=Oi z(xlS7l2ZM$oSa@J%z~0){esMb)SS$`)cEw& zywsw^lKdk5`1s7c%#!$cy@JYL95%W6DWy57c15f}(?RwZ^8<+w%#4hT9~fXn5i?K> E096bx{{R30 literal 0 HcmV?d00001 diff --git a/scripts/pipeline_generator/__pycache__/utils.cpython-311.pyc b/scripts/pipeline_generator/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e0b951e103c95162898ca38bcdb1bed0ea696e30 GIT binary patch literal 3138 zcmaJCO>EoN`B9=J>fe_98>gO!J!}+l9m}$qVh;J zu^_iR z=+=O@@k1J+NAS6WO^ON0FQvvj1`_*$?(d=pfFA6klTvbv5mWbQc1RqQ=pNl6sb5S= z{aXQX805n*$wxpwDh-MQ@Qt17M#VFrJ0emWXlnd>a*pzp&t_KZx~$fC#imQLrZ-1( zSXK30R^WwgDYxCIRODJ^ix;HkQ0@aosb=n|ct@)PBd1H6t~E#Mjhl)rWF-M-`8!(f z_GSGoZI*w#nRN99IYSgPSgNbdC{~54$G2&IW_r5$TJ~l`R>U1ycbCl6<+`NEH7UEx zSC!^Omsq;1OBl}Ttf;y2(Jpzf<+&~iZqzc>hN8=vnkq_;eO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UIHHJmX~%1XRpM6J{h%>G&THDXp|%wVj@fWd%f>`fzN zO8{aSFQr|#t7T_75!ete`q pDLme7BS62_oXNbwy7QLo%x#1|qTca&_@eJ!4+oo5ZV%=} AgentQueue: + if no_gpu: + 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 + +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 = "; ".join(test_commands) + return f"cd {working_dir}; {test_commands_str}" + +def get_multi_node_test_command(test_commands: List[str], working_dir: str, num_nodes: int, num_gpus: int, docker_image_path: str) -> str: + quoted_commands = [f"'{command}'" for command in test_commands] + multi_node_command = [ + MULTI_NODE_TEST_SCRIPT, + working_dir or DEFAULT_WORKING_DIR, + str(num_nodes), + str(num_gpus), + docker_image_path, + *quoted_commands + ] + return " ".join(map(str, multi_node_command)) diff --git a/scripts/tests/__init__.py b/scripts/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/tests/__pycache__/__init__.cpython-311.pyc b/scripts/tests/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3893cd9d09595b59d6028908248103d931bd907b GIT binary patch literal 173 zcmZ3^%ge<81UII^i`MIh3 zrAeiEC8hdhIXSty1x5K;smUe!Nu`-NDcPANsk+IT`o+mbnFS@q`X#BwKr%i)GcU6w qK3=b&@)w6qZhlH>PO4oIE6_lYmBsu(;sY}yBjX1K7*WIw6axVMrz>y( literal 0 HcmV?d00001 diff --git a/scripts/tests/pipeline_generator/__init__.py b/scripts/tests/pipeline_generator/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/tests/pipeline_generator/__pycache__/__init__.cpython-311.pyc b/scripts/tests/pipeline_generator/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ae663ecc8366f1723f3e198bc9665bdb85ed5d7 GIT binary patch literal 192 zcmZ3^%ge<81gECFNdwW3K?DpiLK&agfQ;!3DGb33nv8xc8H$*I{LdiCU%~nr`MIh3 zrAeiEC8hdhIXSty1x5K;smUe!Nu`-NDcPANsk+IT`o+mbnFS@q`X#BwK(ZjSAT=j5 zFEu_rH7~U&u_V7pKR!M)FS8^*Uaz3?7l%!5eoARhs$CH)&<>C*iur-W2WCb_#t#fI JqKFwN1^_(eGavu} literal 0 HcmV?d00001 diff --git a/scripts/tests/pipeline_generator/__pycache__/test_utils.cpython-311-pytest-8.1.1.pyc b/scripts/tests/pipeline_generator/__pycache__/test_utils.cpython-311-pytest-8.1.1.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8abe5bd34a16fc6a85db361a26c7dc818ec882b0 GIT binary patch literal 7918 zcmeGhTWs6bl@uw8k}bbqveQ~Y*E&jSJAUNhq*<3G8R9HSyV>plWdp0|QnGBlc1fj) zCJjarU>UHFU>Fb&OM(2%YvFzLcYpibC!IN%Kx{yPVIKkZp&;8Z%O=Ji`z{SE&xL`L>m5FwHKTzpg=BctnkTG>U?c0JUw+$yd+%tGa z{E~IXjyy+#n=#%LuV*wp<~O_3s;(r`YF<}If#fo03UI>y&D`?;VOK^w*~lZq_B>vSP?4%+v}>o;(y3%zeLXFv9|XH@fClHCqAT4 z`L;mkwyl>4dZ5X{acef-{eIoyw1`W#zsaLF2XJ*iHR|S&nuM)6@;niUcu0E&4z{P_ zwZctjTj8Yx-S8#1shjugKr7uII?(MWQk%LxUl47j+d~JsCD%^w?U3lc8xm;KLcuMs zrG*|kurNU6$5I(At4btDLKP{)TeE;}duNVw-33Glc2ojxt?t>!5F_sLRk7+P+!7b- zxcM3X%6H*Hj4yxl&11!Tr(#;@M~y-BLKH_QW7;vi&cw90EyQedFc;Hep=$I3qdODR zD1J-_ef2TP6hIP!83eNk<`A4haHiaq&@`3mmi&d7hRB6j(2{3{zEQkqIkp5fdzEAY z{2Wz_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! zZJ_9Nt?b0?aMVg>5PO~2I@PTHrP)gg$#s<~nH+Rq6||ovPO>L)qC+Te5&=GQia7|y z5LE7Vv^i#=p<;^A5SfXEDSBj6Tq|VqrjSb%O#vP(GwZPFRR>G27EsqY1o(>4^C)-B z?$kP-d812g-2r_A$s8?>v-C~GSgn;t_hMEN3}VeB;}-p5BecT6fRJ)!N8;Lmd2@{CZ99ugSeNxu+&a zYV!Dl8=FUWJC7LhIQt!ds&~t8NQO9G@8gC?AFcj;^%L#abH=etJL8vk$1m>;UD+MF zvhm(u#H!)`?TFP~2j*#W4ESg6B`2fJ#c1p)&@c=@8@V6DM783DRS&Nd^FPSTHp;mP z?Q9*B!?w|eu;DNUu^wIagRm*>ftA6UvZCY?nY^NueUo=$QB!WVBdwCij3~?#PqD8b znu=3Y{fI(;&kWiqGtj_M{NhcCv6vG4*9Cev6q8~z+UNyN**@6r0!~>CK-Pf8bdxy` zESDO-C6}PmIl?^=?KtMcfcvN@cRJ^ciREl;tyC$?xO} zq?A>^PUFCjNx1fJfOUcA`5O9&7JuOl>#xQQ8}46Slz3mAYZvrzKKcIGpZJld{76k) z_#zm7pg&yRJhwYGXUOxlVAn%wQ`}s8TrlJ*oQV$;o1?ptw+(sHGpz^xe(8l@_WAz7 z0jT%!{5Af`K%K+u=l$&Zdx2ez4?biACw$TGX0A&v&2%h+K*_c~5(#w&7jT|{tt8PY9t67 zIN^(4H)CDu=YP!CIR`w>iJcG1PlbpfL~3H-Cs#kd`ry`s4}NxQ^J`CJBNE#QAKwih W-w{vjiYJWbuP$)nC@@%W#(w};B^@~c literal 0 HcmV?d00001 diff --git a/scripts/tests/pipeline_generator/test_utils.py b/scripts/tests/pipeline_generator/test_utils.py new file mode 100644 index 0000000..5d08973 --- /dev/null +++ b/scripts/tests/pipeline_generator/test_utils.py @@ -0,0 +1,57 @@ +import pytest +from typing import List + +from scripts.pipeline_generator.utils import ( + get_agent_queue, + get_full_test_command, + get_multi_node_test_command, + AgentQueue, + MULTI_NODE_TEST_SCRIPT, +) + +@pytest.mark.parametrize( + ("no_gpu", "gpu_type", "num_gpus", "expected_result"), + [ + (True, None, None, AgentQueue.AWS_SMALL_CPU), + (False, "a100", None, AgentQueue.A100), + (False, None, 1, AgentQueue.AWS_1xL4), + (False, None, 4, AgentQueue.AWS_4xL4), + ], +) +def test_get_agent_queue(no_gpu: bool, gpu_type: str, num_gpus: int, expected_result: AgentQueue): + assert get_agent_queue(no_gpu, gpu_type, num_gpus) == expected_result + +@pytest.mark.parametrize( + ("test_commands", "step_working_dir", "expected_result"), + [ + (["echo 'hello'"], None, "cd /vllm-workspace/tests; echo 'hello'"), + (["echo 'hello'"], "/vllm-workspace/tests", "cd /vllm-workspace/tests; echo 'hello'"), + (["echo 'hello1'", "echo 'hello2'"], None, "cd /vllm-workspace/tests; echo 'hello1'; echo 'hello2'"), + ], +) +def test_get_full_test_command(test_commands: List[str], step_working_dir: str, expected_result: str): + assert get_full_test_command(test_commands, step_working_dir) == expected_result + +def test_get_multi_node_test_command(): + test_commands = [ + "distributed/test_same_node.py; pytest -v -s distributed/test_multi_node_assignment.py; pytest -v -s distributed/test_pipeline_parallel.py", + "distributed/test_same_node.py", + ] + working_dir = "/vllm-workspace/tests" + num_nodes = 2 + num_gpus = 4 + docker_image_path = "ecr-path/vllm-ci-test-repo:latest" + expected_multi_node_command = [ + MULTI_NODE_TEST_SCRIPT, + working_dir, + num_nodes, + num_gpus, + docker_image_path, + f"'{test_commands[0]}'", + f"'{test_commands[1]}'", + ] + expected_result = " ".join(map(str, expected_multi_node_command)) + assert get_multi_node_test_command(test_commands, working_dir, num_nodes, num_gpus, docker_image_path) == expected_result + +if __name__ == "__main__": + sys.exit(pytest.main(["-v", __file__])) \ No newline at end of file From e3aac9c054f3cc4f4d943f4144923b63615cfe32 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 19 Sep 2024 21:31:32 +0000 Subject: [PATCH 02/10] p Signed-off-by: kevin --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3da3291..9d57626 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,9 @@ terraform.rc .env -.vscode/ \ No newline at end of file +.vscode/ + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class From 49043e5bc55327707e44f68b18a81709ca852558 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 19 Sep 2024 21:33:15 +0000 Subject: [PATCH 03/10] p Signed-off-by: kevin --- scripts/__pycache__/__init__.cpython-311.pyc | Bin 167 -> 0 bytes .../__pycache__/__init__.cpython-311.pyc | Bin 186 -> 0 bytes .../__pycache__/utils.cpython-311.pyc | Bin 3138 -> 0 bytes .../tests/__pycache__/__init__.cpython-311.pyc | Bin 173 -> 0 bytes 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 scripts/__pycache__/__init__.cpython-311.pyc delete mode 100644 scripts/pipeline_generator/__pycache__/__init__.cpython-311.pyc delete mode 100644 scripts/pipeline_generator/__pycache__/utils.cpython-311.pyc delete mode 100644 scripts/tests/__pycache__/__init__.cpython-311.pyc diff --git a/scripts/__pycache__/__init__.cpython-311.pyc b/scripts/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index e5c7f8f2a99b65ad67d4aba6645245fba7f99d52..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 167 zcmZ3^%ge<81R_)4q=D$iAOZ#$p^VRLK*n^26oz01O-8?!3`I;p{%4TnFDw0w{M=Oi z(xlS7l2ZM$oSa@J%z~0){rLFIyv&mLc)fzk lUmP~M`6;D2sdh!IK%+pG74rj$56p~=j2{?aL=iJk3;;|xC`AAO diff --git a/scripts/pipeline_generator/__pycache__/__init__.cpython-311.pyc b/scripts/pipeline_generator/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index 2750a53e48795264d1de74b946d95ba1eaccef7a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 186 zcmZ3^%ge<81Oijvq=D$iAOZ#$p^VRLK*n^26oz01O-8?!3`I;p{%4TnFJJwP{M=Oi z(xlS7l2ZM$oSa@J%z~0){esMb)SS$`)cEw& zywsw^lKdk5`1s7c%#!$cy@JYL95%W6DWy57c15f}(?RwZ^8<+w%#4hT9~fXn5i?K> E096bx{{R30 diff --git a/scripts/pipeline_generator/__pycache__/utils.cpython-311.pyc b/scripts/pipeline_generator/__pycache__/utils.cpython-311.pyc deleted file mode 100644 index e0b951e103c95162898ca38bcdb1bed0ea696e30..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3138 zcmaJCO>EoN`B9=J>fe_98>gO!J!}+l9m}$qVh;J zu^_iR z=+=O@@k1J+NAS6WO^ON0FQvvj1`_*$?(d=pfFA6klTvbv5mWbQc1RqQ=pNl6sb5S= z{aXQX805n*$wxpwDh-MQ@Qt17M#VFrJ0emWXlnd>a*pzp&t_KZx~$fC#imQLrZ-1( zSXK30R^WwgDYxCIRODJ^ix;HkQ0@aosb=n|ct@)PBd1H6t~E#Mjhl)rWF-M-`8!(f z_GSGoZI*w#nRN99IYSgPSgNbdC{~54$G2&IW_r5$TJ~l`R>U1ycbCl6<+`NEH7UEx zSC!^Omsq;1OBl}Ttf;y2(Jpzf<+&~iZqzc>hN8=vnkq_;eOB8RI?(_G^1~U=FT!+y zBt)`<^@$Yg7kw<+%3)74mL+HIuD!K!Tibsw+I#v0;YdL&&mBy-py^RRVmlF*{JCa zH&%75-jW18*9lZckaL=V<+`rrJg0Nu1PSxHigOKJRXbuj};#? z7OlYx#)_3VYb?1SGGZ)P@e~N+BgP_m@Tj+j9jK`sxX@;ZANAe3WHYr!m9R8BfF-?w zYl0uNz2O6d(9b^xaDZ9}M|DpI^DQspXaltKy3-&=xpR#)9K2*o_Qw zeaGQtK)~TtJ<#ojJ#gD$$LYkt8!hw@_>VfWJt(=B585x)@_&vV(BL+Ivsh4TA4phF zlOv_QBcO=sYs=+DZee-drf;coZHmU{;c)ne0PINDeeHoBhj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pycache__/__init__.cpython-311.pyc | Bin 192 -> 0 bytes .../test_utils.cpython-311-pytest-8.1.1.pyc | Bin 7918 -> 0 bytes 3 files changed, 3 insertions(+) delete mode 100644 scripts/tests/pipeline_generator/__pycache__/__init__.cpython-311.pyc delete mode 100644 scripts/tests/pipeline_generator/__pycache__/test_utils.cpython-311-pytest-8.1.1.pyc diff --git a/.gitignore b/.gitignore index 9d57626..797af49 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,6 @@ terraform.rc __pycache__/ *.py[cod] *$py.class + +.cache +*.log diff --git a/scripts/tests/pipeline_generator/__pycache__/__init__.cpython-311.pyc b/scripts/tests/pipeline_generator/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index 7ae663ecc8366f1723f3e198bc9665bdb85ed5d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 192 zcmZ3^%ge<81gECFNdwW3K?DpiLK&agfQ;!3DGb33nv8xc8H$*I{LdiCU%~nr`MIh3 zrAeiEC8hdhIXSty1x5K;smUe!Nu`-NDcPANsk+IT`o+mbnFS@q`X#BwK(ZjSAT=j5 zFEu_rH7~U&u_V7pKR!M)FS8^*Uaz3?7l%!5eoARhs$CH)&<>C*iur-W2WCb_#t#fI JqKFwN1^_(eGavu} diff --git a/scripts/tests/pipeline_generator/__pycache__/test_utils.cpython-311-pytest-8.1.1.pyc b/scripts/tests/pipeline_generator/__pycache__/test_utils.cpython-311-pytest-8.1.1.pyc deleted file mode 100644 index 8abe5bd34a16fc6a85db361a26c7dc818ec882b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7918 zcmeGhTWs6bl@uw8k}bbqveQ~Y*E&jSJAUNhq*<3G8R9HSyV>plWdp0|QnGBlc1fj) zCJjarU>UHFU>Fb&OM(2%YvFzLcYpibC!IN%Kx{yPVIKkZp&;8Z%O=Ji`z{SE&xL`L>m5FwHKTzpg=BctnkTG>U?c0JUw+$yd+%tGa z{E~IXjyy+#n=#%Lu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oQV$;o1?ptw+(sHGpz^xe(8l@_WAz7 z0jT%!{5Af`K%K+u=l$&Zdx2ez4?biACw$TGX0A&v&2%h+K*_c~5(#w&7jT|{tt8PY9t67 zIN^(4H)CDu=YP!CIR`w>iJcG1PlbpfL~3H-Cs#kd`ry`s4}NxQ^J`CJBNE#QAKwih W-w{vjiYJWbuP$)nC@@%W#(w};B^@~c From 3cdd2b3868566412cb146eb232569059bf263205 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 19 Sep 2024 21:37:29 +0000 Subject: [PATCH 05/10] p Signed-off-by: kevin --- scripts/tests/pipeline_generator/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tests/pipeline_generator/test_utils.py b/scripts/tests/pipeline_generator/test_utils.py index 5d08973..e3365db 100644 --- a/scripts/tests/pipeline_generator/test_utils.py +++ b/scripts/tests/pipeline_generator/test_utils.py @@ -54,4 +54,4 @@ def test_get_multi_node_test_command(): assert get_multi_node_test_command(test_commands, working_dir, num_nodes, num_gpus, docker_image_path) == expected_result if __name__ == "__main__": - sys.exit(pytest.main(["-v", __file__])) \ No newline at end of file + sys.exit(pytest.main(["-v", __file__])) From ab323d9fc24d1f1abd8c72ac2870de68dd7067eb Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 19 Sep 2024 21:41:23 +0000 Subject: [PATCH 06/10] p Signed-off-by: kevin --- scripts/pipeline_generator/utils.py | 13 +++++++++++-- scripts/tests/pipeline_generator/test_utils.py | 11 ++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/scripts/pipeline_generator/utils.py b/scripts/pipeline_generator/utils.py index 102fa37..12911a7 100644 --- a/scripts/pipeline_generator/utils.py +++ b/scripts/pipeline_generator/utils.py @@ -1,5 +1,4 @@ import enum -import os from typing import Optional, List # Constants @@ -18,6 +17,7 @@ STEPS_TO_BLOCK = [] + class AgentQueue(str, enum.Enum): AWS_CPU = "cpu_queue" AWS_SMALL_CPU = "small_cpu_queue" @@ -27,6 +27,7 @@ class AgentQueue(str, enum.Enum): AMD_GPU = "amd" AMD_CPU = "amd-cpu" + def get_agent_queue(no_gpu: Optional[bool], gpu_type: Optional[str], num_gpus: Optional[int]) -> AgentQueue: if no_gpu: return AgentQueue.AWS_SMALL_CPU @@ -34,13 +35,21 @@ def get_agent_queue(no_gpu: Optional[bool], gpu_type: Optional[str], num_gpus: O return AgentQueue.A100 return AgentQueue.AWS_1xL4 if 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 = "; ".join(test_commands) return f"cd {working_dir}; {test_commands_str}" -def get_multi_node_test_command(test_commands: List[str], working_dir: str, num_nodes: int, num_gpus: int, docker_image_path: str) -> str: + +def get_multi_node_test_command( + test_commands: List[str], + working_dir: str, + num_nodes: int, + num_gpus: int, + docker_image_path: str + ) -> str: quoted_commands = [f"'{command}'" for command in test_commands] multi_node_command = [ MULTI_NODE_TEST_SCRIPT, diff --git a/scripts/tests/pipeline_generator/test_utils.py b/scripts/tests/pipeline_generator/test_utils.py index e3365db..74ab72f 100644 --- a/scripts/tests/pipeline_generator/test_utils.py +++ b/scripts/tests/pipeline_generator/test_utils.py @@ -1,4 +1,5 @@ import pytest +import sys from typing import List from scripts.pipeline_generator.utils import ( @@ -9,6 +10,7 @@ MULTI_NODE_TEST_SCRIPT, ) + @pytest.mark.parametrize( ("no_gpu", "gpu_type", "num_gpus", "expected_result"), [ @@ -21,6 +23,7 @@ def test_get_agent_queue(no_gpu: bool, gpu_type: str, num_gpus: int, expected_result: AgentQueue): assert get_agent_queue(no_gpu, gpu_type, num_gpus) == expected_result + @pytest.mark.parametrize( ("test_commands", "step_working_dir", "expected_result"), [ @@ -32,9 +35,14 @@ def test_get_agent_queue(no_gpu: bool, gpu_type: str, num_gpus: int, expected_re def test_get_full_test_command(test_commands: List[str], step_working_dir: str, expected_result: str): assert get_full_test_command(test_commands, step_working_dir) == expected_result + def test_get_multi_node_test_command(): test_commands = [ - "distributed/test_same_node.py; pytest -v -s distributed/test_multi_node_assignment.py; pytest -v -s distributed/test_pipeline_parallel.py", + ( + "distributed/test_same_node.py;" + "pytest -v -s distributed/test_multi_node_assignment.py;" + "pytest -v -s distributed/test_pipeline_parallel.py" + ), "distributed/test_same_node.py", ] working_dir = "/vllm-workspace/tests" @@ -53,5 +61,6 @@ def test_get_multi_node_test_command(): expected_result = " ".join(map(str, expected_multi_node_command)) assert get_multi_node_test_command(test_commands, working_dir, num_nodes, num_gpus, docker_image_path) == expected_result + if __name__ == "__main__": sys.exit(pytest.main(["-v", __file__])) From 231cd2f68ad84fc1a817f30759c383d33718d1ed Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 19 Sep 2024 22:48:46 +0000 Subject: [PATCH 07/10] P Signed-off-by: kevin --- scripts/pipeline_generator/step.py | 56 +++++++++++++++++++ scripts/tests/pipeline_generator/test_step.py | 32 +++++++++++ 2 files changed, 88 insertions(+) create mode 100644 scripts/pipeline_generator/step.py create mode 100644 scripts/tests/pipeline_generator/test_step.py diff --git a/scripts/pipeline_generator/step.py b/scripts/pipeline_generator/step.py new file mode 100644 index 0000000..36d7129 --- /dev/null +++ b/scripts/pipeline_generator/step.py @@ -0,0 +1,56 @@ +from pydantic import BaseModel, Field +from typing import List, Dict, Any, Optional + +from .utils import AgentQueue + +class TestStep(BaseModel): + """This class represents a test step defined in the test configuration file.""" + label: str + fast_check: bool = False + mirror_hardwares: List[str] = Field(default_factory=list) + gpu: str = "" + num_gpus: int = 1 + num_nodes: int = 1 + working_dir: str = "/vllm-workspace/tests" + source_file_dependencies: List[str] = Field(default_factory=list) + no_gpu: bool = False + soft_fail: bool = False + parallelism: int = 1 + optional: bool = False + command: Optional[str] = None + commands: Optional[List[str]] = None + +class BuildkiteStep(BaseModel): + """This class represents a step in Buildkite format.""" + label: str + key: str + agents: Dict[str, Any] = {"queue": AgentQueue.AWS_CPU} + commands: Optional[List[str]] = None + plugins: Optional[List[Dict]] = None + parallelism: Optional[int] = None + soft_fail: Optional[bool] = None + depends_on: Optional[str] = "build" + env: Optional[Dict[str, str]] = None + retry: Optional[Dict[str, Any]] = None + +class BuildkiteBlockStep(BaseModel): + """This class represents a block step in Buildkite format.""" + block: str + depends_on: Optional[str] = "build" + key: str + +def get_step_key(step_label: str) -> str: + step_label = step_label.replace(", ", ",") + step_key = "" + skip_chars = "()%" + for char in step_label.lower(): + if char in ", ": + step_key += "-" + elif char not in skip_chars: + step_key += char + + return step_key + + +def get_block_step(step_label: str) -> BuildkiteBlockStep: + return BuildkiteBlockStep(block=f"Run {step_label}", key=f"block-{get_step_key(step_label)}") \ No newline at end of file diff --git a/scripts/tests/pipeline_generator/test_step.py b/scripts/tests/pipeline_generator/test_step.py new file mode 100644 index 0000000..3f917c9 --- /dev/null +++ b/scripts/tests/pipeline_generator/test_step.py @@ -0,0 +1,32 @@ +import pytest +import sys +from typing import List + +from scripts.pipeline_generator.step import get_step_key, get_block_step, BuildkiteBlockStep + +@pytest.mark.parametrize( + ("step_label", "expected_result"), + [ + ("Test Step", "test-step"), + ("Test Step 2", "test-step-2"), + ("Test (Step)", "test-step"), + ("Test A, B, C", "test-a-b-c"), + ], +) +def test_get_step_key(step_label: str, expected_result: str): + assert get_step_key(step_label) == expected_result + +@pytest.mark.parametrize( + ("step_label", "expected_result"), + [ + ("Test Step", BuildkiteBlockStep(block="Run Test Step", key="block-test-step")), + ("Test Step 2", BuildkiteBlockStep(block="Run Test Step 2", key="block-test-step-2")), + ("Test (Step)", BuildkiteBlockStep(block="Run Test (Step)", key="block-test-step")), + ("Test A, B, C", BuildkiteBlockStep(block="Run Test A, B, C", key="block-test-a-b-c")), + ], +) +def test_get_block_step(step_label: str, expected_result: BuildkiteBlockStep): + assert get_block_step(step_label) == expected_result + +if __name__ == "__main__": + sys.exit(pytest.main(["-v", __file__])) From df69376cc72602292e335466b2146eefedadcfd9 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 19 Sep 2024 22:51:51 +0000 Subject: [PATCH 08/10] p Signed-off-by: kevin --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6b2b527 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +click==8.1.7 +pydantic==2.9.2 \ No newline at end of file From 6bea5dc33b9492c98ffb72cdfaad35ed79561987 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 19 Sep 2024 22:53:07 +0000 Subject: [PATCH 09/10] p Signed-off-by: kevin --- scripts/pipeline_generator/step.py | 6 +++++- scripts/tests/pipeline_generator/test_step.py | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/pipeline_generator/step.py b/scripts/pipeline_generator/step.py index 36d7129..3479a8f 100644 --- a/scripts/pipeline_generator/step.py +++ b/scripts/pipeline_generator/step.py @@ -3,6 +3,7 @@ from .utils import AgentQueue + class TestStep(BaseModel): """This class represents a test step defined in the test configuration file.""" label: str @@ -20,6 +21,7 @@ class TestStep(BaseModel): command: Optional[str] = None commands: Optional[List[str]] = None + class BuildkiteStep(BaseModel): """This class represents a step in Buildkite format.""" label: str @@ -33,12 +35,14 @@ class BuildkiteStep(BaseModel): env: Optional[Dict[str, str]] = None retry: Optional[Dict[str, Any]] = None + class BuildkiteBlockStep(BaseModel): """This class represents a block step in Buildkite format.""" block: str depends_on: Optional[str] = "build" key: str + def get_step_key(step_label: str) -> str: step_label = step_label.replace(", ", ",") step_key = "" @@ -53,4 +57,4 @@ def get_step_key(step_label: str) -> str: def get_block_step(step_label: str) -> BuildkiteBlockStep: - return BuildkiteBlockStep(block=f"Run {step_label}", key=f"block-{get_step_key(step_label)}") \ No newline at end of file + return BuildkiteBlockStep(block=f"Run {step_label}", key=f"block-{get_step_key(step_label)}") diff --git a/scripts/tests/pipeline_generator/test_step.py b/scripts/tests/pipeline_generator/test_step.py index 3f917c9..e4e8b9a 100644 --- a/scripts/tests/pipeline_generator/test_step.py +++ b/scripts/tests/pipeline_generator/test_step.py @@ -1,9 +1,10 @@ import pytest import sys -from typing import List + from scripts.pipeline_generator.step import get_step_key, get_block_step, BuildkiteBlockStep + @pytest.mark.parametrize( ("step_label", "expected_result"), [ @@ -16,6 +17,7 @@ def test_get_step_key(step_label: str, expected_result: str): assert get_step_key(step_label) == expected_result + @pytest.mark.parametrize( ("step_label", "expected_result"), [ @@ -28,5 +30,6 @@ def test_get_step_key(step_label: str, expected_result: str): def test_get_block_step(step_label: str, expected_result: BuildkiteBlockStep): assert get_block_step(step_label) == expected_result + if __name__ == "__main__": sys.exit(pytest.main(["-v", __file__])) From 3c458496d04e053ef468bcead52837a53670a244 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 23 Sep 2024 06:02:03 +0000 Subject: [PATCH 10/10] p Signed-off-by: kevin --- scripts/pipeline_generator/step.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/pipeline_generator/step.py b/scripts/pipeline_generator/step.py index c29c8b9..1e1c462 100644 --- a/scripts/pipeline_generator/step.py +++ b/scripts/pipeline_generator/step.py @@ -3,20 +3,20 @@ from .utils import AgentQueue +BUILD_STEP_KEY = "build" class BuildkiteBlockStep(BaseModel): """This class represents a block step in Buildkite format.""" block: str - depends_on: Optional[str] = "build" + depends_on: Optional[str] = BUILD_STEP_KEY key: str def get_step_key(step_label: str) -> str: - step_label = step_label.replace(", ", ",") step_key = "" - skip_chars = "()%" + skip_chars = "()% " for char in step_label.lower(): - if char in ", ": + if char in ", " and step_key[-1] != "-": step_key += "-" elif char not in skip_chars: step_key += char