-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init luigi, add raw data extraction (#3)
* feat: init luigi, add extract raw data * feat: update readme
- Loading branch information
1 parent
382de19
commit 0624be9
Showing
5 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# dvc-luigi | ||
This is a learning repository about DVC Data Version Control and Luigi Pipelines | ||
|
||
- luigi, dvc, pre-commit | ||
- setup https://github.com/Kaggle/kaggle-api | ||
- `kaggle competitions download -c sentiment-analysis-on-movie-reviews -p data` | ||
- `kaggle competitions download -c sentiment-analysis-on-movie-reviews -p data` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/output/ | ||
/data.xml | ||
/sentiment-analysis-on-movie-reviews.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
kaggle==1.5.16 | ||
dvc==3.28.0 | ||
luigi==3.4.0 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
import luigi | ||
import zipfile | ||
|
||
class ExtractRawData(luigi.Task): | ||
data_path = luigi.Parameter(default="../data/sentiment-analysis-on-movie-reviews.zip") | ||
|
||
def output(self): | ||
return { | ||
"test": luigi.LocalTarget('../data/output/test.tsv.zip'), | ||
"train": luigi.LocalTarget('../data/output/train.tsv.zip'), | ||
} | ||
|
||
def run(self): | ||
# Check if data file exists | ||
assert os.path.exists(self.data_path) | ||
|
||
# Unzip data file | ||
with zipfile.ZipFile(self.data_path, 'r') as zip_ref: | ||
zip_ref.extractall("../data/output/") |