You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by pb...@apache.org on 2023/11/27 21:44:34 UTC

(yunikorn-core) branch master updated: [YUNIKORN-2145] refactor: ApplicationSummary into its own file (#734)

This is an automated email from the ASF dual-hosted git repository.

pbacsko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 00719b98 [YUNIKORN-2145] refactor: ApplicationSummary into its own file (#734)
00719b98 is described below

commit 00719b98f1d94d81404202fea3892ee3546a9de0
Author: brandboat <br...@gmail.com>
AuthorDate: Mon Nov 27 22:44:13 2023 +0100

    [YUNIKORN-2145] refactor: ApplicationSummary into its own file (#734)
    
    Closes: #734
    
    Signed-off-by: Peter Bacsko <pb...@cloudera.com>
---
 pkg/scheduler/objects/application.go         | 30 --------------
 pkg/scheduler/objects/application_summary.go | 61 ++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 30 deletions(-)

diff --git a/pkg/scheduler/objects/application.go b/pkg/scheduler/objects/application.go
index db8f4485..4d494f9c 100644
--- a/pkg/scheduler/objects/application.go
+++ b/pkg/scheduler/objects/application.go
@@ -118,36 +118,6 @@ type Application struct {
 	sync.RWMutex
 }
 
-type ApplicationSummary struct {
-	ApplicationID       string
-	SubmissionTime      time.Time
-	StartTime           time.Time
-	FinishTime          time.Time
-	User                string
-	Queue               string
-	State               string
-	RmID                string
-	ResourceUsage       *resources.TrackedResource
-	PreemptedResource   *resources.TrackedResource
-	PlaceholderResource *resources.TrackedResource
-}
-
-func (as *ApplicationSummary) DoLogging() {
-	log.Log(log.SchedAppUsage).Info("YK_APP_SUMMARY:",
-		zap.String("appID", as.ApplicationID),
-		zap.Int64("submissionTime", as.SubmissionTime.UnixMilli()),
-		zap.Int64("startTime", as.StartTime.UnixMilli()),
-		zap.Int64("finishTime", as.FinishTime.UnixMilli()),
-		zap.String("user", as.User),
-		zap.String("queue", as.Queue),
-		zap.String("state", as.State),
-		zap.String("rmID", as.RmID),
-		zap.Stringer("resourceUsage", as.ResourceUsage),
-		zap.Stringer("preemptedResource", as.PreemptedResource),
-		zap.Stringer("placeHolderResource", as.PlaceholderResource),
-	)
-}
-
 func (sa *Application) GetApplicationSummary(rmID string) *ApplicationSummary {
 	sa.RLock()
 	defer sa.RUnlock()
diff --git a/pkg/scheduler/objects/application_summary.go b/pkg/scheduler/objects/application_summary.go
new file mode 100644
index 00000000..5540cd25
--- /dev/null
+++ b/pkg/scheduler/objects/application_summary.go
@@ -0,0 +1,61 @@
+/*
+ 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 objects
+
+import (
+	"fmt"
+	"time"
+
+	"github.com/apache/yunikorn-core/pkg/common/resources"
+	"github.com/apache/yunikorn-core/pkg/log"
+)
+
+type ApplicationSummary struct {
+	ApplicationID       string
+	SubmissionTime      time.Time
+	StartTime           time.Time
+	FinishTime          time.Time
+	User                string
+	Queue               string
+	State               string
+	RmID                string
+	ResourceUsage       *resources.TrackedResource
+	PreemptedResource   *resources.TrackedResource
+	PlaceholderResource *resources.TrackedResource
+}
+
+func (as *ApplicationSummary) String() string {
+	return fmt.Sprintf("ApplicationID: %s, SubmissionTime: %d, StartTime: %d, FinishTime: %d, User: %s, "+
+		"Queue: %s, State: %s, RmID: %s, ResourceUsage: %s, PreemptedResource: %s, PlaceholderResource: %s",
+		as.ApplicationID,
+		as.SubmissionTime.UnixMilli(),
+		as.StartTime.UnixMilli(),
+		as.FinishTime.UnixMilli(),
+		as.User,
+		as.Queue,
+		as.State,
+		as.RmID,
+		as.ResourceUsage,
+		as.PreemptedResource,
+		as.PlaceholderResource)
+}
+
+func (as *ApplicationSummary) DoLogging() {
+	log.Log(log.SchedAppUsage).Info(fmt.Sprintf("YK_APP_SUMMARY: {%s}", as))
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org