steinsgateted commented on code in PR #422:
URL: https://github.com/apache/yunikorn-k8shim/pull/422#discussion_r882892508


##########
pkg/cache/node_state.go:
##########
@@ -0,0 +1,154 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package cache
+
+import (
+       "github.com/looplab/fsm"
+       "go.uber.org/zap"
+
+       "github.com/apache/yunikorn-k8shim/pkg/common/events"
+       "github.com/apache/yunikorn-k8shim/pkg/log"
+)
+
+//----------------------------------------------
+// SchedulerNode events
+//----------------------------------------------
+type SchedulerNodeEventType int
+
+const (
+       RecoverNode SchedulerNodeEventType = iota
+       NodeAccepted
+       NodeRejected
+       DrainNode
+       RestoreNode
+       NodeReady
+)
+
+func (ae SchedulerNodeEventType) String() string {
+       return [...]string{"RecoverNode", "NodeAccepted", "NodeRejected", 
"DrainNode", "RestoreNode", "NodeReady"}[ae]
+}
+
+type CachedSchedulerNodeEvent struct {
+       NodeID string
+       Event  SchedulerNodeEventType
+}
+
+func (sn CachedSchedulerNodeEvent) GetEvent() string {
+       return sn.Event.String()
+}
+
+func (sn CachedSchedulerNodeEvent) GetNodeID() string {
+       return sn.NodeID
+}
+
+func (sn CachedSchedulerNodeEvent) GetArgs() []interface{} {
+       return nil
+}
+
+// ----------------------------------
+// SchedulerNode states
+// ----------------------------------
+var storeSchedulerNodeStates *NStates
+
+type NStates struct {
+       New        string
+       Recovering string
+       Accepted   string
+       Healthy    string
+       Rejected   string
+       Draining   string
+}
+
+func SchedulerNodeStates() *NStates {
+       if storeSchedulerNodeStates == nil {

Review Comment:
   Done. Thanks.



##########
pkg/cache/nodes.go:
##########
@@ -234,9 +234,9 @@ func hasReadyCondition(node *v1.Node) bool {
        return false
 }
 
-func triggerEvent(node *SchedulerNode, currentState string, eventType 
events.SchedulerNodeEventType) {
+func triggerEvent(node *SchedulerNode, currentState string, eventType 
SchedulerNodeEventType) {
        log.Logger().Info("scheduler node event ", zap.String("name", 
node.name),
-               zap.String("current state ", currentState), 
zap.String("transition to ", string(eventType)))
+               zap.String("current state ", currentState), 
zap.String("transition to ", eventType.String()))

Review Comment:
   Done. Thanks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to