yangwwei commented on a change in pull request #288:
URL:
https://github.com/apache/incubator-yunikorn-k8shim/pull/288#discussion_r679314558
##########
File path: pkg/common/utils/utils.go
##########
@@ -83,24 +83,22 @@ func GetQueueNameFromPod(pod *v1.Pod) string {
}
func GetApplicationIDFromPod(pod *v1.Pod) (string, error) {
+
// application ID can be defined in annotations
- for name, value := range pod.Annotations {
- if name == constants.AnnotationApplicationID {
- return value, nil
- }
+ if value, found := pod.Annotations[constants.AnnotationApplicationID];
found {
+ return value, nil
}
// application ID can be defined in labels
- for name, value := range pod.Labels {
- // application ID can be defined as a label
- if name == constants.LabelApplicationID {
- return value, nil
- }
+ if value, found := pod.Labels[constants.LabelApplicationID]; found {
+ fmt.Printf("[CHIA] name: %+v value: %+v\n",
constants.LabelApplicationID, value)
Review comment:
is this the log message for debug? can we remove it?
##########
File path: pkg/common/utils/utils.go
##########
@@ -83,24 +83,22 @@ func GetQueueNameFromPod(pod *v1.Pod) string {
}
func GetApplicationIDFromPod(pod *v1.Pod) (string, error) {
+
// application ID can be defined in annotations
- for name, value := range pod.Annotations {
- if name == constants.AnnotationApplicationID {
- return value, nil
- }
+ if value, found := pod.Annotations[constants.AnnotationApplicationID];
found {
+ return value, nil
}
// application ID can be defined in labels
- for name, value := range pod.Labels {
- // application ID can be defined as a label
- if name == constants.LabelApplicationID {
- return value, nil
- }
+ if value, found := pod.Labels[constants.LabelApplicationID]; found {
+ fmt.Printf("[CHIA] name: %+v value: %+v\n",
constants.LabelApplicationID, value)
+ return value, nil
+ }
- // if a pod for spark already provided appID, reuse it
- if name == constants.SparkLabelAppID {
- return value, nil
- }
+ // if a pod for spark already provided appID, reuse it
+ if value, found := pod.Labels[constants.SparkLabelAppID]; found {
+ fmt.Printf("[CHIA] name: %+v value: %+v\n",
constants.SparkLabelAppID, value)
Review comment:
redundant log message
--
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]