Filter unknown parameters after modify_param_values.
@@ -145,8 +145,14 @@ class BaseTask(six.with_metaclass(BaseRegister, luigi.Task)):
# assign to actual parameters
values = super(BaseTask, cls).get_param_values(params, args, kwargs)
- # call the hook optionally modifying the values afterwards
- values = list(cls.modify_param_values(OrderedDict(values)).items())
+ # call the hook optionally modifying the values afterwards,
+ # but remove temporary objects that might have been placed into it
+ param_names = {name for name, _ in params}
+ values = list(
+ (name, value)
+ for name, value in cls.modify_param_values(OrderedDict(values)).items()
+ if name in param_names
+ )
return values
