m3dev / gokart

Gokart solves reproducibility, task dependencies, constraints of good code, and ease of use for Machine Learning Pipeline.
https://gokart.readthedocs.io/en/latest/
MIT License
305 stars 57 forks source link

gokart.build() cannot process task parameter #228

Open mski-iksm opened 3 years ago

mski-iksm commented 3 years ago

Task parameters can be set at gokart.run() as following example.

gokart.run(['SampleTask', '--local-scheduler', '--param=hello'])

When using gokart.build() this is not possible, which makes changing parameters bothersome.

vaaaaanquish commented 3 years ago

Is there a scene where you want to dynamically change the parameters of an instantiated class?

x = GokartTask(task_parameter=1)   <- we can change

gokart.build(x)
mski-iksm commented 3 years ago

@vaaaaanquish I believe that the parameter injection feature will be needed when

class ChildTask(TaskOnKart):
    task_parameter2:int = luigi.IntParameter()

class RootTask(TaskOnKart):
    task_parameter:int = luigi.IntParameter()
    def requires(self):
        return ChildTask()

x = RootTask(task_parameter=1)
gokart.build(x)

In such case, ChildTask.task_parameter2 must be set somehow. I think this may happen sometimes.

vaaaaanquish commented 3 years ago

I see the demand.