Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Add labels describing resource allocation to containers
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielhartmann committed Oct 17, 2018
1 parent 232ed79 commit 1f64f87
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions executor/runtime/container.go
Expand Up @@ -12,12 +12,17 @@ import (
func NewContainer(taskID string, titusInfo *titus.ContainerInfo, constraints *runtimeTypes.Resources, labels map[string]string, cfg config.Config) *runtimeTypes.Container {
networkCfgParams := titusInfo.GetNetworkConfigInfo()

env := cfg.GetNetflixEnvForTask(titusInfo,
strconv.FormatInt(constraints.Mem, 10),
strconv.FormatInt(constraints.CPU, 10),
strconv.FormatUint(constraints.Disk, 10),
strconv.FormatUint(uint64(networkCfgParams.GetBandwidthLimitMbps()), 10))
strCpu := strconv.FormatInt(constraints.CPU, 10)
strMem := strconv.FormatInt(constraints.Mem, 10)
strDisk := strconv.FormatUint(constraints.Disk, 10)
strNetwork := strconv.FormatUint(uint64(networkCfgParams.GetBandwidthLimitMbps()), 10)

env := cfg.GetNetflixEnvForTask(titusInfo, strMem, strCpu, strDisk, strNetwork)
labels["TITUS_TASK_INSTANCE_ID"] = env["TITUS_TASK_INSTANCE_ID"]
labels["com.netflix.titus.cpu"] = strCpu
labels["com.netflix.titus.mem"] = strMem
labels["com.netflix.titus.disk"] = strDisk
labels["com.netflix.titus.network"] = strNetwork

c := &runtimeTypes.Container{
TaskID: taskID,
Expand Down

0 comments on commit 1f64f87

Please sign in to comment.