Created
April 9, 2015 20:40
-
-
Save vicenteg/7eae5e5d9e04367019b2 to your computer and use it in GitHub Desktop.
luigi test
This file contains hidden or 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
| import datetime | |
| import luigi | |
| class TaskX(luigi.Task): | |
| x = luigi.IntParameter(default=777) | |
| def run(self): | |
| with self.output().open("w") as f: | |
| print >>f, self.x | |
| def output(self): | |
| return luigi.LocalTarget('/mapr/vgonzalez.solr/tmp/x') | |
| class MyTask(luigi.Task): | |
| x = luigi.IntParameter() | |
| y = luigi.IntParameter(default=45) | |
| def requires(self): | |
| return TaskX() | |
| def run(self): | |
| with self.output().open("w") as f: | |
| print >>f, int(self.input().open("r").read()) + self.y | |
| def output(self): | |
| return luigi.LocalTarget('/mapr/vgonzalez.solr/tmp/output-%s' % datetime.datetime.now().isoformat()) | |
| if __name__ == '__main__': | |
| luigi.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment