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

Adding additional printer columns for better debugging #817

Merged
merged 1 commit into from
Sep 26, 2019
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
9 changes: 9 additions & 0 deletions manifests/v1alpha3/katib-controller/crd-suggestion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ metadata:
spec:
additionalPrinterColumns:
- JSONPath: .status.conditions[-1:].type
name: Type
type: string
- JSONPath: .status.conditions[-1:].status
name: Status
type: string
- JSONPath: .spec.requests
name: Requested
type: string
- JSONPath: .status.suggestionCount
name: Assigned
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/controller/suggestions/v1alpha3/suggestion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ type SuggestionStatus struct {
// Algorithmsettings set by the algorithm services.
AlgorithmSettings []common.AlgorithmSetting `json:"algorithmSettings,omitempty"`

// Number of suggestion results
SuggestionCount int32 `json:"suggestionCount,omitempty"`

// Suggestion results
Suggestions []TrialAssignment `json:"suggestions,omitempty"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func (f *Fake) SyncAssignments(
instance *suggestionsv1alpha3.Suggestion,
e *experimentsv1alpha3.Experiment,
ts []trialsv1alpha3.Trial) error {
if len(instance.Status.Suggestions) != int(instance.Spec.Requests) {
for i := 0; i < int(instance.Spec.Requests)-len(instance.Status.Suggestions); i++ {
if int(instance.Status.SuggestionCount) != int(instance.Spec.Requests) {
for i := 0; i < int(instance.Spec.Requests)-int(instance.Status.SuggestionCount); i++ {
name := fmt.Sprintf("%s-%s", instance.Name, utilrand.String(8))
instance.Status.Suggestions = append(instance.Status.Suggestions, suggestionsv1alpha3.TrialAssignment{
Name: name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (g *General) SyncAssignments(
e *experimentsv1alpha3.Experiment,
ts []trialsv1alpha3.Trial) error {
logger := log.WithValues("Suggestion", types.NamespacedName{Name: instance.GetName(), Namespace: instance.GetNamespace()})
requestNum := int(instance.Spec.Requests) - len(instance.Status.Suggestions)
requestNum := int(instance.Spec.Requests) - int(instance.Status.SuggestionCount)
if requestNum <= 0 {
return nil
}
Expand Down Expand Up @@ -92,6 +92,7 @@ func (g *General) SyncAssignments(
ParameterAssignments: composeParameterAssignments(t.Assignments),
})
}
instance.Status.SuggestionCount = int32(len(instance.Status.Suggestions))

if response.Algorithm != nil {
updateAlgorithmSettings(instance, response.Algorithm)
Expand Down