Skip to content

Commit

Permalink
fix grammar error in globalmanager module
Browse files Browse the repository at this point in the history
Signed-off-by: xujingjing <[email protected]>
  • Loading branch information
xujingjing-cmss authored and xujingjing committed Nov 29, 2021
1 parent f4ca2ff commit 000c989
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion pkg/globalmanager/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func NewDefaultControllerConfig() *ControllerConfig {
}
}

// Config singlton for GM
// Config singleton for GM
var Config ControllerConfig

// InitConfigure inits config
Expand Down
38 changes: 19 additions & 19 deletions pkg/globalmanager/controllers/federatedlearning/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,32 @@ func (c *Controller) updateModelMetrics(jobName, namespace string, metrics []sed
modelName := job.Spec.AggregationWorker.Model.Name
client := c.client.Models(namespace)

return runtime.RetryUpdateStatus(modelName, namespace, (func() error {
model, err := client.Get(context.TODO(), modelName, metav1.GetOptions{})
if err != nil {
return err
}
return runtime.RetryUpdateStatus(modelName, namespace, func() error {
model, err := client.Get(context.TODO(), modelName, metav1.GetOptions{})
if err != nil {
return err
}

now := metav1.Now()
model.Status.UpdateTime = &now
model.Status.Metrics = metrics
_, err = client.UpdateStatus(context.TODO(), model, metav1.UpdateOptions{})
return err
}))
now := metav1.Now()
model.Status.UpdateTime = &now
model.Status.Metrics = metrics
_, err = client.UpdateStatus(context.TODO(), model, metav1.UpdateOptions{})
return err
})
}

func (c *Controller) appendStatusCondition(name, namespace string, cond sednav1.FLJobCondition) error {
client := c.client.FederatedLearningJobs(namespace)

return runtime.RetryUpdateStatus(name, namespace, (func() error {
job, err := client.Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
return runtime.RetryUpdateStatus(name, namespace, func() error {
job, err := client.Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
return err
}
job.Status.Conditions = append(job.Status.Conditions, cond)
_, err = client.UpdateStatus(context.TODO(), job, metav1.UpdateOptions{})
return err
}
job.Status.Conditions = append(job.Status.Conditions, cond)
_, err = client.UpdateStatus(context.TODO(), job, metav1.UpdateOptions{})
return err
}))
})
}

