Skip to content

Commit a77ba46

Browse files
authored
wip: partial cancel (#16)
* wip: partial cancel The partial cancel request seems to work, but later when I try to do Info or Cancel (the regular cancel) for the job I get an error (I assume the job does not exist, but because of the bug with the error messages not passing forward I cannot see any further output for it). * test: improve testing setup for match and cancel Problem: the current testing is not standard for Go, and makes it hard to understand or run in units. Solution: move testing into proper test alongside package, and break apart testing for cancel and match. Additionally, we are using the same graphs / jobspecs from flux-sched. * extend tests to cancel job * docker: update image bases Problem: older bases do not have new enough gcc to build flux-sched. Signed-off-by: vsoch <vsoch@users.noreply.github.com>
1 parent bbe5b38 commit a77ba46

17 files changed

Lines changed: 5011 additions & 196 deletions

.github/workflows/build-deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/checkout@v4
2121
- uses: actions/setup-go@v4
2222
with:
23-
go-version: ^1.21
23+
go-version: ^1.22
2424
- name: GHCR Login
2525
if: (github.event_name != 'pull_request')
2626
uses: docker/login-action@v2

.github/workflows/main.yaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
# container base and lib prefix
24-
test: [["fluxrm/flux-sched:jammy", "/usr/lib"],
25-
["fluxrm/flux-sched:fedora38", "/usr/lib64"],
24+
test: [["fluxrm/flux-sched:noble", "/usr/lib"],
25+
["fluxrm/flux-sched:fedora40", "/usr/lib64"],
2626
["fluxrm/flux-sched:bookworm-amd64", "/usr/lib"],
27-
["fluxrm/flux-sched:el8", "/usr/lib64"]]
27+
["fluxrm/flux-sched:el9", "/usr/lib64"]]
2828

2929
container:
3030
image: ${{ matrix.test[0] }}
@@ -34,14 +34,15 @@ jobs:
3434
- name: Setup Go
3535
uses: actions/setup-go@v4
3636
with:
37-
go-version: ^1.21
37+
go-version: ^1.22
3838

39-
# 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
42-
- name: Build
43-
run: LIB_PREFIX=${{ matrix.test[1] }} make build
44-
- name: Test Binary
45-
run: LIB_PREFIX=${{ matrix.test[1] }} make test-binary
46-
- name: Test Modules
47-
run: make test-modules
40+
run: git clone https://github.com/flux-framework/flux-sched /opt/flux-sched
41+
# - name: build flux-sched
42+
# run: |
43+
# here=$(pwd)
44+
# cd /opt/flux-sched
45+
# mkdir build && cd build && cmake ../ && make -j && sudo make install
46+
# cd $here
47+
- name: Test
48+
run: LIB_PREFIX=${{ matrix.test[1] }} make test-v

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ RUN wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz && tar -xvf go${G
1414
ENV PATH=$PATH:/usr/local/go/bin:/home/vscode/go/bin
1515

1616
RUN git clone https://github.com/flux-framework/flux-sched /opt/flux-sched
17+
RUN cd /opt/flux-sched && \
18+
export FLUX_SCHED_VERSION=0.40.0 && \
19+
mkdir build && cd build && cmake ../ && make -j && sudo make install
1720

1821
# Assuming installing to /usr/local
1922
ENV LD_LIBRARY_PATH=/usr/lib:/usr/lib/flux:/usr/local/lib

Makefile

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ HERE ?= $(shell pwd)
22
LOCALBIN ?= $(shell pwd)/bin
33
JGF ?= $(HERE)/cmd/test/data/tiny.json
44
JOBSPECS ?= $(HERE)/cmd/test/data/jobspecs
5+
CANCELDATA ?= $(HERE)/cmd/test/data/cancel
56

67
# This assumes a build in the .devcontainer Dockerfile environment
78
FLUX_SCHED_ROOT ?= /opt/flux-sched
@@ -17,43 +18,22 @@ LD_LIBRARY_PATH=$(LIB_PREFIX):$(LIB_PREFIX)/flux
1718
BUILDENVVAR=CGO_CFLAGS="-I${FLUX_SCHED_ROOT} -I${FLUX_SCHED_ROOT}/resource/reapi/bindings/c" CGO_LDFLAGS="-L${LIB_PREFIX} -L${LIB_PREFIX}/flux -L${FLUX_SCHED_ROOT}/resource/reapi/bindings -lreapi_cli -lflux-idset -lstdc++ -ljansson -lhwloc -lflux-hostlist -lboost_graph -lyaml-cpp"
1819

1920
.PHONY: all
20-
all: build
21+
all: test
2122

2223
.PHONY: test
23-
test: test-binary test-modules
24-
25-
.PHONY: test-modules
26-
test-modules:
27-
go test -v ./pkg/types
28-
29-
.PHONY: test-binary
30-
test-binary:
31-
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) $(LOCALBIN)/test --jgf=$(JGF) --jobspec=$(JOBSPECS)/test001.yaml
32-
33-
# test001_desc="match allocate 1 slot: 1 socket: 1 core (pol=default)"
34-
# test_expect_success "${test001_desc}" '
35-
# ${main} --jgf=${jgf} --jobspec=${jobspec1} > 001.R.out &&
36-
# sed -i -E "s/, 0\.[0-9]+//g" 001.R.out &&
37-
# test_cmp 001.R.out ${exp_dir}/001.R.out
38-
#'
39-
40-
#test002_desc="match allocate 2 slots: 2 sockets: 5 cores 1 gpu 6 memory"
41-
#test_expect_success "${test002_desc}" '
42-
# ${main} --jgf=${jgf} --jobspec=${jobspec2} > 002.R.out &&
43-
# sed -i -E "s/, 0\.[0-9]+//g" 002.R.out &&
44-
# test_cmp 002.R.out ${exp_dir}/002.R.out
45-
#'
24+
test:
25+
# $(COMMONENVVAR) $(BUILDENVVAR) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) go test -count 1 -run TestCancel -ldflags '-w' ./pkg/fluxcli ./pkg/types
26+
$(COMMONENVVAR) $(BUILDENVVAR) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) go test -ldflags '-w' ./pkg/fluxcli ./pkg/types
27+
28+
.PHONY: test-v
29+
test-v:
30+
# $(COMMONENVVAR) $(BUILDENVVAR) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) go test -count 1 -run TestCancel -v -ldflags '-w' ./pkg/fluxcli ./pkg/types
31+
$(COMMONENVVAR) $(BUILDENVVAR) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) go test -v -ldflags '-w' ./pkg/fluxcli ./pkg/types
4632

4733
.PHONY: $(LOCALBIN)
4834
$(LOCALBIN):
4935
mkdir -p $(LOCALBIN)
5036

51-
# This serves as a single test file to build a dummy main to test
52-
.PHONY: build $(LOCALBIN)
53-
build:
54-
mkdir -p $(LOCALBIN)
55-
$(COMMONENVVAR) $(BUILDENVVAR) go build -ldflags '-w' -o $(LOCALBIN)/test cmd/test/test.go
56-
5737
.PHONY: clean
5838
clean:
5939
rm -rf $(LOCALBIN)/test

cmd/test/test.go

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)