Closed skokado closed 3 years ago
I have confirmed that the warning doesn't display by using OptionalParameter
as below.
import luigi
import gokart
import pandas as pd
class BaseTaskOnKart(gokart.TaskOnKart):
# override
redis_host = luigi.OptionalParameter(default=None, description='Task lock check is deactivated, when None.', significant=False)
redis_port = luigi.OptionalParameter(default=None, description='Task lock check is deactivated, when None.', significant=False)
class MyTask(BaseTaskOnKart):
def output(self):
return self.make_target('output.csv')
def run(self):
df = pd.DataFrame()
self.dump(df)
@skokado Thank you for your suggestion.
We will fix this issue in the next release!
Hi, thank you for this project.
I faced displaying warning messages when running tasks after updating
gokart
recently.tasks.py
(almost do nothing task)This is caused by using
luigi.Paremeter
class forredis_host
andredis_port
, and default value isNone
.I think, it is better to use
luigi.OptionalParamter
when default value isNone
instead ofluigi.Parameter
.In the implementation of the displaying warning,
luigi.OptionalParamter
has a check for the value being None, butluigi.Paramter
does not.luigi.OptionalParamter._warn_on_wrong_param_type
https://github.com/spotify/luigi/blob/7b7ff901480d9a02402037e0cb54e4508b5a94a2/luigi/parameter.py#L338-L343
luigi.Paramter._warn_on_wrong_param_type
https://github.com/spotify/luigi/blob/7b7ff901480d9a02402037e0cb54e4508b5a94a2/luigi/parameter.py#L275-L279