This commit is contained in:
Artur Nowakowski 2020-04-03 14:17:05 +02:00
parent acce08bf84
commit fede12af61
4 changed files with 37 additions and 19 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
venv
.DS_STORE
__pycache__
.idea

8
Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM python:3
WORKDIR /app
COPY ./requirements.txt .
COPY ./generate_plot.py .
RUN pip install -r requirements.txt

23
Jenkinsfile vendored
View File

@ -6,26 +6,11 @@ pipeline {
copyArtifacts filter: 'wer.txt, srr.txt', fingerprintArtifacts: true, projectName: 's416138-metrics', selector: lastSuccessful() copyArtifacts filter: 'wer.txt, srr.txt', fingerprintArtifacts: true, projectName: 's416138-metrics', selector: lastSuccessful()
} }
} }
stage('Generate plot'){ stage('Generate and archive plots'){
steps { steps {
plot csvFileName: 'plot-8e54e334-ab7b-4c9f-94f7-b9d8965723df.csv', sh label: '', script: './generate_plot.py'
csvSeries: [[ archiveArtifacts 'wer.png'
file: 'wer.txt', archiveArtifacts 'srr.png'
exclusionValues: '',
displayTableFlag: false,
inclusionFlag: 'OFF',
url: '']],
group: 'Plot Group',
title: 'Plot Title',
style: 'line',
exclZero: false,
keepRecords: false,
logarithmic: false,
numBuilds: '',
useDescr: false,
yaxis: '',
yaxisMaximum: '',
yaxisMinimum: ''
} }
} }
stage('Clean Workspace'){ stage('Clean Workspace'){

21
generate_plot.py Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
import matplotlib.pyplot as plt
def read_into_file(file_name: str) -> list:
with open(file_name, 'r') as f:
return f.read().splitlines()
def generate_plot(data: list, label: str, file_name: str):
plt.plot(data)
plt.ylabel(label)
plt.savefig(file_name)
if __name__ == '__main__':
wer = [float(i) for i in read_into_file('wer.txt')]
srr = [float(i) for i in read_into_file('srr.txt')]
generate_plot(wer, 'WER', 'wer.png')
generate_plot(srr, 'SRR', 'srr.png')