Skip to content

Commit

Permalink
[YUNIKORN-1983] Add config to statedump
Browse files Browse the repository at this point in the history
  • Loading branch information
brandboat committed Sep 22, 2023
1 parent 418714d commit e66dde7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/webservice/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,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()
Expand Down Expand Up @@ -1629,4 +1638,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.SchedulerConfig.Partitions) > 0)
assert.Check(t, len(aggregated.ExtraConfigs) > 0)
}
5 changes: 5 additions & 0 deletions pkg/webservice/state_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"sync"
"time"

"github.com/apache/yunikorn-core/pkg/common/configs"
yunikornLog "github.com/apache/yunikorn-core/pkg/log"
"github.com/apache/yunikorn-core/pkg/webservice/dao"
)
Expand All @@ -47,6 +48,8 @@ type AggregatedStateInfo struct {
Queues []dao.PartitionQueueDAOInfo `json:"queues,omitempty"`
RMDiagnostics map[string]interface{} `json:"rmDiagnostics,omitempty"`
LogLevel string `json:"logLevel,omitempty"`
SchedulerConfig *configs.SchedulerConfig `json:"schedulerConfig,omitempty"`
ExtraConfigs map[string]string `json:"extraConfigs,omitempty"`
}

func getFullStateDump(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -80,6 +83,8 @@ func doStateDump(w io.Writer) error {
Queues: getPartitionQueuesDAO(partitionContext),
RMDiagnostics: getResourceManagerDiagnostics(),
LogLevel: zapConfig.Level.Level().String(),
SchedulerConfig: configs.ConfigContext.Get(schedulerContext.GetPolicyGroup()),
ExtraConfigs: configs.GetConfigMap(),
}

var prettyJSON []byte
Expand Down

0 comments on commit e66dde7

Please sign in to comment.