Changeset b14b495
- Timestamp:
- May 17, 2010 2:01:26 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- ec9962b
- Parents:
- da5b93c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/compose.py
rda5b93c rb14b495 4 4 import re 5 5 import os 6 import random 6 7 7 8 from optparse import OptionParser … … 148 149 got_all = False 149 150 return got_all 151 152 def randomize_constraint_order(indexes): 153 """ 154 Randomly reorder the lists of constraints that provides and accepts hold. 155 """ 156 if not isinstance(indexes, tuple): 157 indexes = (indexes,) 158 159 for idx in indexes: 160 for k in idx.keys(): 161 random.shuffle(idx[k]) 150 162 151 163 def remote_ns2topdl(uri, desc, cert): … … 229 241 parser.add_option('--certfile', dest='cert', default=None, 230 242 help='Certificate to use as identity') 243 parser.add_option('--seed', dest='seed', type='int', default=None, 244 help='Random number seed') 231 245 232 246 opts, args = parser.parse_args() … … 239 253 else: 240 254 cert = None 255 256 random.seed(opts.seed) 241 257 242 258 comps = [ ] … … 276 292 constraints = [ c for c in constraints if isinstance(c.name, tuple )] 277 293 294 # Mix up the constraint indexes 295 randomize_constraint_order((provides, accepts)) 296 278 297 # Now the various components live in the same namespace and are marked with 279 298 # their composition requirements.
Note: See TracChangeset
for help on using the changeset viewer.