Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate CRD TrainingJob structure #12

Merged
merged 2 commits into from
Mar 16, 2018

Conversation

m3ngyang
Copy link
Collaborator

This pr comes from PaddlePaddle/PaddleCloud#642 , including two parts:

  1. the new struct of TrainingJob
  2. the generated tool codes for TrainingJob

Copy link
Collaborator

@typhoonzero typhoonzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix the CI errors

@putcn
Copy link
Collaborator

putcn commented Mar 15, 2018

CI issue is caused by pre-commit, see #10 , merge that change will get this fixed.

@m3ngyang
Copy link
Collaborator Author

Conflicts fixed.

Copy link
Collaborator

@typhoonzero typhoonzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM++

@m3ngyang m3ngyang merged commit 760373e into elasticdeeplearning:develop_CRD Mar 16, 2018
}

// addKnownTypes adds the set of types defined in this package to the supplied scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe don't return error if it's not possible to have error. Otherwise the caller need to unnecessarily handle it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the parameter of the caller function NewSchemeBuilder is funcs ...func(*Scheme) error, we must return nil even if there is no error.


// CRDName returns name of crd
func CRDName() string {
return fmt.Sprintf("%s.%s", CRDKindPlural, CRDGroup)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just return CRDKindPlural + "." + CRDGroup, which will be optimized to a compile time constant. Anyway, this is very minor, fmt.Sprintf() is very fast anyway.


const (
// MASTER is the master name of TrainingResourceType.
MASTER TrainingResourceType = "MASTER"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a Kubernetes convention to have it named all capital case (MASTER vs Master). The Go convention is camel case (Master).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change the format in the next pr.

// This package is generated by client-gen with custom arguments.

// Package fake has the automatically generated clients.
package fake
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious what does "fake" package do? Is it something generated and used by Kubernetes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The packages under client are auto-generated by the official tool k8s.io/code-generator, and fake clientset that can be used in tests.

return informers
}()

res := map[reflect.Type]bool{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is f.lock.Lock() required here?

Paddlepaddle() paddlepaddle.Interface
}

func (f *sharedInformerFactory) Paddlepaddle() paddlepaddle.Interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is a little strange, typically developer calls paddlepaddle.New(f), rather than f.Paddlepaddle(). Is it a Kubernetes convention?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants