-
Notifications
You must be signed in to change notification settings - Fork 1
160 lines (139 loc) · 6.46 KB
/
ml_workflow.yml
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# This is a basic workflow to help you get started with Actions
name: ML Workflow
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Base workflow:
# workflow_2_0_0_node: workflow|workflow|2.0.0|5594a17a-d1df-4aff-adeb-d5e38eab7e65
# Workflow w/ feature engineering:
# workflow_2_1_0_node: workflow|workflow|2.0.0|22414c60-a10d-474b-9bf2-824c821ea2d8
# Workflow w/ feature engineering & responsible AI:
# workflow_2_2_0_node: workflow|workflow|2.0.0|42804cf5-cd45-4a50-ad64-ea0150b9e494
# Workflow w/ feature engineering & responsible AI & kf_serving:
# workflow_2_3_0_node: workflow|workflow|2.0.0|e9e3b723-a337-4de9-a221-03dfd178a6ad
env:
WORKFLOW_NODE_ID: 'workflow|workflow|2.0.0|e9e3b723-a337-4de9-a221-03dfd178a6ad'
SCHEMAS_GIT_URL: https://github.com/mlspec/mlspeclib-action-samples-schemas.git
SCHEMAS_DIRECTORY: .parameters/schemas
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "run_full_workflow"
run_full_workflow:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# - name: Debugging with tmate
# uses: mxschmitt/action-tmate@v2
- name: Output all pip packages
id: output_all_pip_packages
run: |
pip freeze > ~/prev_installed_requirements.txt
- name: Cache Pip Installation
uses: actions/cache@v2
env:
cache-name: cache-python36-pip
with:
path: ~/.local
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('~/prev_installed_requirements.txt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup Environment
id: setup_environment
run: |
python3 -m pip install -U setuptools wheel pip
python3 -m pip install -r requirements.txt
python3 -m pip install flake8
python3 -m pip install ipython
python3 -m pip install jupyter
python3 -m pip install nbconvert
- name: Lint checked in code files
id: python_linting
run: |
python3 -m flake8 src --count --config=.flake8 --show-source --statistics
- name: Convert Notebook to Script
id: convert_notebook_production_folder_to_script
run: |
python3 -m nbconvert notebooks/production/*.ipynb --config notebooks/nbconvert_config.py
cp notebooks/production/*.py src/train
cp notebooks/production/*.json data/raw
cp notebooks/production/*.hdf5 data/raw
- name: Run Unit Tests
id: python_unit_tests
run: |
python3 -m unittest discover -s src -p 'test_*.py'
- name: MLSpec Action - Process Data
id: process_data
uses: mlspec/[email protected]
with:
METASTORE_CREDENTIALS: ${{ secrets.METASTORE_CREDENTIALS_PROD }}
SCHEMAS_DIRECTORY: '${{ env.SCHEMAS_DIRECTORY }}'
SCHEMAS_GIT_URL: '${{ env.SCHEMAS_GIT_URL }}'
WORKFLOW_NODE_ID: '${{ env.WORKFLOW_NODE_ID }}'
STEP_NAME: process_data
NEXT_STEP_NAME: train
INPUT_PARAMETERS_FILE_PATH: ${{ github.workspace }}/.parameters/process_data/input.yaml
EXECUTION_PARAMETERS_FILE_PATH: ${{ github.workspace }}/.parameters/process_data/execution.yaml
EXECUTION_FILE: ${{ github.workspace }}/src/process_data/process_data.py
- name: MLSpec Action - Feature Engineering
id: feature_engineering
uses: mlspec/[email protected]
with:
METASTORE_CREDENTIALS: ${{ secrets.METASTORE_CREDENTIALS_PROD }}
SCHEMAS_DIRECTORY: '${{ env.SCHEMAS_DIRECTORY }}'
SCHEMAS_GIT_URL: '${{ env.SCHEMAS_GIT_URL }}'
WORKFLOW_NODE_ID: '${{ env.WORKFLOW_NODE_ID }}'
STEP_NAME: feature_engineering
PREVIOUS_STEP_NAME: process_data
NEXT_STEP_NAME: train
INPUT_PARAMETERS_BASE64: ${{ steps.process_data.outputs.output_base64_encoded }}
EXECUTION_PARAMETERS_FILE_PATH: ${{ github.workspace }}/.parameters/feature_engineering/execution.yaml
EXECUTION_FILE: ${{ github.workspace }}/src/feature_engineering/feature_engineering.py
- name: MLSpec Action - Train
id: train
uses: mlspec/[email protected]
with:
METASTORE_CREDENTIALS: ${{ secrets.METASTORE_CREDENTIALS_PROD }}
SCHEMAS_DIRECTORY: '${{ env.SCHEMAS_DIRECTORY }}'
SCHEMAS_GIT_URL: '${{ env.SCHEMAS_GIT_URL }}'
WORKFLOW_NODE_ID: '${{ env.WORKFLOW_NODE_ID }}'
STEP_NAME: train
PREVIOUS_STEP_NAME: feature_engineering
NEXT_STEP_NAME: package
INPUT_PARAMETERS_BASE64: ${{ steps.feature_engineering.outputs.output_base64_encoded }}
EXECUTION_PARAMETERS_FILE_PATH: ${{ github.workspace }}/.parameters/train/execution.yaml
EXECUTION_FILE: ${{ github.workspace }}/src/train/train.py
- name: MLSpec Action - Package
id: package
uses: mlspec/[email protected]
with:
METASTORE_CREDENTIALS: ${{ secrets.METASTORE_CREDENTIALS_PROD }}
SCHEMAS_DIRECTORY: '${{ env.SCHEMAS_DIRECTORY }}'
SCHEMAS_GIT_URL: '${{ env.SCHEMAS_GIT_URL }}'
WORKFLOW_NODE_ID: '${{ env.WORKFLOW_NODE_ID }}'
STEP_NAME: package
PREVIOUS_STEP_NAME: train
INPUT_PARAMETERS_BASE64: ${{ steps.train.outputs.output_base64_encoded }}
EXECUTION_PARAMETERS_FILE_PATH: ${{ github.workspace }}/.parameters/package/execution.yaml
EXECUTION_FILE: ${{ github.workspace }}/src/package/package.py
- name: MLSpec Action - Serve
id: Serve
uses: mlspec/[email protected]
with:
METASTORE_CREDENTIALS: ${{ secrets.METASTORE_CREDENTIALS_PROD }}
SCHEMAS_DIRECTORY: '${{ env.SCHEMAS_DIRECTORY }}'
SCHEMAS_GIT_URL: '${{ env.SCHEMAS_GIT_URL }}'
WORKFLOW_NODE_ID: '${{ env.WORKFLOW_NODE_ID }}'
STEP_NAME: serve
PREVIOUS_STEP_NAME: package
INPUT_PARAMETERS_BASE64: ${{ steps.package.outputs.output_base64_encoded }}
EXECUTION_PARAMETERS_FILE_PATH: ${{ github.workspace }}/.parameters/serve/execution.yaml
EXECUTION_FILE: ${{ github.workspace }}/src/serve/serve.py