Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import luigi
class MyFirstTask(luigi.Task): # inherit from Luigi base class Task
def run(self):
with self.output().open('w') as f:
f.write("This is my first task.\n")
def output(self):
# tell luigi where to ouptut to
return luigi.LocalTarget('MyTask.txt')
if __name__ == '__main__':
# since we are setting MySecondTask to be the main task,
# it will check for the requirements first, then run
luigi.run(["--local-scheduler"], main_task_cls=MyFirstTask)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment