Task Parameters

Luigi Parameter

We can set parameters for tasks. Also please refer to Task Settings section.

class Task(gokart.TaskOnKart):
    param_a = luigi.Parameter()
    param_c = luigi.ListParameter()
    param_d = luigi.IntParameter(default=1)

Please refer to luigi document for a list of parameter types.

Gokart Parameter

There are also parameters provided by gokart.

  • gokart.TaskInstanceParameter
  • gokart.ListTaskInstanceParameter
  • gokart.ExplicitBoolParameter


The TaskInstanceParameter() executes a task using the results of a task as dynamic parameters.

class TaskA(gokart.TaskOnKart):
    def run(self):

class TaskB(gokart.TaskOnKart):
    require_task = gokart.TaskInstanceParameter()

    def requires(self):
        return self.require_task

    def run(self):
        task_a = self.load()
        self.dump(','.join([task_a, 'world']))

task = TaskB(require_task=TaskA())
print(gokart.build(task))  # Hello,world

Helps to create a pipeline.


The ListTaskInstanceParameter() is list of TaskInstanceParameter.


The ExplicitBoolParameter() is parameter for explicitly specified value.

luigi.BoolParameter already has “explicit parsing” feature, but also still has implicit behavior like follows.

$ python main.py Task --param
# param will be set as True
$ python main.py Task
# param will be set as False

ExplicitBoolParameter solves these problems on parameters from command line.