Skip to content

Commit 1cd3efe

Browse files
Move all versions into sub-paths
1 parent 5934fd3 commit 1cd3efe

File tree

11 files changed

+68
-42
lines changed

11 files changed

+68
-42
lines changed

Diff for: k8/Makefile

+54-32
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,51 @@
1-
all: images
21

3-
PYTHON_PACKAGE_VERSION := 1.1.3
2+
PYTHON_PACKAGE_VERSION := $(shell python -c 'import record_api; print(record_api.__version__)')
43

5-
BASE_BUILD_TAG := 1.1.3
6-
BASE_USE_TAG := 1.1.3
7-
8-
TAG := 1.1.3
4+
$(info Python package version = ${PYTHON_PACKAGE_VERSION})
95

106
IMAGE := saulshanabrook/python-record-api
117

12-
IMAGES := dask matplotlib pandas sample-usage skimage sklearn xarray
8+
# The tag for base image is base-{python version}-{version-increment}
9+
# The tag for other versions are {name}-{python version}-{base version increment}-{version increment}
10+
# So that if the python version is updated, all are rebuilt, and if the base version is updated, all are also rebuilt.
11+
12+
version = $(shell cat images/$(1)/version)
13+
14+
15+
BASE_IMAGE := ${IMAGE}:base-${PYTHON_PACKAGE_VERSION}-$(call version,base)
16+
17+
$(info Base image = ${BASE_IMAGE})
18+
19+
sub_tag = $(1)-${PYTHON_PACKAGE_VERSION}-$(call version,base)-$(call version,$(1))
20+
sub_image = ${IMAGE}:$(call sub_tag,$(1))
21+
22+
WORKFLOW_VERSION := $(shell cat argo/version)
23+
$(info Workflow version = ${WORKFLOW_VERSION})
24+
25+
workflow_name = $(call sub_tag,$(1))-${WORKFLOW_VERSION}
26+
27+
IMAGES := $(sort $(filter-out base,$(notdir $(wildcard images/*))))
28+
29+
$(info Names = ${IMAGES})
30+
31+
$(info )
32+
# ARGO_SUBMITTED_WORKFLOWS := $(shell argo list -o name)
33+
34+
# # loop through images, any which have a workflow that is in argos submitted workflows should be notadd
35+
# # if they are not in there, they should be added
36+
37+
# NOT_SUBMITTED_IMAGES := $(foreach \
38+
# name,\
39+
# $(IMAGES),\
40+
# $(if \
41+
# $(findstring \
42+
# $(call workflow_name,${name}),\
43+
# ${ARGO_SUBMITTED_WORKFLOWS}\
44+
# ),\
45+
# ,\
46+
# ${name}\
47+
# )
48+
# )
1349

1450
all: $(addprefix ../data/api/,$(addsuffix .json,$(IMAGES)))
1551

@@ -30,24 +66,16 @@ all: $(addprefix ../data/api/,$(addsuffix .json,$(IMAGES)))
3066
argo-submit: $(addprefix argo-submit-,$(IMAGES))
3167

3268
argo-submit-%:
33-
-argo delete record-$(*F)
34-
# Wait for pod to be deleted before re-creating
35-
sleep 10
36-
argo submit \
37-
--from workflowtemplate/python-record-api \
69+
-argo submit \
70+
argo/workflow.yml \
3871
-p label="$(*F)" \
39-
-p tag="$(TAG)" \
40-
-p image="$(IMAGE)" \
41-
-p base-tag="$(BASE_USE_TAG)" \
42-
--name 'record-$(*F)'
43-
44-
45-
argo-workflow-submit:
46-
-argo template delete python-record-api
47-
argo template create workflow-template.yml
72+
-p base-image="$(BASE_IMAGE)" \
73+
-p image="$(call sub_image,$(*F))" \
74+
--name "$(call workflow_name,$(*F))"
4875

4976

5077
push-images: docker-bake.json
78+
docker buildx bake base --push
5179
docker buildx bake --push
5280

5381

@@ -67,7 +95,7 @@ define JQ_DOCKER_BAKE
6795
{
6896
group: {
6997
default: {
70-
targets: (["base"] + ($$ARGS.positional))
98+
targets: ($$ARGS.positional)
7199
}
72100
},
73101
target: (
@@ -79,7 +107,7 @@ define JQ_DOCKER_BAKE
79107
PYTHON_PACKAGE_VERSION: "${PYTHON_PACKAGE_VERSION}"
80108
},
81109
tags: [
82-
"${IMAGE}:base-${BASE_BUILD_TAG}"
110+
"${BASE_IMAGE}"
83111
]
84112
}
85113
} +
@@ -91,10 +119,10 @@ define JQ_DOCKER_BAKE
91119
context: ("images/" + .),
92120
dockerfile: "Dockerfile",
93121
args: {
94-
FROM: "${IMAGE}:base-${BASE_USE_TAG}"
122+
FROM: "${BASE_IMAGE}"
95123
},
96124
tags: [
97-
("${IMAGE}:" + . + "-${TAG}")
125+
($$ARGS.named[(.)])
98126
]
99127
}
100128
}
@@ -110,12 +138,6 @@ export JQ_DOCKER_BAKE
110138
docker-bake.json: Makefile
111139
jq "$$JQ_DOCKER_BAKE" \
112140
--null-input \
141+
$(foreach name,$(IMAGES),--arg $(name) $(call sub_image,$(name))) \
113142
--args $(IMAGES) \
114143
> $@
115-
116-
117-
port-forward:
118-
kubectl -n argo port-forward deployment/argo-server 2746:2746
119-
120-
set-namespace:
121-
kubectl config set-context --current --namespace=argo

Diff for: k8/argo/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

Diff for: k8/workflow-template.yml renamed to k8/argo/workflow.yml

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# https://argoproj.github.io/argo/fields/
22
apiVersion: argoproj.io/v1alpha1
3-
kind: WorkflowTemplate
4-
metadata:
5-
name: python-record-api
6-
generateName: record-
3+
kind: Workflow
74
spec:
85
podGC:
96
strategy: OnWorkflowSuccess
@@ -12,9 +9,7 @@ spec:
129
parameters:
1310
- name: label
1411
value: "..."
15-
- name: tag
16-
value: "..."
17-
- name: base-tag
12+
- name: base-image
1813
value: "..."
1914
- name: image
2015
value: "..."
@@ -38,7 +33,7 @@ spec:
3833

3934
- name: record-api
4035
container:
41-
image: "{{workflow.parameters.image}}:{{workflow.parameters.label}}-{{workflow.parameters.tag}}"
36+
image: "{{workflow.parameters.image}}"
4237
env:
4338
- name: PYTHON_RECORD_API_OUTPUT_FILE
4439
value: /tmp/raw.jsonl
@@ -68,7 +63,7 @@ spec:
6863
- name: grouped
6964
path: /tmp/grouped.jsonl
7065
container:
71-
image: "{{workflow.parameters.image}}:base-{{workflow.parameters.base-tag}}"
66+
image: "{{workflow.parameters.base-image}}"
7267
command: [python, -m, record_api.line_counts]
7368
env:
7469
- name: PYTHON_RECORD_API_INPUT
@@ -93,7 +88,7 @@ spec:
9388
- name: api
9489
path: /tmp/api.json
9590
container:
96-
image: "{{workflow.parameters.image}}:base-{{workflow.parameters.base-tag}}"
91+
image: "{{workflow.parameters.base-image}}"
9792
command: [python, -m, record_api.infer_apis]
9893
env:
9994
- name: PYTHON_RECORD_API_LABEL

Diff for: k8/images/base/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

Diff for: k8/images/dask/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

Diff for: k8/images/matplotlib/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

Diff for: k8/images/pandas/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

Diff for: k8/images/sample-usage/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

Diff for: k8/images/skimage/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

Diff for: k8/images/sklearn/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

Diff for: k8/images/xarray/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

0 commit comments

Comments
 (0)