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

Fix add_config behavior #218

Closed e-mon closed 3 years ago

e-mon commented 3 years ago

The following error occurs when adding a configuration file with environment variables.

base.ini

[Example]
param = %(param)s

example.py

import gokart

class Example(gokart.TaskOnKart):
    param = luigi.Parameter()

    def run(self):
        self.dump('Hello, world!')

gokart.add_config('base.ini')
task = Example()
output = gokart.build(task)

erorr

configparser.InterpolationMissingOptionError: Bad value substitution: option 'param' in section 'Example' contains an interpolation key 'test_param' which is not a valid option name. Raw value: '%(test_param)s'

I think this is because the environment variables are not loaded before the parameter parsing, so I fixed config_add function.

Please review.

vaaaaanquish commented 3 years ago

いいよ

hirosassa commented 3 years ago

Looks good!

hirosassa commented 3 years ago

@e-mon Thanks for your contribution! merged!