Skip to content

Commit 07160b0

Browse files
committed
Update examples to use NnfPodSpecs instead of core PodSpecs
Container Profiles have been recently updated to remove PodSpecs from the CRD to reduce the overall size of the CRD. In its place, a slim NnfPodSpec is now being used. Update the examples to use this new format and ensure this is up to date in general. Signed-off-by: Blake Devcich <blake.devcich@hpe.com>
1 parent 14aaafe commit 07160b0

4 files changed

Lines changed: 64 additions & 73 deletions

File tree

README.md

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ application.
3636
Any container image that is built must be available in an image registry that is available on your
3737
cluster. See your cluster administrator for more details.
3838

39-
In this example, we're using the GitHut Container Registry (ghcr.io), so your cluster must have internet access to retrieve the image.
39+
In this example, we're using the GitHub Container Registry (ghcr.io), so your cluster must have internet access to retrieve the image.
4040

4141
#### MPI Applications
4242

@@ -65,11 +65,12 @@ run your application.
6565
### Storages
6666

6767
In this example, we are expecting to have 1 non-optional storage called `DW_JOB_my_storage`. If the
68-
storage is persistent storage, then it must start with `DW_PERSISTENT` rather than `DW_JOB`. Filesystem types are not defined here, but later in the DW directive.
68+
storage is persistent storage, then it must start with `DW_PERSISTENT` rather than `DW_JOB`.
69+
Filesystem types are not defined here, but later in the DW directive.
6970

7071
```yaml
7172
---
72-
apiVersion: nnf.cray.hpe.com/v1alpha6
73+
apiVersion: nnf.cray.hpe.com/v1alpha7
7374
kind: NnfContainerProfile
7475
metadata:
7576
name: demo
@@ -88,7 +89,7 @@ Next, we define the container specification. For MPI applications, this is done
8889
`mpiSpec` allows us to define the Launcher and Worker containers.
8990

9091
```yaml
91-
apiVersion: nnf.cray.hpe.com/v1alpha6
92+
apiVersion: nnf.cray.hpe.com/v1alpha7
9293
kind: NnfContainerProfile
9394
metadata:
9495
name: demo
@@ -98,50 +99,41 @@ data:
9899
- name: DW_JOB_my_storage
99100
optional: false
100101
mpiSpec:
101-
mpiReplicaSpecs:
102-
Launcher:
103-
template:
104-
spec:
105-
containers:
106-
- name: nnf-container-example
107-
image: ghcr.io/nearnodeflash/nnf-container-example:master
108-
command:
109-
- mpirun
110-
- --tag-output
111-
- mpi_hello_world
112-
- "$(DW_JOB_my_storage)"
113-
Worker:
114-
template:
115-
spec:
116-
containers:
117-
- name: nnf-container-example
118-
image: ghcr.io/nearnodeflash/nnf-container-example:master
102+
launcher:
103+
containers:
104+
- name: nnf-container-example
105+
image: ghcr.io/nearnodeflash/nnf-container-example:master
106+
command:
107+
- mpirun
108+
- --tag-output
109+
- mpi_hello_world
110+
- "$(DW_JOB_my_storage)"
111+
worker:
112+
containers:
113+
- name: nnf-container-example
114+
image: ghcr.io/nearnodeflash/nnf-container-example:master
119115
```
120116

121-
Both the `Launcher` and `Worker` must be defined. The main pieces here are to set the images for both
122-
and the command for the `Launcher`. Boiled down, these are just Kubernetes [PodTemplateSpecs](https://pkg.go.dev/k8s.io/api/core/v1#PodTemplateSpec).
117+
Both the `Launcher` and `Worker` must be defined. The main pieces here are to set the name and
118+
images for both and the command for the `Launcher`. Boiled down, these are simplified versions of
119+
Kubernetes [PodSpec](https://pkg.go.dev/k8s.io/api/core/v1#PodSpec).
123120

124121
The container image tag may need to be changed from "master" to match the tag for your build.
125122

126123
Our `mpi_hello_world` application takes in a command line argument for the storage file path. We are
127124
using the name of the storage we defined above in the `storages` object to pass into our command:
128125

129126
```yaml
130-
command:
131-
- mpirun
132-
- mpi_hello_world
133-
- "$(DW_JOB_my_storage)"
127+
command:
128+
- mpirun
129+
- mpi_hello_world
130+
- "$(DW_JOB_my_storage)"
134131
```
135132

136-
For the full definition of the `MPIJobSpec` provided by `mpi-operator`, see the definition
137-
[here](https://pkg.go.dev/github.com/lukwil/mpi-operator/pkg/apis/kubeflow/v1#MPIJobSpec). However,
138-
some of these values are overridden by NNF software and not all configurable options have been
139-
tested.
140-
141133
For a full understanding of the other options in an NNF Container Profile, see the nnf-sos
142-
[samples](https://github.com/NearNodeFlash/nnf-sos/blob/master/config/samples/nnf_v1alpha1_nnfcontainerprofile.yaml)
143-
and
144-
[examples](https://github.com/NearNodeFlash/nnf-sos/blob/master/config/examples/nnf_v1alpha1_nnfcontainerprofiles.yaml).
134+
[examples](https://github.com/NearNodeFlash/nnf-sos/blob/master/config/examples/nnf_nnfcontainerprofiles.yaml)
135+
and the [type
136+
definitions](https://github.com/NearNodeFlash/nnf-sos/blob/master/api/v1alpha7/nnfcontainerprofile_types.go).
145137

146138
## Creating a DW Container Workflow
147139

@@ -158,7 +150,9 @@ First, we'll create the storage. We will be using GFS2 for the filesystem:
158150
#DW jobdw name=demo-gfs2 type=gfs2 capacity=50GB
159151
```
160152

