Last active
August 29, 2015 13:57
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
# Some needed luigi imports | |
import luigi | |
import luigi.scheduler | |
import luigi.worker | |
# Here we are importing our own tasks, provided they are | |
# arranged in a python module (folder) named "components" | |
from components.SomeTaskA import SomeTaskA | |
from components.SomeTaskB import SomeTaskB | |
from components.SomeTaskC import SomeTaskC | |
# ------------------------------------------ | |
# DEFINE THE MAIN WORKFLOW DEPENDENCY GRAPH | |
# ------------------------------------------ | |
# We store all the task in a dictionary, for easy retrieveing later ... | |
tasks = {} | |
tasks["some_task_a"] = SomeTaskA() | |
tasks["some_task_b"] = SomeTaskB(upstream_task=tasks["some_task_a"]) | |
tasks["some_task_c"] = SomeTaskC(upstream_task=tasks["some_task_b"]) | |
# ------------------------------------------ | |
# RUN THE WORKFLOW | |
# ------------------------------------------ | |
# We decide to run the last one (task C) of our tasks, so that the whole | |
# workflow is "exercised" ... | |
the_task_to_run = tasks["some_task_c"] | |
# Build (and run) the workflow | |
luigi.build(the_task_to_run, workers=16, local_scheduler=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment