Skip to content

Commit b35b382

Browse files
committed
feat and ci: grow support with updated branch
This currently uses a custom branch, and will need to be updated when merged into flux-sched. This last change updates the CI to use the latest noble image, and adds back the shrink support and test. Signed-off-by: vsoch <vsoch@users.noreply.github.com>
1 parent 9d3e31a commit b35b382

File tree

6 files changed

+62
-12
lines changed

6 files changed

+62
-12
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ RUN wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz && tar -xvf go${G
2020
ENV PATH=$PATH:/usr/local/go/bin:/home/vscode/go/bin
2121

2222
# Testing grow/shrink from custom branch
23-
RUN git clone -b debug-resource-error-messages https://github.com/researchapps/flux-sched /opt/flux-sched
23+
# RUN git clone -b debug-resource-error-messages https://github.com/researchapps/flux-sched /opt/flux-sched
24+
RUN git clone -b grow-api https://github.com/milroy/flux-sched /opt/flux-sched
2425
# RUN git clone https://github.com/flux-framework/flux-sched /opt/flux-sched
2526

2627
# We also need to rebuild into the system install

.github/workflows/main.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
# container base and lib prefix
24-
test: [["fluxrm/flux-sched:jammy", "/usr/lib"],
24+
test: [["fluxrm/flux-sched:noble", "/usr/lib"],
2525
["fluxrm/flux-sched:fedora38", "/usr/lib64"],
26-
["fluxrm/flux-sched:bookworm-amd64", "/usr/lib"],
27-
["fluxrm/flux-sched:el8", "/usr/lib64"]]
26+
["fluxrm/flux-sched:bookworm-amd64", "/usr/lib"]]
2827

2928
container:
3029
image: ${{ matrix.test[0] }}
@@ -38,7 +37,15 @@ jobs:
3837

3938
# TODO: we should consider distributing the header files with the release builds
4039
- name: flux-sched build
41-
run: git clone https://github.com/flux-framework/flux-sched /opt/flux-sched
40+
run: git clone -b grow-api https://github.com/milroy/flux-sched /opt/flux-sched
41+
- name: flux-sched compile
42+
run: |
43+
export FLUX_SCHED_VERSION=0.39.0
44+
cd /opt/flux-sched
45+
cmake -B build
46+
make -C build
47+
make -C build install
48+
cd -
4249
- name: Build
4350
run: LIB_PREFIX=${{ matrix.test[1] }} make build
4451
- name: Test Binary

.github/workflows/release.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
test: [["fluxrm/flux-sched:jammy", "/usr/lib"],
20+
test: [["fluxrm/flux-sched:noble", "/usr/lib"],
2121
["fluxrm/flux-sched:fedora38", "/usr/lib64"],
22-
["fluxrm/flux-sched:bookworm-amd64", "/usr/lib"],
23-
["fluxrm/flux-sched:el8", "/usr/lib64"]]
22+
["fluxrm/flux-sched:bookworm-amd64", "/usr/lib"]]
2423

2524
container:
2625
image: ${{ matrix.test[0] }}
@@ -33,7 +32,16 @@ jobs:
3332
go-version: ^1.21
3433

3534
- name: flux-sched build
36-
run: git clone https://github.com/flux-framework/flux-sched /opt/flux-sched
35+
run: git clone -b grow-api https://github.com/milroy/flux-sched /opt/flux-sched
36+
- name: flux-sched compile
37+
run: |
38+
export FLUX_SCHED_VERSION=0.39.0
39+
cd /opt/flux-sched
40+
cmake -B build
41+
make -C build
42+
make -C build install
43+
cd -
44+
3745
- name: Build
3846
run: LIB_PREFIX=${{ matrix.test[1] }} make build
3947
- name: Test

cmd/test/data/grow/new-nodes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"type": "rack",
2525
"basename": "rack",
2626
"name": "rack0",
27-
"id": 0,
28-
"uniq_id": 1,
27+
"id": 3,
28+
"uniq_id": 3,
2929
"rank": -1,
3030
"exclusive": false,
3131
"unit": "",

cmd/test/test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,25 @@ func main() {
173173
log.Fatalf("Error in ReapiClient MatchSatisfy - asking for 4 nodes should now succeed: %v\n", err)
174174
}
175175

176+
// Shrink (remove subgraph) for node2
177+
fmt.Println("🥕 Asking to Shrink from 4 to 3 Nodes")
178+
err = cli.Shrink("/tiny0/rack0/node2")
179+
if err != nil {
180+
log.Fatalf("Error in ReapiClient Shrink: %s %s\n", err, cli.GetErrMsg())
181+
}
182+
fmt.Printf("Shrink request return value: %v\n", err)
183+
184+
fmt.Println("Asking to MatchSatisfy 4 nodes (again, not possible)")
185+
sat, overhead, err = cli.MatchSatisfy(growJobspec)
186+
checkErrors(cli)
187+
if err != nil {
188+
log.Fatalf("Error in ReapiClient MatchSatisfy: %v\n", err)
189+
}
190+
printSatOutput(sat, err)
191+
if sat {
192+
log.Fatalf("Error in ReapiClient MatchSatisfy - asking for 4 nodes with only 3 should fail: %v\n", err)
193+
}
194+
176195
}
177196

178197
func printOutput(reserved bool, allocated string, at int64, jobid uint64, err error) {

pkg/fluxcli/reapi_cli.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,26 @@ func (cli *ReapiClient) UpdateAllocate(jobid int, r string) (at int64, overhead
232232
func (cli *ReapiClient) Grow(rSubgraph string) (err error) {
233233
var resources = C.CString(rSubgraph)
234234
defer C.free(unsafe.Pointer(resources))
235-
236235
fluxerr := (int)(C.reapi_cli_grow((*C.struct_reapi_cli_ctx)(cli.ctx), resources))
237236
return retvalToError(fluxerr, "issue resource api client grow")
238237
}
239238

239+
// Update the resource state (shrink) with R_node_path.
240+
//
241+
// \param h Opaque handle. How it is used is an implementation
242+
// detail. However, when it is used within a Flux's
243+
// service module, it is expected to be a pointer
244+
// to a flux_t object.
245+
// \param R_node_path R String to prune down
246+
// \return 0 on success; -1 on error.
247+
// int reapi_cli_shrink (reapi_cli_ctx_t *ctx, const char *R_node_path);
248+
func (cli *ReapiClient) Shrink(rNodePath string) (err error) {
249+
var nodePath = C.CString(rNodePath)
250+
fluxerr := (int)(C.reapi_cli_shrink((*C.struct_reapi_cli_ctx)(cli.ctx), nodePath))
251+
defer C.free(unsafe.Pointer(nodePath))
252+
return retvalToError(fluxerr, "issue resource api client shrink")
253+
}
254+
240255
// Cancel cancels the allocation or reservation corresponding to jobid.
241256
//
242257
// \param jobid jobid of the uint64_t type.

0 commit comments

Comments
 (0)