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

Fix TaskOnKart.fix_random_seed_value cannnot handle None #287

Conversation

Hi-king
Copy link
Member

@Hi-king Hi-king commented May 9, 2022

resolve #286

Problem

Cannot set None for luigi.IntParameter. But TaskOnKart.fix_random_seed_value does this.

So following code fails

        task = gokart.TaskOnKart()
        luigi.task_register.load_task(None, task.get_task_family(), task.to_str_params())

Solution

  • Add above test
  • Introduce magic number instead of None

@Hi-king
Copy link
Member Author

Hi-king commented May 9, 2022

OptionalIntParameter introduced by spotify/luigi#3079 can solve this, but not yet released...

@@ -52,7 +52,10 @@ class TaskOnKart(luigi.Task):
description='If this is false, this task is not treated as a part of dependent tasks for the unique id.',
significant=False)
fix_random_seed_methods = luigi.ListParameter(default=['random.seed', 'numpy.random.seed'], description='Fix random seed method list.', significant=False)
fix_random_seed_value = luigi.IntParameter(default=None, description='Fix random seed method value.', significant=False)
FIX_RANDOM_SEED_VALUE_NONE_MAGIC_NUMBER = -42497368
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just random

@Hi-king Hi-king requested a review from hirosassa May 9, 2022 13:22
Copy link
Contributor

@mski-iksm mski-iksm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hi-king LGTM!

@mski-iksm mski-iksm merged commit f1f1600 into m3dev:master May 10, 2022
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

Successfully merging this pull request may close these issues.

IntParameter TaskOnKart.fix_random_seed_value cannnot handle None
3 participants