-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
126 lines (100 loc) · 4.55 KB
/
Copy pathmakefile
File metadata and controls
126 lines (100 loc) · 4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Makefile for hpci
.PHONY: help
help: ## Display available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk \
'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
EXEC_COMMAND:=pwd
SCHEDULE_PBS_ARGS=--user pbsuser \
--host 127.0.0.1 \
--port 2222 \
--publicKey test_key.pub \
--privateKey test_key \
schedule \
--script ci/test_job.pbs \
--logFile test_job.log \
--scheduler-arg "-q workq" \
--scheduler-arg "-l 'walltime=01:30:00'" \
-c TEST_VAR1=success,TEST_VAR2=double_success
# --scheduler-arg "-N testjob" \
SCHEDULE_SLURM_ARGS=--user root \
--host 127.0.0.1 \
--port 2223 \
--publicKey test_key.pub \
--privateKey test_key \
schedule \
--scheduler slurm \
--script ci/test_job.slurm \
--logFile test_job.log \
--scheduler-arg "--partition=all" \
--scheduler-arg "--job-name='Build&Test'" \
-c TEST_VAR1=success,TEST_VAR2=double_success
EXEC_ARGS=--user pbsuser \
--host 127.0.0.1 \
--port 2222 \
--publicKey test_key.pub \
--privateKey test_key \
exec $(EXEC_COMMAND)
.PHONY: up-d
up-d: ## Run dockerised OpenPBS and Slurm containers (This requires creating an ssh key called `test_key` in the root of the `hpci` directory). Includes `--detach` flag so containers run in the background
docker compose -f ci/docker-compose.yml up -d
.PHONY: up
up: ## Run dockerised OpenPBS and Slurm containers (This requires creating an ssh key called `test_key` in the root of the `hpci` directory). Does not include `--detach` flag, so you can see container logs.
docker compose -f ci/docker-compose.yml up
.PHONY: interact-pbs
interact-pbs: ## Start interactive terminal access to running pbs docker container
docker exec -it --user pbsuser pbs bash
.PHONY: interact-slurm
interact-slurm: ## Start interactive terminal access to running slurm docker container
docker exec -it slurm bash
.PHONY: down
down: ## Stop the running docker container
docker compose -f ci/docker-compose.yml down
.PHONY: test
test: test-schedule test-exec ## Run tests for `schedule` (for both OpenPBS and Slurm) and `exec`. Requires `make up` first.
.PHONY: test-schedule
test-schedule: test-pbs-schedule test-slurm-schedule ## Run tests for `schedule` (for both OpenPBS and Slurm). Requires `make up` first.
.PHONY: test-pbs-schedule
test-pbs-schedule: ## Compile `hpci` and test the schedule command with dockerised OpenPBS (requires `make up` first)
cabal run exes -- $(SCHEDULE_PBS_ARGS)
.PHONY: test-slurm-schedule
test-slurm-schedule: ## Compile `hpci` and test the schedule command with dockerised Slurm (requires `make up` first)
cabal run exes -- $(SCHEDULE_SLURM_ARGS)
.PHONY: test-exec
test-exec: ## Compile `hpci` and test the exec command with dockerised OpenPBS (requires `make up` first)
cabal run exes -- $(EXEC_ARGS)
.PHONY: test-bin
test-bin: test-bin-schedule test-bin-exec # Run tests on binary
.PHONY: test-bin-schedule
test-bin-schedule: test-bin-pbs-schedule test-bin-slurm-schedule
.PHONY: test-bin-pbs-schedule
test-bin-pbs-schedule: ## Test `hpci` binary and test schedule command with dockerised OpenPBS (requires `make up`, and `make build-linux` first)
result/bin/hpci-exe $(SCHEDULE_PBS_ARGS)
.PHONY: test-bin-slurm-schedule
test-bin-slurm-schedule: ## Test `hpci` binary and test schedule command with dockerised Slurm (requires `make up`, and `make build-linux` first)
result/bin/hpci-exe $(SCHEDULE_SLURM_ARGS)
.PHONY: test-bin-exec
test-bin-exec: ## Test `hpci` binary and test exec command with dockerised OpenPBS (requires `make up`, and `make build-linux` first)
result/bin/hpci-exe $(EXEC_ARGS)
.PHONY: build-linux
build-linux: ## Build fully-static binary on linux x86_64
nix build .#packages.x86_64-linux.hpci
.PHONY: build-darwin
build-darwin: ## Build dynamically-linked binary on aarch64-darwin
cabal build
###### Not for general use ######
# The following commands do not appear in `make help` as they are not for general use
# They are used to develop, build and push docker images used in CI for testing `hpci`
# Also for pushing a binary to a cloud artifact registry
REGISTRY:=ghcr.io/garvan-data-science-platform/
IMAGE:=pbs
DOCKER_TAG:=$(REGISTRY)$(IMAGE):latest
.PHONY: docker
## Build a docker image. Only works on x86_64-linux.
docker:
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t $(DOCKER_TAG) -f ci/Dockerfile ci
.PHONY: pull
## Pull a docker image from artifact registry (useful on non-x86_64 machines).
pull:
docker pull --platform linux/amd64 $(DOCKER_TAG)