-
Notifications
You must be signed in to change notification settings - Fork 448
/
Jenkinsfile
81 lines (80 loc) · 3.18 KB
/
Jenkinsfile
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
pipeline {
agent any
parameters {
choice(name: 'problem_name', choices: ['houses', 'groceries', 'iris'], description: 'Choose the problem name')
string(name: 'ml_pipeline_params_name', defaultValue: 'default', description: 'Specify the ml_pipeline_params file')
string(name: 'feature_set_name', defaultValue: 'default', description: 'Specify the feature_set name/file')
string(name: 'algorithm_name', defaultValue: 'default', description: 'Specify the algorithm (overrides problem_params)')
string(name: 'algorithm_params_name', defaultValue: 'default', description: 'Specify the algorithm params')
}
triggers {
// Poll SCM every minute for new changes
pollSCM('* * * * *')
}
options {
// add timestamps to output
timestamps()
}
environment {
MLFLOW_TRACKING_URL = 'http://mlflow:5000'
MLFLOW_S3_ENDPOINT_URL = 'http://minio:9000'
AWS_ACCESS_KEY_ID = "${env.ACCESS_KEY}"
AWS_SECRET_ACCESS_KEY = "${env.SECRET_KEY}"
}
stages {
stage('Install dependencies') {
steps {
sh 'pip3 install -r requirements.txt'
}
}
stage('Run tests') {
steps {
sh './run_tests.sh'
}
}
stage('Run ML pipeline') {
steps {
sh 'python3 run_python_script.py pipeline ${problem_name} ${ml_pipeline_params_name} ${feature_set_name} ${algorithm_name} ${algorithm_params_name}'
}
}
stage('Production - Register Model and Acceptance Test') {
when {
allOf {
equals expected: 'default', actual: "${params.ml_pipeline_params_name}"
equals expected: 'default', actual: "${params.feature_set_name}"
equals expected: 'default', actual: "${params.algorithm_name}"
equals expected: 'default', actual: "${params.algorithm_params_name}"
}
}
steps {
sh 'python3 run_python_script.py acceptance'
}
post {
success {
sh 'python3 run_python_script.py register_model ${MLFLOW_TRACKING_URL} yes'
}
failure {
sh 'python3 run_python_script.py register_model ${MLFLOW_TRACKING_URL} no'
}
}
}
stage('Experiment - Register Model and Acceptance Test') {
when {
anyOf {
not { equals expected: 'default', actual: "${params.ml_pipeline_params_name}" }
not { equals expected: 'default', actual: "${params.feature_set_name}"}
not { equals expected: 'default', actual: "${params.algorithm_name}"}
not { equals expected: 'default', actual: "${params.algorithm_params_name}"}
}
}
steps {
sh '''
set +e
python3 run_python_script.py acceptance
set -e
'''
sh 'python3 run_python_script.py register_model ${MLFLOW_TRACKING_URL} no'
}
}
}
}