Commit 2d1708e0 authored by Guido Trotter's avatar Guido Trotter
Browse files

Add instance selection list to Loader.mergeData


Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent ddef0585
......@@ -85,6 +85,7 @@ loadExternalData opts = do
exTags = case optExTags opts of
Nothing -> []
Just etl -> map (++ ":") etl
selInsts = optSelInst opts
exInsts = optExInst opts
when (length allSet > 1) $
......@@ -111,7 +112,7 @@ loadExternalData opts = do
| setFile -> wrapIO $ Text.loadData $ fromJust tfile
| otherwise -> return $ Bad "No backend selected! Exiting."
let ldresult = input_data >>= mergeData util_data' exTags exInsts
let ldresult = input_data >>= mergeData util_data' exTags selInsts exInsts
cdata <-
(case ldresult of
Ok x -> return x
......
......@@ -148,7 +148,7 @@ parseData body = do
let (kti, il) = assignIndices iobj
-- cluster tags
ctags <- extrObj "cluster_tags"
cdata <- mergeData [] [] [] (ClusterData gl nl il ctags)
cdata <- mergeData [] [] [] [] (ClusterData gl nl il ctags)
let map_n = cdNodes cdata
map_i = cdInstances cdata
map_g = cdGroups cdata
......
......@@ -190,10 +190,11 @@ commonSuffix nl il =
-- list and massages it into the correct format.
mergeData :: [(String, DynUtil)] -- ^ Instance utilisation data
-> [String] -- ^ Exclusion tags
-> [String] -- ^ Untouchable instances
-> [String] -- ^ Selected instances (if not empty)
-> [String] -- ^ Excluded instances
-> ClusterData -- ^ Data from backends
-> Result ClusterData -- ^ Fixed cluster data
mergeData um extags exinsts cdata@(ClusterData _ nl il2 tags) =
mergeData um extags selinsts exinsts cdata@(ClusterData _ nl il2 tags) =
let il = Container.elems il2
il3 = foldl' (\im (name, n_util) ->
case Container.findByName im name of
......
......@@ -906,7 +906,7 @@ prop_Loader_assignIndices nodes =
-- is zero
prop_Loader_mergeData ns =
let na = Container.fromList $ map (\n -> (Node.idx n, n)) ns
in case Loader.mergeData [] [] []
in case Loader.mergeData [] [] [] []
(Loader.emptyCluster {Loader.cdNodes = na}) of
Types.Bad _ -> False
Types.Ok (Loader.ClusterData _ nl il _) ->
......
......@@ -87,7 +87,7 @@ fixSlash = map (\x -> if x == '/' then '_' else x)
-- | Generates serialized data from loader input.
processData :: ClusterData -> Result ClusterData
processData input_data = do
cdata@(ClusterData _ nl il _) <- mergeData [] [] [] input_data
cdata@(ClusterData _ nl il _) <- mergeData [] [] [] [] input_data
let (_, fix_nl) = checkData nl il
return cdata { cdNodes = fix_nl }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment