From 69c8c911eaeba146d8548a792198db30a47e00e4 Mon Sep 17 00:00:00 2001 From: Zeke Morton Date: Mon, 16 Sep 2024 14:14:58 -0700 Subject: [PATCH] tests: add or_slot flexible tests Problem: there are no tests for or_slots Add tests --- t/CMakeLists.txt | 1 + t/data/resource/commands/flexible/cmds01.in | 10 ++ t/data/resource/commands/flexible/cmds02.in | 6 + t/data/resource/commands/flexible/cmds03.in | 6 + t/data/resource/commands/flexible/cmds04.in | 2 + t/data/resource/commands/flexible/cmds05.in | 3 + t/data/resource/commands/flexible/cmds06.in | 2 + t/data/resource/commands/flexible/cmds07.in | 2 + t/data/resource/commands/flexible/cmds08.in | 2 + t/data/resource/expected/flexible/001.R.out | 152 ++++++++++++++++++ t/data/resource/expected/flexible/002.R.out | 76 +++++++++ t/data/resource/expected/flexible/003.R.out | 136 ++++++++++++++++ t/data/resource/expected/flexible/004.R.out | 4 + t/data/resource/expected/flexible/005.R.out | 53 ++++++ t/data/resource/expected/flexible/006.R.out | 4 + t/data/resource/expected/flexible/007.R.out | 4 + t/data/resource/expected/flexible/008.R.out | 10 ++ .../resource/jobspecs/flexible/test001.yaml | 38 +++++ .../resource/jobspecs/flexible/test002.yaml | 37 +++++ .../resource/jobspecs/flexible/test003.yaml | 40 +++++ .../resource/jobspecs/flexible/test004.yaml | 28 ++++ .../resource/jobspecs/flexible/test005.yaml | 44 +++++ .../resource/jobspecs/flexible/test006.yaml | 21 +++ .../resource/jobspecs/flexible/test007.yaml | 27 ++++ .../resource/jobspecs/flexible/test008.yaml | 25 +++ t/t3037-resource-flexible.t | 76 +++++++++ 26 files changed, 809 insertions(+) create mode 100644 t/data/resource/commands/flexible/cmds01.in create mode 100644 t/data/resource/commands/flexible/cmds02.in create mode 100644 t/data/resource/commands/flexible/cmds03.in create mode 100644 t/data/resource/commands/flexible/cmds04.in create mode 100644 t/data/resource/commands/flexible/cmds05.in create mode 100644 t/data/resource/commands/flexible/cmds06.in create mode 100644 t/data/resource/commands/flexible/cmds07.in create mode 100644 t/data/resource/commands/flexible/cmds08.in create mode 100644 t/data/resource/expected/flexible/001.R.out create mode 100644 t/data/resource/expected/flexible/002.R.out create mode 100644 t/data/resource/expected/flexible/003.R.out create mode 100644 t/data/resource/expected/flexible/004.R.out create mode 100644 t/data/resource/expected/flexible/005.R.out create mode 100644 t/data/resource/expected/flexible/006.R.out create mode 100644 t/data/resource/expected/flexible/007.R.out create mode 100644 t/data/resource/expected/flexible/008.R.out create mode 100644 t/data/resource/jobspecs/flexible/test001.yaml create mode 100644 t/data/resource/jobspecs/flexible/test002.yaml create mode 100644 t/data/resource/jobspecs/flexible/test003.yaml create mode 100644 t/data/resource/jobspecs/flexible/test004.yaml create mode 100644 t/data/resource/jobspecs/flexible/test005.yaml create mode 100644 t/data/resource/jobspecs/flexible/test006.yaml create mode 100644 t/data/resource/jobspecs/flexible/test007.yaml create mode 100644 t/data/resource/jobspecs/flexible/test008.yaml create mode 100755 t/t3037-resource-flexible.t diff --git a/t/CMakeLists.txt b/t/CMakeLists.txt index 9b0d5fa52..6f45654bd 100644 --- a/t/CMakeLists.txt +++ b/t/CMakeLists.txt @@ -65,6 +65,7 @@ set(ALL_TESTS t3034-resource-pconstraints.t t3035-resource-remove.t t3036-rq2.t + t3037-resource-flexible.t t3300-system-dontblock.t t3301-system-latestart.t t4000-match-params.t diff --git a/t/data/resource/commands/flexible/cmds01.in b/t/data/resource/commands/flexible/cmds01.in new file mode 100644 index 000000000..e850b0f21 --- /dev/null +++ b/t/data/resource/commands/flexible/cmds01.in @@ -0,0 +1,10 @@ +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test001.yaml +quit diff --git a/t/data/resource/commands/flexible/cmds02.in b/t/data/resource/commands/flexible/cmds02.in new file mode 100644 index 000000000..eaad716c3 --- /dev/null +++ b/t/data/resource/commands/flexible/cmds02.in @@ -0,0 +1,6 @@ +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test002.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test002.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test002.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test002.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test002.yaml +quit diff --git a/t/data/resource/commands/flexible/cmds03.in b/t/data/resource/commands/flexible/cmds03.in new file mode 100644 index 000000000..59a7e82db --- /dev/null +++ b/t/data/resource/commands/flexible/cmds03.in @@ -0,0 +1,6 @@ +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test003.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test003.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test003.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test003.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test003.yaml +quit diff --git a/t/data/resource/commands/flexible/cmds04.in b/t/data/resource/commands/flexible/cmds04.in new file mode 100644 index 000000000..ca8695326 --- /dev/null +++ b/t/data/resource/commands/flexible/cmds04.in @@ -0,0 +1,2 @@ +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test004.yaml +quit diff --git a/t/data/resource/commands/flexible/cmds05.in b/t/data/resource/commands/flexible/cmds05.in new file mode 100644 index 000000000..f71a0e3fc --- /dev/null +++ b/t/data/resource/commands/flexible/cmds05.in @@ -0,0 +1,3 @@ +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test005.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test005.yaml +quit diff --git a/t/data/resource/commands/flexible/cmds06.in b/t/data/resource/commands/flexible/cmds06.in new file mode 100644 index 000000000..b259537a5 --- /dev/null +++ b/t/data/resource/commands/flexible/cmds06.in @@ -0,0 +1,2 @@ +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test006.yaml +quit diff --git a/t/data/resource/commands/flexible/cmds07.in b/t/data/resource/commands/flexible/cmds07.in new file mode 100644 index 000000000..1c9652d87 --- /dev/null +++ b/t/data/resource/commands/flexible/cmds07.in @@ -0,0 +1,2 @@ +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test007.yaml +quit diff --git a/t/data/resource/commands/flexible/cmds08.in b/t/data/resource/commands/flexible/cmds08.in new file mode 100644 index 000000000..05f1daca2 --- /dev/null +++ b/t/data/resource/commands/flexible/cmds08.in @@ -0,0 +1,2 @@ +match allocate @TEST_SRCDIR@/data/resource/jobspecs/flexible/test008.yaml +quit diff --git a/t/data/resource/expected/flexible/001.R.out b/t/data/resource/expected/flexible/001.R.out new file mode 100644 index 000000000..3de8f0a0e --- /dev/null +++ b/t/data/resource/expected/flexible/001.R.out @@ -0,0 +1,152 @@ + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ------------socket1[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=1 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ------------socket1[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=2 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ------------socket0[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=3 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ------------socket0[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=4 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ------------socket1[1:s] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=5 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ------------socket1[1:s] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=6 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ------------socket0[1:s] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=7 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ------------socket0[1:s] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=8 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=9 +INFO: ============================= diff --git a/t/data/resource/expected/flexible/002.R.out b/t/data/resource/expected/flexible/002.R.out new file mode 100644 index 000000000..c3a5b5570 --- /dev/null +++ b/t/data/resource/expected/flexible/002.R.out @@ -0,0 +1,76 @@ + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ------------socket1[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=1 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ------------socket0[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=2 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ------------socket1[1:s] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=3 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ------------socket0[1:s] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=4 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=5 +INFO: ============================= diff --git a/t/data/resource/expected/flexible/003.R.out b/t/data/resource/expected/flexible/003.R.out new file mode 100644 index 000000000..b7380276c --- /dev/null +++ b/t/data/resource/expected/flexible/003.R.out @@ -0,0 +1,136 @@ + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:s] + ---------node0[1:s] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=1 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:s] + ---------node0[1:s] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=2 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ------------socket1[1:s] + ---------node0[1:s] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ------------socket1[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=3 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ------------socket0[1:s] + ---------node0[1:s] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ------------socket0[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=4 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=5 +INFO: ============================= diff --git a/t/data/resource/expected/flexible/004.R.out b/t/data/resource/expected/flexible/004.R.out new file mode 100644 index 000000000..5e4d95e5b --- /dev/null +++ b/t/data/resource/expected/flexible/004.R.out @@ -0,0 +1,4 @@ +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=1 +INFO: ============================= diff --git a/t/data/resource/expected/flexible/005.R.out b/t/data/resource/expected/flexible/005.R.out new file mode 100644 index 000000000..a2db7966f --- /dev/null +++ b/t/data/resource/expected/flexible/005.R.out @@ -0,0 +1,53 @@ + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node0[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node1[1:x] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=1 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=2 +INFO: ============================= diff --git a/t/data/resource/expected/flexible/006.R.out b/t/data/resource/expected/flexible/006.R.out new file mode 100644 index 000000000..5e4d95e5b --- /dev/null +++ b/t/data/resource/expected/flexible/006.R.out @@ -0,0 +1,4 @@ +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=1 +INFO: ============================= diff --git a/t/data/resource/expected/flexible/007.R.out b/t/data/resource/expected/flexible/007.R.out new file mode 100644 index 000000000..5e4d95e5b --- /dev/null +++ b/t/data/resource/expected/flexible/007.R.out @@ -0,0 +1,4 @@ +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=1 +INFO: ============================= diff --git a/t/data/resource/expected/flexible/008.R.out b/t/data/resource/expected/flexible/008.R.out new file mode 100644 index 000000000..7aefd9083 --- /dev/null +++ b/t/data/resource/expected/flexible/008.R.out @@ -0,0 +1,10 @@ + ---------------core35[1:x] + ------------socket1[1:s] + ---------node1[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=1 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= diff --git a/t/data/resource/jobspecs/flexible/test001.yaml b/t/data/resource/jobspecs/flexible/test001.yaml new file mode 100644 index 000000000..cbfaf5bcb --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test001.yaml @@ -0,0 +1,38 @@ +version: 9999 +resources: + - type: cluster + count: 1 + with: + - type: rack + count: 1 + with: + - type: node + count: 1 + with: + - type: socket + count: 1 + with: + - type: or_slot + count: 1 + label: small + with: + - type: core + count: 8 + - type: gpu + count: 1 + - type: or_slot + count: 1 + label: big + with: + - type: core + count: 10 +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 + diff --git a/t/data/resource/jobspecs/flexible/test002.yaml b/t/data/resource/jobspecs/flexible/test002.yaml new file mode 100644 index 000000000..2f627b5f9 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test002.yaml @@ -0,0 +1,37 @@ +version: 9999 +resources: + - type: cluster + count: 1 + with: + - type: rack + count: 1 + with: + - type: node + count: 1 + with: + - type: socket + count: 1 + with: + - type: or_slot + count: 1 + label: small + with: + - type: core + count: 8 + - type: gpu + count: 1 + - type: or_slot + count: 1 + label: big + with: + - type: core + count: 36 +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 \ No newline at end of file diff --git a/t/data/resource/jobspecs/flexible/test003.yaml b/t/data/resource/jobspecs/flexible/test003.yaml new file mode 100644 index 000000000..604e9967b --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test003.yaml @@ -0,0 +1,40 @@ +version: 9999 +resources: + - type: or_slot + count: 2 + label: default + with: + - type: core + count: 12 + - type: memory + count: 4 + - type: or_slot + count: 2 + label: default + with: + - type: core + count: 5 + - type: gpu + count: 1 + - type: memory + count: 4 + - type: or_slot + count: 2 + label: default + with: + - type: core + count: 4 + - type: gpu + count: 2 + - type: memory + count: 4 + +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 diff --git a/t/data/resource/jobspecs/flexible/test004.yaml b/t/data/resource/jobspecs/flexible/test004.yaml new file mode 100644 index 000000000..b921f3115 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test004.yaml @@ -0,0 +1,28 @@ +version: 9999 +resources: + - type: slot + count: 1 + label: default + with: + - type: core + count: 8 + - type: memory + count: 2 + - type: or_slot + count: 1 + label: default + with: + - type: core + count: 12 + - type: memory + count: 2 + +# a comment +attributes: + system: + duration: 7200 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 diff --git a/t/data/resource/jobspecs/flexible/test005.yaml b/t/data/resource/jobspecs/flexible/test005.yaml new file mode 100644 index 000000000..60ebd66c5 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test005.yaml @@ -0,0 +1,44 @@ +version: 9999 +resources: + - type: or_slot + count: 2 + label: default + with: + - type: node + count: 1 + with: + - type: socket + count: 2 + with: + - type: core + count: 5 + - type: gpu + count: 1 + - type: memory + count: 6 + - type: or_slot + count: 2 + label: default + with: + - type: node + count: 1 + with: + - type: socket + count: 2 + with: + - type: core + count: 5 + - type: gpu + count: 1 + - type: memory + count: 6 + +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 diff --git a/t/data/resource/jobspecs/flexible/test006.yaml b/t/data/resource/jobspecs/flexible/test006.yaml new file mode 100644 index 000000000..d0eb498e1 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test006.yaml @@ -0,0 +1,21 @@ +version: 9999 +resources: + - type: or_slot + count: 1 + label: default + with: + - type: core + count: 18 + - type: does-not-exist + count: 18 + +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 + diff --git a/t/data/resource/jobspecs/flexible/test007.yaml b/t/data/resource/jobspecs/flexible/test007.yaml new file mode 100644 index 000000000..40521a71f --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test007.yaml @@ -0,0 +1,27 @@ +version: 9999 +resources: + - type: socket + count: 1 + with: + - type: core + count: 8 + - type: memory + count: 2 + - type: or_slot + count: 1 + label: default + with: + - type: core + count: 12 + - type: memory + count: 2 + +# a comment +attributes: + system: + duration: 7200 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 diff --git a/t/data/resource/jobspecs/flexible/test008.yaml b/t/data/resource/jobspecs/flexible/test008.yaml new file mode 100644 index 000000000..730132bf8 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test008.yaml @@ -0,0 +1,25 @@ +version: 9999 +resources: + - type: or_slot + count: 1 + label: default + with: + - type: core + count: 1 + - type: or_slot + count: 1 + label: default + with: + - type: core + count: 1 + +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 + diff --git a/t/t3037-resource-flexible.t b/t/t3037-resource-flexible.t new file mode 100755 index 000000000..10a29cd12 --- /dev/null +++ b/t/t3037-resource-flexible.t @@ -0,0 +1,76 @@ +#!/bin/sh + +test_description='Test Flexible Scheduling On Medium Machine Configuration in JGF' + +. $(dirname $0)/sharness.sh + +cmd_dir="${SHARNESS_TEST_SRCDIR}/data/resource/commands/flexible" +exp_dir="${SHARNESS_TEST_SRCDIR}/data/resource/expected/flexible" +jgf="${SHARNESS_TEST_SRCDIR}/data/resource/jgfs/tiny.json" +query="../../resource/utilities/resource-query" + +cmds001="${cmd_dir}/cmds01.in" +test001_desc="JGF: allocate 9 jobspecs with flexible scheduling" +test_expect_success "${test001_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds001} > cmds001 && + ${query} -L ${jgf} -f jgf -S CA -P high -t 001.R.out < cmds001 && + test_cmp 001.R.out ${exp_dir}/001.R.out +' + +cmds002="${cmd_dir}/cmds02.in" +test002_desc="JGF: allocate jobspecs with valid and invalid or_slots" +test_expect_success "${test002_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds002} > cmds002 && + ${query} -L ${jgf} -f jgf -S CA -P high -t 002.R.out < cmds002 && + test_cmp 002.R.out ${exp_dir}/002.R.out +' + +cmds003="${cmd_dir}/cmds03.in" +test003_desc="JGF: allocate jobspecs with pristine jobspec" +test_expect_success "${test003_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds003} > cmds003 && + ${query} -L ${jgf} -f jgf -S CA -P high -t 003.R.out < cmds003 && + test_cmp 003.R.out ${exp_dir}/003.R.out +' + +cmds004="${cmd_dir}/cmds04.in" +test004_desc="JGF: try to allocate jobspec with slot and or_slot siblings" +test_expect_success "${test004_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds004} > cmds004 && + ${query} -L ${jgf} -f jgf -S CA -P high -t 004.R.out < cmds004 && + test_cmp 004.R.out ${exp_dir}/004.R.out +' + +cmds005="${cmd_dir}/cmds05.in" +test005_desc="JGF: try to allocate jobspec with or_slot count > 1" +test_expect_success "${test005_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds005} > cmds005 && + ${query} -L ${jgf} -f jgf -S CA -P high -t 005.R.out < cmds005 && + test_cmp 005.R.out ${exp_dir}/005.R.out +' + +cmds006="${cmd_dir}/cmds06.in" +test006_desc="JGF: try to allocate pristine jobspec with resources that don't exist" +test_expect_success "${test006_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds006} > cmds006 && + ${query} -L ${jgf} -f jgf -S CA -P high -t 006.R.out < cmds006 && + test_cmp 006.R.out ${exp_dir}/006.R.out +' + +cmds007="${cmd_dir}/cmds07.in" +test007_desc="JGF: try to allocate jobspec with resource and or_slot siblings" +test_expect_success "${test007_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds007} > cmds007 && + ${query} -L ${jgf} -f jgf -S CA -P high -t 007.R.out < cmds007 && + test_cmp 007.R.out ${exp_dir}/007.R.out +' + +cmds008="${cmd_dir}/cmds08.in" +test008_desc="JGF: try to allocate jobspec with resource and or_slot siblings" +test_expect_success "${test008_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds008} > cmds008 && + ${query} -L ${jgf} -f jgf -S CA -P high -t 008.R.out < cmds008 && + test_cmp 008.R.out ${exp_dir}/008.R.out +' + +test_done