Revision 8c2ebac8 hail.hs

b/hail.hs
51 51
      "show help"
52 52
    ]
53 53

  
54
-- | Compute online nodes from a NodeList
55
getOnline :: NodeList -> [Node.Node]
56
getOnline = filter (not . Node.offline) . Container.elems
57

  
54 58
-- | Try to allocate an instance on the cluster
55 59
tryAlloc :: (Monad m) =>
56 60
            NodeList
......
59 63
         -> Int
60 64
         -> m [(Maybe NodeList, [Node.Node])]
61 65
tryAlloc nl _ inst 2 =
62
    let all_nodes = Container.elems nl
66
    let all_nodes = getOnline nl
63 67
        all_pairs = liftM2 (,) all_nodes all_nodes
64 68
        ok_pairs = filter (\(x, y) -> Node.idx x /= Node.idx y) all_pairs
65 69
        sols = map (\(p, s) ->
......
68 72
    in return sols
69 73

  
70 74
tryAlloc nl _ inst 1 =
71
    let all_nodes = Container.elems nl
75
    let all_nodes = getOnline nl
72 76
        sols = map (\p -> (fst $ Cluster.allocateOnSingle nl inst p, [p]))
73 77
               all_nodes
74 78
    in return sols
......
86 90
         -> [Int]
87 91
         -> m [(Maybe NodeList, [Node.Node])]
88 92
tryReloc nl il xid 1 ex_idx =
89
    let all_nodes = Container.elems nl
93
    let all_nodes = getOnline nl
90 94
        inst = Container.find xid il
91 95
        valid_nodes = filter (not . flip elem ex_idx . idx) all_nodes
92 96
        valid_idxes = map Node.idx valid_nodes

Also available in: Unified diff