From 76e3ced286743988e2635eb489c40ce2ec06b35e Mon Sep 17 00:00:00 2001 From: Andrzej Preibisz Date: Sun, 27 Mar 2022 13:28:05 +0200 Subject: [PATCH] Jenkinsfile + script fixes --- Jenkinsfile | 14 ++++++++------ dataset_script.sh | 14 +++++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index acef5e1..6a60eeb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,19 +7,21 @@ node { description: 'Tekst do wyświetlenie', name: 'INPUT_TEXT', trim: false + ), + string( + defaultValue: "10000", + description: "How many records use", + name: "CUTOFF" ) ]) ]) } - stage('Hello') { - //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('Download') { + sh "dataset_script.sh \"${CUTOFF}\"" } stage('Goodbye') { echo 'Goodbye!' //Zarchiwizuj wynik - archiveArtifacts 'output.txt' + archiveArtifacts 'heart_2020_test.csv, heart_2020_train.csv, heart_2020_sorted.csv' } } \ No newline at end of file diff --git a/dataset_script.sh b/dataset_script.sh index f5776af..ef01464 100644 --- a/dataset_script.sh +++ b/dataset_script.sh @@ -1,3 +1,11 @@ +#!/bin/bash +CUTOFF=$1 + +TEST_SIZE=$(($CUTOFF * 1/5)) +TRAIN_START=$(($TEST_SIZE+1)) +echo $TEST_SIZE +echo $TRAIN_START + ! kaggle datasets download kamilpytlak/personal-key-indicators-of-heart-disease ! unzip personal-key-indicators-of-heart-disease -d ./ ! wc -l heart_2020_cleaned.csv @@ -9,10 +17,10 @@ echo "Categories: \n" ! grep -P "^$" -n heart_2020_cleaned.csv -! head -n -1 heart_2020_cleaned.csv | shuf > heart_2020_sorted.csv +! head -n $CUTOFF heart_2020_cleaned.csv | shuf > heart_2020_sorted.csv -! head -n 4000 heart_2020_sorted.csv > heart_2020_test.csv -! tail -n +4001 heart_2020_sorted.csv > heart_2020_train.csv +! head -n $TEST_SIZE heart_2020_sorted.csv > heart_2020_test.csv +! tail -n +$TRAIN_START heart_2020_sorted.csv > heart_2020_train.csv ! wc -l heart_2020_t*