Revision 78694255 hspace.hs
b/hspace.hs | ||
---|---|---|
137 | 137 |
"show help" |
138 | 138 |
] |
139 | 139 |
|
140 |
filterFails :: (Monad m) => [(Maybe Node.List, Instance.Instance, [Node.Node])]
|
|
141 |
-> m [(Node.List, Instance.Instance, [Node.Node])]
|
|
140 |
filterFails :: Cluster.AllocSolution
|
|
141 |
-> Maybe [(Node.List, Instance.Instance, [Node.Node])]
|
|
142 | 142 |
filterFails sols = |
143 |
if null sols then fail "No nodes onto which to allocate at all"
|
|
143 |
if null sols then Nothing -- No nodes onto which to allocate at all
|
|
144 | 144 |
else let sols' = filter (isJust . fst3) sols |
145 | 145 |
in if null sols' then |
146 |
fail "No valid allocation solutions"
|
|
146 |
Nothing -- No valid allocation solutions
|
|
147 | 147 |
else |
148 | 148 |
return $ map (\(x, y, z) -> (fromJust x, y, z)) sols' |
149 | 149 |
|
... | ... | |
162 | 162 |
-> (Node.List, [Instance.Instance]) |
163 | 163 |
iterateDepth nl il newinst nreq ixes = |
164 | 164 |
let depth = length ixes |
165 |
newname = printf "new-%d" depth
|
|
165 |
newname = (printf "new-%d" depth)::String
|
|
166 | 166 |
newidx = (length $ Container.elems il) + depth |
167 | 167 |
newi2 = Instance.setIdx (Instance.setName newinst newname) newidx |
168 |
sols = Cluster.tryAlloc nl il newi2 nreq |
|
168 |
sols = (Cluster.tryAlloc nl il newi2 nreq):: |
|
169 |
Maybe Cluster.AllocSolution |
|
169 | 170 |
orig = (nl, ixes) |
170 | 171 |
in |
171 | 172 |
if isNothing sols then orig |
Also available in: Unified diff