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

implement task handling for master server's service #2245

Merged
merged 4 commits into from
May 25, 2017

Conversation

helinwang
Copy link
Contributor

No description provided.

port := flag.Int("p", 0, "port of the master server")
dataset := flag.String("d", "", "dataset: comma separated path to RecordIO files")
faultTolerant := flag.Bool("fault-tolerance", false, "enable fault tolerance (requires etcd).")
flag.Parse()
Copy link
Contributor

Choose a reason for hiding this comment

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

Flags should be able to load from environment variables, so that we can run on cloud.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Understood. I did a search, it seems that this https://github.com/spf13/viper repo has many stars. Not sure if it might be helpful.

Copy link
Contributor Author

@helinwang helinwang May 25, 2017

Choose a reason for hiding this comment

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

I will add reading flag being load from env variables. @typhoonzero just curious, how good is k8s' support for pod command line arguments? And what are the best practices for building cloud-native applications? (I think you mentioned pass arguments by env variable, and print log to stdout before. Do you have any good article in mind from which I could read more detail?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@typhoonzero @wangkuiyi Done. Using https://github.com/namsral/flag, it's a drop-in replacement for flag, adding support for environment variable and plain config file. I think https://github.com/spf13/viper probably is an overkill for the current situation (viper supports loading and monitoring config etcd, ...) And it have different syntax than the offical flag package, harder to learn / maintain.

Copy link
Contributor

Choose a reason for hiding this comment

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

@helinwang

the best practices for building cloud-native applications

The most famous one is "12-factor" app: https://12factor.net

For apps on kubernetes, there are generally 3 ways to pass arguments to program:

  1. Via environment variables, kubernetes can also pass pod dynamic status info through environment variables using downwardAPI
  2. Via command-line arguments, specify arguments manually
  3. Via configuration files through mounting a "config map" to pod


func main() {
port := flag.Int("p", 0, "port of the master server")
dataset := flag.String("d", "", "dataset: comma separated path to RecordIO files")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should dataset be a list of dirs, for file lists may be very large. It's even better to user wildcards to specify dataset, like /path/to/my/files/myfile-00*.recordio

Copy link
Collaborator

Choose a reason for hiding this comment

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

-d ==> -training_dataset?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@typhoonzero Done. Added support for glob pattern. But not supporting list of dirs, I think directory is too coarse, it's hard to specify what should happen when there is a non-recordIO format under that directory.
@wangkuiyi Done.

)

const (
targetTaskCount = 300
Copy link
Contributor

Choose a reason for hiding this comment

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

targetTaskCount should be configurable. Or config chunkPerTask

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Changed to chunksPerTask.

)

func main() {
port := flag.Int("p", 0, "port of the master server")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can specify a default port instead of a random port, such as 8080.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we use long names for command line parameters? For example, -p to -addr?

Copy link
Contributor Author

@helinwang helinwang May 25, 2017

Choose a reason for hiding this comment

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

@Yancey1989 Good point! Done.
@wangkuiyi Agree with long names, changed to port, maybe port is more precise than addr?

@helinwang helinwang merged commit 7af0268 into PaddlePaddle:develop May 25, 2017
@helinwang helinwang deleted the master_server branch May 25, 2017 22:00
heavengate pushed a commit to heavengate/Paddle that referenced this pull request Aug 16, 2021
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.

4 participants