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

Added Parallelism configuration option to lakectl #8283

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions cmd/lakectl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ type Configuration struct {
EndpointURL lakefsconfig.OnlyString `mapstructure:"endpoint_url"`
Retries RetriesCfg `mapstructure:"retries"`
} `mapstructure:"server"`
Options struct {
Parallelism int `mapstructure:"parallelism"`
} `mapstructure:"options"`
Metastore struct {
Type lakefsconfig.OnlyString `mapstructure:"type"`
Hive struct {
Expand Down Expand Up @@ -153,9 +156,9 @@ const (
parallelismFlagName = "parallelism"
noProgressBarFlagName = "no-progress"

defaultSyncParallelism = 25
defaultSyncPresign = true
defaultNoProgress = false
defaultParallelism = 25
defaultSyncPresign = true
defaultNoProgress = false

myRepoExample = "lakefs://my-repo"
myBucketExample = "s3://my-bucket"
Expand All @@ -178,7 +181,7 @@ func withRecursiveFlag(cmd *cobra.Command, usage string) {
}

func withParallelismFlag(cmd *cobra.Command) {
cmd.Flags().IntP(parallelismFlagName, "p", defaultSyncParallelism,
cmd.Flags().IntP(parallelismFlagName, "p", defaultParallelism,
"Max concurrent operations to perform")
}

Expand Down Expand Up @@ -245,6 +248,10 @@ func getSyncFlags(cmd *cobra.Command, client *apigen.ClientWithResponses) local.
if parallelism < 1 {
DieFmt("Invalid value for parallelism (%d), minimum is 1.\n", parallelism)
}
changed := cmd.Flags().Changed(parallelismFlagName)
if viper.IsSet("options.parallelism") && !changed {
parallelism = cfg.Options.Parallelism
}

presignMode := getPresignMode(cmd, client)
return local.SyncFlags{
Expand Down Expand Up @@ -574,6 +581,5 @@ func initConfig() {
viper.SetDefault("server.retries.min_wait_interval", defaultMinRetryInterval)
viper.SetDefault("experimental.local.posix_permissions.enabled", false)
viper.SetDefault("local.skip_non_regular_files", false)

cfgErr = viper.ReadInConfig()
}
Loading