Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable disk quota for slot locations #236

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/consts/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ const StartUID = 19500
const DefaultHTTPProxyRole = "default"
const DefaultName = "default"
const DefaultMedium = "default"

const MaxSlotLocationReserve = 10 << 30 // 10GiB
2 changes: 2 additions & 0 deletions pkg/ytconfig/canondata/TestGetExecNodeConfig/test.canondata
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
{
path="/yt/hdd2/slots";
"medium_name"="";
"disk_usage_watermark"=0;
"enable_disk_quota"=%false;
};
];
"job_environment"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
{
path="/yt/hdd2/slots";
"medium_name"="";
"disk_usage_watermark"=0;
"enable_disk_quota"=%false;
};
];
"job_environment"={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
{
path="/yt/hdd2/slots";
"medium_name"="";
"disk_usage_watermark"=0;
"enable_disk_quota"=%false;
};
];
"job_environment"={
Expand Down
19 changes: 13 additions & 6 deletions pkg/ytconfig/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ type CacheLocation struct {

type SlotLocation struct {
Path string `yson:"path"`
DiskQuota *int64 `yson:"disk_quota,omitempty"`
DiskUsageWatermark int64 `yson:"disk_usage_watermark,omitempty"`
MediumName string `yson:"medium_name"`
DiskQuota *int64 `yson:"disk_quota,omitempty"`
DiskUsageWatermark *int64 `yson:"disk_usage_watermark,omitempty"`
EnableDiskQuota *bool `yson:"enable_disk_quota,omitempty"`
}

type DataNode struct {
Expand Down Expand Up @@ -450,14 +451,20 @@ func getExecNodeServerCarcass(spec *ytv1.ExecNodesSpec, commonSpec *ytv1.CommonS
Path: location.Path,
MediumName: location.Medium,
}
quota := findQuotaForPath(location.Path, spec.InstanceSpec)
if quota != nil {

if quota := findQuotaForPath(location.Path, spec.InstanceSpec); quota != nil {
slotLocation.DiskQuota = quota

// These are just simple heuristics.
gb := float64(1024 * 1024 * 1024)
slotLocation.DiskUsageWatermark = int64(math.Min(0.1*float64(*quota), float64(10)*gb))
slotLocation.DiskUsageWatermark = ptr.Int64(min(*quota/10, consts.MaxSlotLocationReserve))
} else {
// Do not reserve anything if total disk size is unknown.
slotLocation.DiskUsageWatermark = ptr.Int64(0)
}

// Disk quota isn't generally available for k8s volumes yet.
slotLocation.EnableDiskQuota = ptr.Bool(false)

c.ExecNode.SlotManager.Locations = append(c.ExecNode.SlotManager.Locations, slotLocation)
}

Expand Down
Loading