// updateFromEdge updates the federated job's status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,15 @@ func (c *Controller) addJobAnnotations(job *sednav1.IncrementalLearningJob, key
// transitJobState transit job to next state
func (c *Controller) transitJobState(job *sednav1.IncrementalLearningJob) (bool, error) {
var initialType sednav1.ILJobStageConditionType
var latestCondition sednav1.ILJobCondition = sednav1.ILJobCondition{
var latestCondition = sednav1.ILJobCondition{
Stage: sednav1.ILJobTrain,
Type: initialType,
}

var newConditionType sednav1.ILJobStageConditionType
var needUpdated = false

var podStatus v1.PodPhase = v1.PodUnknown
var podStatus = v1.PodUnknown
var pod *v1.Pod

jobConditions := job.Status.Conditions
Expand Down
20 changes: 10 additions & 10 deletions pkg/globalmanager/controllers/incrementallearning/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

type Model = runtime.Model

// the data of this condition including the input/output to do the next step
// IncrementalCondData the data of this condition including the input/output to do the next step
type IncrementalCondData struct {
Input *struct {
// Only one model cases
Expand Down Expand Up @@ -86,15 +86,15 @@ func (cd IncrementalCondData) Marshal() ([]byte, error) {

func (c *Controller) appendStatusCondition(name, namespace string, cond sednav1.ILJobCondition) error {
client := c.client.IncrementalLearningJobs(namespace)
return runtime.RetryUpdateStatus(name, namespace, (func() error {
job, err := client.Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
return runtime.RetryUpdateStatus(name, namespace, func() error {
job, err := client.Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
return err
}
job.Status.Conditions = append(job.Status.Conditions, cond)
_, err = client.UpdateStatus(context.TODO(), job, metav1.UpdateOptions{})
return err
}
job.Status.Conditions = append(job.Status.Conditions, cond)
_, err = client.UpdateStatus(context.TODO(), job, metav1.UpdateOptions{})
return err
}))
})
}

// updateFromEdge syncs the edge updates to k8s
Expand Down Expand Up @@ -152,7 +152,7 @@ func (c *Controller) updateFromEdge(name, namespace, operation string, content [

err = c.appendStatusCondition(name, namespace, cond)
if err != nil {
return fmt.Errorf("failed to append condition, err:%+w", err)
return fmt.Errorf("failed to append condition, err:%w", err)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/globalmanager/controllers/jointinference/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (c *Controller) updateFromEdge(name, namespace, operation string, content [

err = c.updateMetrics(name, namespace, metrics)
if err != nil {
return fmt.Errorf("failed to update metrics, err:%+w", err)
return fmt.Errorf("failed to update metrics, err:%w", err)
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (c *Controller) syncToEdge(eventType watch.EventType, obj interface{}) erro
// Here only propagate to the nodes with non empty name

// FIXME(llhuii): only the case that all workers having the same nodeName are support,
// will support Spec.NodeSelector and differenect nodeName.
// will support Spec.NodeSelector and different nodeName.
nodeName := job.Spec.TrainSpec.Template.Spec.NodeName
if len(nodeName) == 0 {
return fmt.Errorf("empty node name")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (c *Controller) sync(key string) (bool, error) {
// transit this job's state machine
needUpdated, err = c.transitJobState(&job)
if err != nil {
klog.V(2).Infof("lifelonglearning job %v/%v faied to be updated, err:%s", job.Namespace, job.Name, err)
klog.V(2).Infof("lifelonglearning job %v/%v failed to be updated, err:%s", job.Namespace, job.Name, err)
}

if needUpdated {
Expand All @@ -297,15 +297,15 @@ func (c *Controller) sync(key string) (bool, error) {
// transitJobState transit job to next state
func (c *Controller) transitJobState(job *sednav1.LifelongLearningJob) (bool, error) {
var initialType sednav1.LLJobStageConditionType
var latestCondition sednav1.LLJobCondition = sednav1.LLJobCondition{
var latestCondition = sednav1.LLJobCondition{
Stage: sednav1.LLJobTrain,
Type: initialType,
}

var newConditionType sednav1.LLJobStageConditionType
var needUpdated = false

var podStatus v1.PodPhase = v1.PodUnknown
var podStatus = v1.PodUnknown
jobConditions := job.Status.Conditions
if len(jobConditions) > 0 {
// get latest pod and pod status
Expand Down Expand Up @@ -541,7 +541,7 @@ func (c *Controller) createPod(job *sednav1.LifelongLearningJob, podtype sednav1
originalDataURLOrIndex = dataset.Spec.URL
}

var workerParam *runtime.WorkerParam = new(runtime.WorkerParam)
var workerParam = new(runtime.WorkerParam)
if podtype == sednav1.LLJobTrain {
workerParam.WorkerType = "Train"

Expand Down Expand Up @@ -672,7 +672,7 @@ func (c *Controller) createInferPod(job *sednav1.LifelongLearningJob) error {
return err
}

var workerParam *runtime.WorkerParam = new(runtime.WorkerParam)
var workerParam = new(runtime.WorkerParam)
workerParam.Mounts = append(workerParam.Mounts,
runtime.WorkerMount{
URL: &runtime.MountURL{
Expand Down
4 changes: 2 additions & 2 deletions pkg/globalmanager/controllers/lifelonglearning/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (

type Model = runtime.Model

// the data of this condition including the input/output to do the next step
// ConditionData the data of this condition including the input/output to do the next step
type ConditionData struct {
Input *struct {
// Only one model cases
Expand Down Expand Up @@ -154,7 +154,7 @@ func (c *Controller) updateFromEdge(name, namespace, operation string, content [

err = c.appendStatusCondition(name, namespace, cond)
if err != nil {
return fmt.Errorf("failed to append condition, err:%+w", err)
return fmt.Errorf("failed to append condition, err:%w", err)
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func (c *Controller) sync(key string) (bool, error) {
// neededPodCounts indicates the num of tracking worker pods should be created successfully in a objectsearch service currently.
// neededDeploymentCounts indicates the num of deployments should be created successfully in a objectsearch service currently,
// and one deployment is for userWorker and the other deployment is for reidWorkers.
var neededPodCounts int32 = int32(len(service.Spec.TrackingWorkers))
var neededPodCounts = int32(len(service.Spec.TrackingWorkers))
var neededDeploymentCounts int32 = 2

activePods := runtime.CalcActivePodCount(pods)
Expand Down

0 comments on commit 000c989

Please sign in to comment.