-
Notifications
You must be signed in to change notification settings - Fork 0
187 lines (158 loc) · 5.51 KB
/
lstm_gru_pipeline.yaml
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: LSTM GRU Pipeline
on:
push:
branches:
- production
tags:
- '*'
schedule:
- cron: "0 11 * * *"
# 18 - 7 = 11
jobs:
extraction_train_modeling:
name: Data Extraction, Training, and Modeling
runs-on: ubuntu-latest
steps:
- name: Set global directory
run: git config --global --add safe.directory /github/workspace
- uses: actions/checkout@v3
with:
lfs: true
persist-credentials: false
fetch-depth: 1
- name: Read pipeline schedule date
id: read_schedule
run: |
SCHEDULE_DATE=$(cat schedulers/lstm_gru_schedule.ctl)
echo "schedule_date=${SCHEDULE_DATE}" >> $GITHUB_ENV
- name: Get current date
id: get_date
run: echo "current_date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Check if dates match
id: date_check
run: |
if [ "$schedule_date" = "$current_date" ]; then
echo "match=true" >> $GITHUB_ENV
else
echo "match=false" >> $GITHUB_ENV
fi
- name: Scraping Yahoo Finance
if: env.match != 'true'
run: |
mkdir datasets
wget https://raw.githubusercontent.com/tebakaja/tebakaja_cryptocurrency/production/postman/symbols.json \
-O postman/symbols.json
go run scraper.go
- name: Install Libraries
if: env.match != 'true'
run: pip install -r requirements.txt
- name: Modeling and Training
if: env.match != 'true'
run: |
mkdir models
mkdir pickles
mkdir posttrained
python training.py --algorithm=LSTM_GRU
- name: Set Pipeline Schedule
if: env.match != 'true'
run: echo "$(date +'%Y-%m-%d')" > schedulers/lstm_gru_schedule.ctl
- name: Zip Posttrained, Models, and Pickles
if: env.match != 'true'
run: |
zip -r models.zip models
zip -r pickles.zip pickles
zip -r datasets.zip datasets
zip -r posttrained.zip posttrained
- name: Store Datasets to Google Drive
if: env.match != 'true'
uses: adityak74/google-drive-upload-git-action@main
with:
credentials: ${{ secrets.GDRIVE_LSTM_GRU_CRED }}
filename: datasets.zip
folderId: ${{ secrets.GDRIVE_LSTM_GRU_ID }}
name: datasets.zip
overwrite: "true"
- name: Store Models to Google Drive
if: env.match != 'true'
uses: adityak74/google-drive-upload-git-action@main
with:
credentials: ${{ secrets.GDRIVE_LSTM_GRU_CRED }}
filename: models.zip
folderId: ${{ secrets.GDRIVE_LSTM_GRU_ID }}
name: models.zip
overwrite: "true"
- name: Store Pickles to Google Drive
if: env.match != 'true'
uses: adityak74/google-drive-upload-git-action@main
with:
credentials: ${{ secrets.GDRIVE_LSTM_GRU_CRED }}
filename: pickles.zip
folderId: ${{ secrets.GDRIVE_LSTM_GRU_ID }}
name: pickles.zip
overwrite: "true"
- name: Store Posttrained to Google Drive
if: env.match != 'true'
uses: adityak74/google-drive-upload-git-action@main
with:
credentials: ${{ secrets.GDRIVE_LSTM_GRU_CRED }}
filename: posttrained.zip
folderId: ${{ secrets.GDRIVE_LSTM_GRU_ID }}
name: posttrained.zip
overwrite: "true"
- name: Remove Temporarary Files and Directories
if: env.match != 'true'
run: |
rm models.zip
rm pickles.zip
rm datasets.zip
rm posttrained.zip
rm -rf models
rm -rf pickles
rm -rf datasets
rm -rf posttrained
- name: Commit changes
if: env.match != 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "belajarqywok"
git add -A
git commit -m "Data Extraction, Training, and Modeling"
- name: Push changes
if: env.match != 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: production
# model_deployment:
# name: Model Deployment
# runs-on: ubuntu-latest
# needs: extraction_train_modeling
# environment: Production
# env:
# HF_TOKEN: ${{ secrets.HF_TOKEN }}
# SPACE_NAME: cryptocurrency_prediction
# HF_USERNAME: qywok
# steps:
# - name: Set global directory
# run: git config --global --add safe.directory /github/workspace
# - uses: actions/checkout@v3
# with:
# persist-credentials: false
# fetch-depth: 1000
# - name: Check git status
# run: git status
# - name: Configure git
# run: |
# git config --local user.email "[email protected]"
# git config --local user.name "qywok"
# - name: Pull changes from remote
# run: |
# git pull https://$HF_USERNAME:[email protected]/spaces/$HF_USERNAME/$SPACE_NAME main || \
# (git merge --strategy-option theirs)
# - name: Add and commit changes
# run: |
# git add -A
# git diff-index --quiet HEAD || git commit -m "Model Deployment"
# - name: Push to Hugging Face
# run: |
# git push https://$HF_USERNAME:[email protected]/spaces/$HF_USERNAME/$SPACE_NAME main --force