Skip to content

Commit

Permalink
feat: scheduler addresses log (#1183)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi committed Jun 28, 2023
1 parent 738e5ed commit 04bd2ea
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 10 deletions.
5 changes: 3 additions & 2 deletions client/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,8 @@ func (cd *clientDaemon) Stop() {
func (cd *clientDaemon) OnNotify(data *config.DynconfigData) {
ips := getSchedulerIPs(data.Schedulers)
if reflect.DeepEqual(cd.schedulers, data.Schedulers) {
logger.Infof("scheduler addresses deep equal: %v", ips)
logger.Infof("scheduler addresses deep equal: %v, used: %#v",
ips, cd.schedulerClient.GetState())
return
}

Expand All @@ -575,7 +576,7 @@ func (cd *clientDaemon) OnNotify(data *config.DynconfigData) {
cd.schedulerClient.UpdateState(addrs)
cd.schedulers = data.Schedulers

logger.Infof("scheduler addresses have been updated: %v", ips)
logger.Infof("scheduler addresses have been updated: %#v", addrs)
}

// getSchedulerIPs get ips by schedulers.
Expand Down
4 changes: 4 additions & 0 deletions client/daemon/peer/peertask_dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func (d *dummySchedulerClient) Close() error {
func (d *dummySchedulerClient) UpdateState(addrs []dfnet.NetAddr) {
}

func (d *dummySchedulerClient) GetState() []dfnet.NetAddr {
return nil
}

type dummyPeerPacketStream struct {
}

Expand Down
16 changes: 16 additions & 0 deletions client/daemon/peer/peertask_manager_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion client/daemon/test/mock/scheduler/scheduler_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,3 +440,7 @@ func (conn *Connection) UpdateState(addrs []dfnet.NetAddr) {

logger.GrpcLogger.Infof("update grpc client addresses %v", addresses)
}

func (conn *Connection) GetState() []dfnet.NetAddr {
return conn.serverNodes
}
6 changes: 3 additions & 3 deletions pkg/rpc/scheduler/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ type SchedulerClient interface {

LeaveTask(context.Context, *scheduler.PeerTarget, ...grpc.CallOption) error

UpdateState(addrs []dfnet.NetAddr)
UpdateState([]dfnet.NetAddr)

GetState() []dfnet.NetAddr

Close() error
}
Expand Down Expand Up @@ -239,5 +241,3 @@ func (sc *schedulerClient) LeaveTask(ctx context.Context, pt *scheduler.PeerTarg
}
return
}

var _ SchedulerClient = (*schedulerClient)(nil)
22 changes: 18 additions & 4 deletions pkg/rpc/scheduler/client/mocks/client_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 04bd2ea

Please sign in to comment.