This commit is contained in:
s444018 2022-03-27 17:43:59 +02:00
parent 185f801783
commit 940177ce73
2 changed files with 62 additions and 24 deletions

68
Jenkinsfile vendored
View File

@ -1,29 +1,49 @@
pipeline {
agent any
//Definijuemy parametry, które będzie można podać podczas wywoływania zadania
parameters {
string (
defaultValue: 'Hello World!',
description: 'Tekst, którym chcesz przywitać świat',
name: 'INPUT_TEXT',
trim: false
parameters {
string(
defaultValue: 'szymonparafinski',
description: 'Kaggle username',
name: 'KAGGLE_USERNAME',
trim: false
)
}
password(
defaultValue: '',
description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials',
name: 'KAGGLE_KEY'
)
string(
defaultValue: '1',
description: 'Cutoff lines',
name: 'CUTOFF'
)
}
environment {
KAGGLE_USERNAME="$params.KAGGLE_USERNAME"
KAGGLE_KEY="$params.KAGGLE_KEY"
CUTOFF="$params.CUTOFF"
}
stages {
stage('Hello') {
steps {
//Wypisz wartość parametru w konsoli (To nie jest polecenie bash, tylko groovy!)
echo "INPUT_TEXT: ${INPUT_TEXT}"
//Wywołaj w konsoli komendę "figlet", która generuje ASCI-art
sh "figlet \"${INPUT_TEXT}\" | tee output.txt"
}
}
stage('Goodbye!') {
steps {
echo 'Goodbye!'
//Zarchiwizuj wynik
archiveArtifacts 'output.txt'
}
}
}
stage('Checkout'){
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's444018', url: 'https://git.wmi.amu.edu.pl/s444018/ium_444018.git']]])
}
}
stage('Script'){
steps {
script {
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
sh 'kaggle datasets list'
}s
}
sh './download_dataset.sh $CUTOFF'
archiveArtifacts artifacts: 'dataset.csv.dev, dataset.csv.test, dataset.csv.train', followSymlinks: false
}
}
}
}

18
download_dataset.sh Normal file
View File

@ -0,0 +1,18 @@
dataset_operation() {
tail -n +2 imdb-dataset.csv | shuf > imdb-dataset.csv.s
head -n $CUTOFF imdb-dataset.csv.s > ./imdb-dataset.csv.shuf
len1=$(cat ./imdb-dataset.csv.shuf | wc -l)
len2=$(($len1/10))
len3=$(($len2*2))
len4=$(($len3+1))
head -n $len2 imdb-dataset.csv.shuf > imdb-dataset.csv.test
head -n $len3 imdb-dataset.csv.shuf | tail -n $len2 > imdb-dataset.csv.dev
tail -n +$len4 imdb-dataset.csv.shuf > imdb-dataset.csv.train
rm imdb-dataset.csv.shuf
wc -l imdb-dataset.csv.*
}
kaggle datasets download -d harshitshankhdhar/imdb-dataset-of-top-1000-movies-and-tv-shows
unzip imdb-dataset-of-top-1000-movies-and-tv-shows.zip
mv imdb-dataset-of-top-1000-movies-and-tv-shows.zip imdb-dataset.zip
dataset_operation