161-
Then, define the container. Note the `DW_JOB_my_storage=demo-gfs2` argument matches what is in the NNF Container Profile and maps it to the name of the GFS2 filesystem created in the DW Directive above.
153+
Then, define the container. Note the `DW_JOB_my_storage=demo-gfs2` argument matches what is in the
154+
NNF Container Profile and maps it to the name of the GFS2 filesystem created in the DW Directive
155+
above.
162156

163157
```none
164158
#DW container name=demo-container profile=demo DW_JOB_my_storage=demo-gfs2
@@ -170,7 +164,8 @@ Then, define the container. Note the `DW_JOB_my_storage=demo-gfs2` argument matc
170164
the manual way of doing things. You may want to consult a Flux expert on how to drive a container
171165
workflow using Flux.
172166

173-
With a working Kubernetes cluster, the previous examples can be put together and deployed on the system. The files in this repository have done that.
167+
With a working Kubernetes cluster, the previous examples can be put together and deployed on the
168+
system. The files in this repository have done that.
174169

175170
### Create the Profile and Workflow
176171

@@ -218,7 +213,7 @@ kubectl patch --type merge workflow demo-container --patch '{"spec": {"desiredSt
218213
```
219214

220215
```shell
221-
kubectl get workflows
216+
$ kubectl get workflows
222217
NAME STATE READY STATUS AGE
223218
demo-container Setup true Completed 12m
224219
```
@@ -250,7 +245,7 @@ demo-container-worker-0 1/1 Running 0 5s
250245
demo-container-worker-1 1/1 Running 0 5s
251246
```
252247

253-
You can use kubectl to inspect the log to get your application's output:
248+
You can use `kubectl` to inspect the log to get your application's output:
254249

255250
```shell
256251
$ kubectl logs demo-container-launcher-wcvcs

allocation-computes.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
data:
2-
- name: "compute-01"
3-
- name: "compute-02"
4-
- name: "compute-03"
5-
- name: "compute-04"
2+
- name: "rabbit-compute-2"
3+
- name: "rabbit-compute-3"
4+
- name: "rabbit-compute-4"
5+
- name: "rabbit-compute-5"

allocation-servers.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ spec:
44
label: gfs2
55
storage:
66
- name: rabbit-node-1
7-
allocationCount: 1
7+
allocationCount: 2
88
- name: rabbit-node-2
9-
allocationCount: 1
9+
allocationCount: 2

nnf-container-example.yaml

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
apiVersion: nnf.cray.hpe.com/v1alpha6
2+
apiVersion: nnf.cray.hpe.com/v1alpha7
33
kind: NnfContainerProfile
44
metadata:
55
name: demo
@@ -11,30 +11,26 @@ data:
1111
# $NNF_CONTAINER_PORTS can be used to get the port number(s)
1212
numPorts: 1
1313
mpiSpec:
14-
mpiReplicaSpecs:
15-
Launcher:
16-
template:
17-
spec:
18-
containers:
19-
- name: nnf-container-example
20-
image: ghcr.io/nearnodeflash/nnf-container-example:master
21-
command:
22-
- mpirun
23-
- --tag-output
24-
- mpi_hello_world
25-
- "$(DW_JOB_my_storage)"
26-
# An example webserver can be started using python
27-
# - mpirun
28-
# - python3
29-
# - -m
30-
# - http.server
31-
# - $(NNF_CONTAINER_PORTS)
32-
Worker:
33-
template:
34-
spec:
35-
containers:
36-
- name: nnf-container-example
37-
image: ghcr.io/nearnodeflash/nnf-container-example:master
14+
launcher:
15+
containers:
16+
- name: nnf-container-example
17+
image: ghcr.io/nearnodeflash/nnf-container-example:master
18+
command:
19+
- mpirun
20+
- --tag-output
21+
- mpi_hello_world
22+
- "$(DW_JOB_my_storage)"
23+
# An example webserver can be started using python
24+
# - mpirun
25+
# - python3
26+
# - -m
27+
# - http.server
28+
# - $(NNF_CONTAINER_PORTS)
29+
worker:
30+
containers:
31+
- name: nnf-container-example
32+
image: ghcr.io/nearnodeflash/nnf-container-example:master
33+
# command isn't needed here since the image's entrypoint is sufficient
3834
retryLimit: 2
3935
---
4036
apiVersion: dataworkflowservices.github.io/v1alpha3
@@ -48,7 +44,7 @@ spec:
4844
- "#DW jobdw name=demo-gfs2 type=gfs2 capacity=50GB"
4945
- "#DW container name=demo-container profile=demo \
5046
DW_JOB_my_storage=demo-gfs2"
51-
wlmID: "Bubbly WLM"
52-
jobID: "bubbles 900001"
47+
wlmID: "flux"
48+
jobID: "fPxk8Hj4C1V"
5349
userID: 1050
5450
groupID: 1051

0 commit comments

Comments
 (0)