You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by ma...@apache.org on 2023/10/04 07:04:20 UTC

[yunikorn-core] branch master updated: [YUNIKORN-1983] Add config to statedump (#664)

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

mani 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 ee8a85a4 [YUNIKORN-1983] Add config to statedump (#664)
ee8a85a4 is described below

commit ee8a85a4a4c3da1155826d5a5e5282e03e5e30ff
Author: brandboat <br...@gmail.com>
AuthorDate: Wed Oct 4 12:34:05 2023 +0530

    [YUNIKORN-1983] Add config to statedump (#664)
    
    Closes: #664
    
    Signed-off-by: Manikandan R <ma...@gmail.com>
---
 pkg/webservice/handlers.go      | 18 +++++++++++-------
 pkg/webservice/handlers_test.go | 11 +++++++++++
 pkg/webservice/state_dump.go    |  2 ++
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/pkg/webservice/handlers.go b/pkg/webservice/handlers.go
index 9b30f884..4192093b 100644
--- a/pkg/webservice/handlers.go
+++ b/pkg/webservice/handlers.go
@@ -427,13 +427,7 @@ func getClusterConfig(w http.ResponseWriter, r *http.Request) {
 	var marshalledConf []byte
 	var err error
 
-	// merge core config with extra config
-	schedulerConf := configs.ConfigContext.Get(schedulerContext.GetPolicyGroup())
-	extraConfig := configs.GetConfigMap()
-	conf := dao.ConfigDAOInfo{
-		SchedulerConfig: schedulerConf,
-		Extra:           extraConfig,
-	}
+	conf := getClusterConfigDAO()
 
 	// check if we have a request for json output
 	if r.Header.Get("Accept") == "application/json" {
@@ -450,6 +444,16 @@ func getClusterConfig(w http.ResponseWriter, r *http.Request) {
 	}
 }
 
+func getClusterConfigDAO() *dao.ConfigDAOInfo {
+	// merge core config with extra config
+	conf := dao.ConfigDAOInfo{
+		SchedulerConfig: configs.ConfigContext.Get(schedulerContext.GetPolicyGroup()),
+		Extra:           configs.GetConfigMap(),
+	}
+
+	return &conf
+}
+
 func checkHealthStatus(w http.ResponseWriter, r *http.Request) {
 	writeHeaders(w)
 
diff --git a/pkg/webservice/handlers_test.go b/pkg/webservice/handlers_test.go
index 5dc978c6..d8a5197c 100644
--- a/pkg/webservice/handlers_test.go
+++ b/pkg/webservice/handlers_test.go
@@ -1292,6 +1292,15 @@ func TestValidateQueue(t *testing.T) {
 }
 
 func TestFullStateDumpPath(t *testing.T) {
+	original := configs.GetConfigMap()
+	defer func() {
+		configs.SetConfigMap(original)
+	}()
+	configMap := map[string]string{
+		"log.level": "WARN",
+	}
+	configs.SetConfigMap(configMap)
+
 	schedulerContext = prepareSchedulerContext(t, false)
 
 	partitionContext := schedulerContext.GetPartitionMapClone()
@@ -1622,4 +1631,6 @@ func verifyStateDumpJSON(t *testing.T, aggregated *AggregatedStateInfo) {
 	assert.Check(t, len(aggregated.ClusterInfo) > 0)
 	assert.Check(t, len(aggregated.Queues) > 0)
 	assert.Check(t, len(aggregated.LogLevel) > 0)
+	assert.Check(t, len(aggregated.Config.SchedulerConfig.Partitions) > 0)
+	assert.Check(t, len(aggregated.Config.Extra) > 0)
 }
diff --git a/pkg/webservice/state_dump.go b/pkg/webservice/state_dump.go
index fbb14026..c607d175 100644
--- a/pkg/webservice/state_dump.go
+++ b/pkg/webservice/state_dump.go
@@ -47,6 +47,7 @@ type AggregatedStateInfo struct {
 	Queues           []dao.PartitionQueueDAOInfo      `json:"queues,omitempty"`
 	RMDiagnostics    map[string]interface{}           `json:"rmDiagnostics,omitempty"`
 	LogLevel         string                           `json:"logLevel,omitempty"`
+	Config           *dao.ConfigDAOInfo               `json:"config,omitempty"`
 }
 
 func getFullStateDump(w http.ResponseWriter, r *http.Request) {
@@ -80,6 +81,7 @@ func doStateDump(w io.Writer) error {
 		Queues:           getPartitionQueuesDAO(partitionContext),
 		RMDiagnostics:    getResourceManagerDiagnostics(),
 		LogLevel:         zapConfig.Level.Level().String(),
+		Config:           getClusterConfigDAO(),
 	}
 
 	var prettyJSON []byte


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