-
Notifications
You must be signed in to change notification settings - Fork 454
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 all 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 |
---|---|---|
|
@@ -24,7 +24,7 @@ def parse_options(): | |
parser.add_argument("-f", "--metric_filters", type=str, default="") | ||
parser.add_argument("-p", "--poll_interval", type=int, default=const.DEFAULT_POLL_INTERVAL) | ||
parser.add_argument("-timeout", "--timeout", type=int, default=const.DEFAULT_TIMEOUT) | ||
parser.add_argument("-w", "--wait_all", type=bool, default=const.DEFAULT_WAIT_ALL) | ||
parser.add_argument("-w", "--wait_all_processes", type=str, default=const.DEFAULT_WAIT_ALL_PROCESSES) | ||
|
||
opt = parser.parse_args() | ||
return opt | ||
|
@@ -38,6 +38,7 @@ def parse_options(): | |
logger.addHandler(handler) | ||
logger.propagate = False | ||
opt = parse_options() | ||
wait_all_processes = opt.wait_all_processes.lower() == "true" | ||
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. Does this compare ( 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. this is the python way of converting string to bool ;) should be fine since the string can only have two possibilities |
||
db_manager_server = opt.db_manager_server_addr.split(':') | ||
if len(db_manager_server) != 2: | ||
raise Exception("Invalid Katib DB manager service address: %s" % | ||
|
@@ -46,7 +47,7 @@ def parse_options(): | |
WaitMainProcesses( | ||
pool_interval=opt.poll_interval, | ||
timout=opt.timeout, | ||
wait_all=opt.wait_all, | ||
wait_all=wait_all_processes, | ||
completed_marked_dir=opt.metrics_file_dir) | ||
|
||
mc = MetricsCollector(opt.metric_names.split(';')) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,25 +18,26 @@ import ( | |
// SuggestionConfig is the JSON suggestion structure in Katib config. | ||
type SuggestionConfig struct { | ||
Image string `json:"image"` | ||
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy"` | ||
Resource corev1.ResourceRequirements `json:"resources"` | ||
ServiceAccountName string `json:"serviceAccountName"` | ||
VolumeMountPath string `json:"volumeMountPath"` | ||
PersistentVolumeClaimSpec corev1.PersistentVolumeClaimSpec `json:"persistentVolumeClaimSpec"` | ||
PersistentVolumeSpec corev1.PersistentVolumeSpec `json:"persistentVolumeSpec"` | ||
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"` | ||
Resource corev1.ResourceRequirements `json:"resources,omitempty"` | ||
ServiceAccountName string `json:"serviceAccountName,omitempty"` | ||
VolumeMountPath string `json:"volumeMountPath,omitempty"` | ||
PersistentVolumeClaimSpec corev1.PersistentVolumeClaimSpec `json:"persistentVolumeClaimSpec,omitempty"` | ||
PersistentVolumeSpec corev1.PersistentVolumeSpec `json:"persistentVolumeSpec,omitempty"` | ||
} | ||
|
||
// 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,omitempty"` | ||
Resource corev1.ResourceRequirements `json:"resources,omitempty"` | ||
WaitAllProcesses *bool `json:"waitAllProcesses,omitempty"` | ||
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. Can you add |
||
} | ||
|
||
// EarlyStoppingConfig is the JSON early stopping structure in Katib config. | ||
type EarlyStoppingConfig struct { | ||
Image string `json:"image"` | ||
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy"` | ||
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"` | ||
} | ||
|
||
// GetSuggestionConfigData gets the config data for the given suggestion algorithm name. | ||
|
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.