-
Notifications
You must be signed in to change notification settings - Fork 41
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
DIS-1449 add resource limits to executor config and spawn opts #491
Conversation
e99937a
to
e702a2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! A couple minor comments.
plane2/src/drone/docker/commands.rs
Outdated
.resource_limits | ||
.cpu_time_limit | ||
.map(|cpu_time_limit| { | ||
let mins = (cpu_time_limit.as_secs_f64() / 60.0).floor() as i64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does mins come from as the unit? From the man page for ulimit it looks like CPU time is secs, but I can't find anything that talks about if/how docker transforms it https://ss64.com/bash/ulimit.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpu_period: exec_config | ||
.resource_limits | ||
.cpu_period | ||
.as_ref() | ||
.map(|cpu_period| std::time::Duration::from(cpu_period).as_micros() as i64), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what happens if cpu_quota
is Some(_)
but cpu_period
is None
?
If Docker ignores it, I would rather that we use the default period so that someone who supplies cpu_quota
gets the behavior they expect.
I am assuming that cpu_period
has no effect if cpu_quota
is not provided (I can't find confirmation in the docker docs). If that's not the case, we probably want to use the default only if cpu_quota
is provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, probably less surprising if we just leave it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with leaving the default behaviour to Docker. Since it uses the Docker default if it is None
, can we get rid of DockerCpuPeriod::default
and use None
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is what it's doing now. Or do you mean get rid of the default impl? I use that to calculate quota from the relative value if the period isn't specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh right, nevermind
abaf210
to
a74abdd
Compare
cpu_time_limit doesn't convert to i64
f40f45c
to
b9c6759
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
No description provided.