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/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/jobspecs/flexible/bad.yaml b/t/data/resource/jobspecs/flexible/bad.yaml new file mode 100644 index 000000000..2a550949d --- /dev/null +++ b/t/data/resource/jobspecs/flexible/bad.yaml @@ -0,0 +1,30 @@ +version: 9999 +resources: + - type: cluster +` count: 1 + with: + - type: rack + count: 1 + with: + - type: node + count: 1 + with: + - type: slot + count: 1 + label: default + with: + - type: socket + count: 1 + with: + - type: core + count: 1 +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 + 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..51b4128bb --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test003.yaml @@ -0,0 +1,28 @@ +version: 9999 +resources: + - type: 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/test004.yaml b/t/data/resource/jobspecs/flexible/test004.yaml new file mode 100644 index 000000000..aa9fd1c27 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test004.yaml @@ -0,0 +1,20 @@ +version: 9999 +resources: + - type: slot + count: 1 + label: default + with: + - type: core + count: 8 + - 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..8026a908a --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test005.yaml @@ -0,0 +1,28 @@ +version: 9999 +resources: + - type: slot + count: 4 + 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..080ee9527 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test006.yaml @@ -0,0 +1,30 @@ +version: 9999 +resources: + - type: cluster + count: 1 + with: + - type: rack + count: 1 + with: + - type: node + count: 1 + with: + - type: slot + count: 1 + label: default + with: + - type: socket + count: 1 + with: + - type: core + 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..cb2f67686 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test007.yaml @@ -0,0 +1,30 @@ +version: 9999 +resources: + - type: cluster + count: 1 + with: + - type: rack + count: 1 + with: + - type: node + count: 1 + with: + - type: slot + count: 1 + label: default + with: + - type: socket + count: 1 + with: + - type: core + count: 19 +# a comment +attributes: + system: + duration: 3600 +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..5b9eb901b --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test008.yaml @@ -0,0 +1,19 @@ +version: 9999 +resources: + - type: 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/data/resource/jobspecs/flexible/test009.yaml b/t/data/resource/jobspecs/flexible/test009.yaml new file mode 100644 index 000000000..dde0950ee --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test009.yaml @@ -0,0 +1,21 @@ +version: 9999 +resources: + - type: node + count: 1 + with: + - type: slot + count: 2 + label: default + with: + - type: socket + count: 1 + +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 diff --git a/t/data/resource/jobspecs/flexible/test010.yaml b/t/data/resource/jobspecs/flexible/test010.yaml new file mode 100644 index 000000000..b7577007e --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test010.yaml @@ -0,0 +1,18 @@ +version: 9999 +resources: + - type: slot + count: 1 + label: default + with: + - type: gpu + count: 2 + +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 diff --git a/t/data/resource/jobspecs/flexible/test011.yaml b/t/data/resource/jobspecs/flexible/test011.yaml new file mode 100644 index 000000000..158e5513e --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test011.yaml @@ -0,0 +1,24 @@ +version: 9999 +resources: + - type: node + count: 2000 + with: + - type: slot + count: 1 + label: default + with: + - type: socket + count: 2 + with: + - type: core + count: 22 +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 + diff --git a/t/data/resource/jobspecs/flexible/test012.yaml b/t/data/resource/jobspecs/flexible/test012.yaml new file mode 100644 index 000000000..11258a000 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test012.yaml @@ -0,0 +1,21 @@ +version: 9999 +resources: + - type: socket + count: 1 + with: + - type: slot + count: 2 + label: default + with: + - type: gpu + count: 1 + +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 diff --git a/t/data/resource/jobspecs/flexible/test013.yaml b/t/data/resource/jobspecs/flexible/test013.yaml new file mode 100644 index 000000000..5acb83624 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test013.yaml @@ -0,0 +1,25 @@ +version: 9999 +resources: + - type: node + count: 1 + with: + - type: slot + count: 1 + label: default + with: + - type: socket + count: 1 + with: + - type: core + count: 22 + - type: gpu + count: 2 +# a comment +attributes: + system: + duration: 3600 +tasks: + - command: [ "app" ] + slot: default + count: + per_slot: 1 diff --git a/t/data/resource/jobspecs/flexible/test014.yaml b/t/data/resource/jobspecs/flexible/test014.yaml new file mode 100644 index 000000000..1ae20bf60 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test014.yaml @@ -0,0 +1,30 @@ +version: 9999 +resources: + - type: cluster + count: 1 + with: + - type: rack + count: 1 + with: + - type: node + count: 2 + with: + - type: slot + count: 1 + label: default + with: + - type: socket + count: 2 + with: + - type: core + 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/test015.yaml b/t/data/resource/jobspecs/flexible/test015.yaml new file mode 100644 index 000000000..2aef80452 --- /dev/null +++ b/t/data/resource/jobspecs/flexible/test015.yaml @@ -0,0 +1,30 @@ +version: 9999 +resources: + - type: cluster + count: 1 + with: + - type: rack + count: 1 + with: + - type: node + count: 3 + with: + - type: slot + count: 1 + label: default + with: + - type: socket + count: 2 + with: + - type: core + count: 18 +# 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..bdd69f68d --- /dev/null +++ b/t/t3037-resource-flexible.t @@ -0,0 +1,28 @@ +#!/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 +' + +test_done