diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-04-19 11:52:51 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-04-19 11:52:51 -0400 |
commit | daa0e3a92e03a89baf7ea3750df374df79123245 (patch) | |
tree | 7ff49a80b4ba06f1dd6324264c10746a9eff6e01 /gen/generator.py | |
parent | c0405807b7f7f75fa1cf93265e6b2a739e449596 (diff) |
Made default generator behavior more intuitive.
GenOption defaults can be specified as a single value in addition to a list
of values. PartitionedEdfGenerator's now use worst-fit partitioning for the
most even distribution of tasks.
Diffstat (limited to 'gen/generator.py')
-rw-r--r-- | gen/generator.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gen/generator.py b/gen/generator.py index f35a22b..6a07616 100644 --- a/gen/generator.py +++ b/gen/generator.py | |||
@@ -69,10 +69,10 @@ class Generator(object): | |||
69 | else: | 69 | else: |
70 | cpus = num_cpus() | 70 | cpus = num_cpus() |
71 | try: | 71 | try: |
72 | config = get_config_option("RELEASE_MASTER") and True | 72 | rm_config = get_config_option("RELEASE_MASTER") and True |
73 | except: | 73 | except: |
74 | config = False | 74 | rm_config = False |
75 | release_master = list(set([False, config])) | 75 | release_master = list(set([False, bool(rm_config)])) |
76 | 76 | ||
77 | 77 | ||
78 | return [GenOption('tasks', int, range(cpus, 5*cpus, cpus), | 78 | return [GenOption('tasks', int, range(cpus, 5*cpus, cpus), |
@@ -147,7 +147,10 @@ class Generator(object): | |||
147 | '''Set default parameter values and check that values are valid.''' | 147 | '''Set default parameter values and check that values are valid.''' |
148 | for option in self.options: | 148 | for option in self.options: |
149 | if option.name not in params: | 149 | if option.name not in params: |
150 | params[option.name] = option.default | 150 | val = option.default |
151 | val = val if type(val) == type([]) else [val] | ||
152 | |||
153 | params[option.name] = val | ||
151 | else: | 154 | else: |
152 | option.hidden = True | 155 | option.hidden = True |
153 | params[option.name] = self._check_value(option.name, | 156 | params[option.name] = self._check_value(option.name, |