Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters aren't validated when passed via constructor #1273

Closed
mikekap opened this issue Oct 6, 2015 · 3 comments
Closed

Parameters aren't validated when passed via constructor #1273

mikekap opened this issue Oct 6, 2015 · 3 comments

Comments

@mikekap
Copy link
Contributor

mikekap commented Oct 6, 2015

class Task(luigi.Task):
    p = luigi.IntParameter()

print Task(p='hi').p  # 'hi'

While the above is a trivial case of "something will probably break down the line," this can introduce subtle bugs when e.g. a date parameter is passed to a datetime parameter (or vice-versa).

My suggestion would be to add some sort of validation, and possibly the ability to tweak the value (similar to parse) to the Parameter interface. The latter would be useful when implementing an e.g. "every N hours" parameter that automatically floors to the nearest hour.

@erikbern
Copy link
Contributor

erikbern commented Oct 6, 2015

Yeah that sounds reasonable. Would you mind putting together a PR?

@Tarrasch
Copy link
Contributor

Tarrasch commented Oct 6, 2015

Sounds great. Though beware that a couple of (bad) tests would break. Also I'm not sure what to do with the None issue.

@dlstadther
Copy link
Collaborator

Resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants