-
Notifications
You must be signed in to change notification settings - Fork 443
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
Feature/waitallprocesses config #1394
Changes from 3 commits
c2fc532
59e63f6
3f5d813
76d9373
d87fd6b
0df1035
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ var ( | |
metricFilters = flag.String("f", "", "Metric filters") | ||
pollInterval = flag.Duration("p", common.DefaultPollInterval, "Poll interval between running processes check") | ||
timeout = flag.Duration("timeout", common.DefaultTimeout, "Timeout before invoke error during running processes check") | ||
waitAll = flag.Bool("w", common.DefaultWaitAll, "Whether wait for all other main process of container exiting") | ||
waitAllProcesses = flag.String("w", common.DefaultWaitAllProcesses, "Whether wait for all other main process of container exiting") | ||
stopRules stopRulesFlag | ||
isEarlyStopped = false | ||
) | ||
|
@@ -353,10 +353,16 @@ func main() { | |
go printMetricsFile(*metricsFilePath) | ||
} | ||
|
||
waitAll, err := strconv.ParseBool(*waitAllProcesses) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we keep it |
||
if err != nil { | ||
klog.Errorf("Cannot parse %s to bool, defaulting to waitAllProcesses=%s", *waitAllProcesses, common.DefaultWaitAllProcesses) | ||
waitAll, _ = strconv.ParseBool(common.DefaultWaitAllProcesses) | ||
} | ||
|
||
wopts := common.WaitPidsOpts{ | ||
PollInterval: *pollInterval, | ||
Timeout: *timeout, | ||
WaitAll: *waitAll, | ||
WaitAll: waitAll, | ||
CompletedMarkedDirPath: filepath.Dir(*metricsFilePath), | ||
} | ||
if err := common.WaitMainProcesses(wopts); err != nil { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,9 +28,10 @@ type SuggestionConfig struct { | |
|
||
// MetricsCollectorConfig is the JSON metrics collector structure in Katib config. | ||
type MetricsCollectorConfig struct { | ||
Image string `json:"image"` | ||
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy"` | ||
Resource corev1.ResourceRequirements `json:"resources"` | ||
Image string `json:"image"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add omitempty for the fieds? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can add it on all parameters but |
||
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy"` | ||
Resource corev1.ResourceRequirements `json:"resources"` | ||
WaitAllProcesses string `json:"waitAllProcesses"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, can we keep it |
||
} | ||
|
||
// EarlyStoppingConfig is the JSON early stopping structure in Katib config. | ||
|
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 we need to keep this flag
String
, or we can useBool
?I assume this flag can be only
true
orfalse
.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 had problems with parsing booleans when a user has not specified the field in the katib-config. Do you know of a good way to do it?
I could leave it string in the katib-config and parse it to bool in
GetMetricsCollectorConfigData
, would that be better?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.
@robbertvdg It seems that empty
bool
in Go isfalse
. So when user doesn't specify any values in config we send "false" to the metrics collector.Maybe we can define
MetricsCollectorConfig
like this:In that case, you can set
-w
flag ifWaitAllProcesses != nil
. Otherwise the default value is set.In Katib config I was able to define bool value like this:
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.
The problem lies with the
v1.Container.args
which isstring[]
. Therefore every container argument has to be a string, which I think is not compatible with the flag.Bool() argument (I tested it, doesn't work).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.
@robbertvdg Got it.
In that case can we keep
WaitAllProcesses *bool
inMetricsCollectorConfig
, convert it to string here:katib/pkg/webhook/v1beta1/pod/inject_webhook.go
Line 299 in 3f5d813
Then, use the String type like you did in Metrics Collector and convert it to Bool after.
In that case, we can avoid situation when user specify wrong values in Katib config.
What do you think @robbertvdg @gaocegege ?
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.
@andreyvelich those were my thoughts as well, will update PR soon.