-
Notifications
You must be signed in to change notification settings - Fork 141
/
.make.workflows
71 lines (56 loc) · 2.98 KB
/
.make.workflows
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
# Include the common rules.
# Use "make help" to see them.
include ${REPOROOT}/.make.defaults
USE_DEV_IMAGES ?= 1
define set_env_var
$(eval export $(1)=$(2))
endef
KFP_ENDPOINT?="http://localhost:8080/"
.PHONY: set-versions
set-versions:
cd ${REPOROOT}/kfp/kfp_ray_components && $(MAKE) set-versions
@for file in $(PYTHON_WF); do \
cd ${REPOROOT}/kfp/kfp_ray_components && $(MAKE) .reconcile-requirements FILE=${CURDIR}/$$file; \
${REPOROOT}/scripts/transforms/update_workflow_tags.sh ${REPOROOT}/.make.versions ${CURDIR}/$$file ${DOCKER_IMAGE_VERSION}; \
done
.PHONY: .workflows.compile-pipeline
.workflows.compile-pipeline:
$(MAKE) -C ${REPOROOT}/kfp/kfp_ray_components set-versions
. ${WORKFLOW_VENV_ACTIVATE} && ${PYTHON} ${WF_NAME}.py
KFP_SHARED_LIB_SRC_FILES := $(shell find ${REPOROOT}/kfp/kfp_support_lib/shared_workflow_support/ \( -name '*.py' -o -name '*.toml' \))
KFP_LIB_SRC_FILES := $(shell find ${REPOROOT}/kfp/kfp_support_lib/${WORKFLOW_SUPPORT_LIB}/ \( -name '*.py' -o -name '*.toml' \))
KFP_LIB_CONFIG_FILE := ${REPOROOT}/kfp/kfp_support_lib/${WORKFLOW_SUPPORT_LIB}/pyproject.toml
FORCE:
%.yaml: %.py FORCE
$(MAKE) set-versions PIPELINE_FILE=$<
$(MAKE) .workflows.compile-pipeline WF_NAME=$(shell (basename $< .py))
.PHONY: .workflows.test-pipeline
.workflows.test-pipeline:
@# Help: upload and run the workflow. Set export USE_DEV_IMAGES=0 to use release docker image versions.
$(call set_env_var, CLUSTER_EXISTS, $(shell kind get clusters | grep ${KIND_CLUSTER_NAME}))
@if [ -z ${CLUSTER_EXISTS} ]; then \
cd ${REPOROOT} && make -C scripts/k8s-setup setup; \
fi
ifeq ($(USE_DEV_IMAGES), 1)
cd ${TRANSFORM_SRC} && $(MAKE) image && $(MAKE) kind-load-image
cd ${REPOROOT}/kfp/kfp_ray_components && $(MAKE) image && $(MAKE) kind-load-image
endif
. ${WORKFLOW_VENV_ACTIVATE} && ${PYTHON} -m workflow_support.pipeline_utils.pipelines_tests_utils -c "sanity-test" -p ${CURDIR}/${PIPELINE_FILE} -e ${KFP_ENDPOINT}
${WORKFLOW_VENV_ACTIVATE}: ${REPOROOT}/.make.versions ${REPOROOT}/kfp/kfp_ray_components/requirements.txt ${DPK_RAY_LIB_DIR} ${KFP_LIB_SRC_FILES} ${KFP_LIB_CONFIG_FILE} ${KFP_SHARED_LIB_SRC_FILES}
rm -rf ${REPOROOT}/transforms/venv
$(MAKE) -C ${REPOROOT}/transforms .defaults.kfp-venv
. ${WORKFLOW_VENV_ACTIVATE}; \
pip install -e $(REPOROOT)/kfp/kfp_support_lib/shared_workflow_support; \
pip install -e $(REPOROOT)/kfp/kfp_support_lib/$(WORKFLOW_SUPPORT_LIB); \
$(MAKE) -C ${REPOROOT}/kfp/kfp_ray_components set-versions; \
pip install jinja2; \
pip install pyyaml; \
pip install pre-commit
@# Help: Create the virtual environment common to all workflows
.PHONY: .workflows.upload-pipeline
.workflows.upload-pipeline:
$(call set_env_var, CLUSTER_EXISTS, $(shell kind get clusters | grep ${KIND_CLUSTER_NAME}))
@if [ -z ${CLUSTER_EXISTS} ]; then \
cd ${REPOROOT} && make setup; \
fi
. ${WORKFLOW_VENV_ACTIVATE} && ${PYTHON} -m workflow_support.pipeline_utils.pipelines_tests_utils -c "upload" -p ${CURDIR}/${PIPELINE_FILE} -e ${KFP_ENDPOINT}