[GitHub] [camel-k] astefanutti commented on a diff in pull request #3344: [WIP] configuring maven builds based on CPU quota if set any
astefanutti commented on code in PR #3344: URL: https://github.com/apache/camel-k/pull/3344#discussion_r895658120 ## pkg/util/maven/maven_command.go: ## @@ -74,6 +76,13 @@ func (c *Command) Do(ctx context.Context) error { args = append(args, "--settings", settingsPath) } + if !util.StringContainsPrefix(c.context.AdditionalArguments, "-Dmaven.artifact.threads") { + args = append(args, "-Dmaven.artifact.threads="+strconv.Itoa(runtime.GOMAXPROCS(0))) + } + if !util.StringContainsPrefix(c.context.AdditionalArguments, "-T") { Review Comment: I think that'd be more robust to compare for equality here, as `-T` is too broad, and users are generally using the `-T N` form anyway. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] astefanutti commented on a diff in pull request #3344: [WIP] configuring maven builds based on CPU quota if set any
astefanutti commented on code in PR #3344: URL: https://github.com/apache/camel-k/pull/3344#discussion_r895370106 ## pkg/util/maven/maven_command.go: ## @@ -74,6 +74,17 @@ func (c *Command) Do(ctx context.Context) error { args = append(args, "--settings", settingsPath) } + if GOMAXPROCS, ok := os.LookupEnv("GOMAXPROCS"); ok { + args = append(args, "-Dmaven.artifact.threads="+GOMAXPROCS) + } + + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { + if !strings.Contains(c.context.AdditionalArguments[len(c.context.AdditionalArguments)-1], "-T") { + args = append(args, "-T"+cpuQuota) Review Comment: I think the idea here would be to set the `-T` option based on the `GOMAXPROCS` environment variable, as for the `maven.artifact.threads` option. ## pkg/util/maven/maven_command.go: ## @@ -74,6 +74,17 @@ func (c *Command) Do(ctx context.Context) error { args = append(args, "--settings", settingsPath) } + if GOMAXPROCS, ok := os.LookupEnv("GOMAXPROCS"); ok { + args = append(args, "-Dmaven.artifact.threads="+GOMAXPROCS) Review Comment: It should be checked that the `maven.artifact.threads` option is not already provided in `AdditionalArguments`, to avoid overriding user provided value. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] astefanutti commented on a diff in pull request #3344: [WIP] configuring maven builds based on CPU quota if set any
astefanutti commented on code in PR #3344: URL: https://github.com/apache/camel-k/pull/3344#discussion_r893897547 ## pkg/util/maven/maven_command.go: ## @@ -74,6 +74,14 @@ func (c *Command) Do(ctx context.Context) error { args = append(args, "--settings", settingsPath) } + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { + args = append(args, "--define", "org.apache.camel.container.cpus="+cpuQuota) + } + + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { + args = append(args, "--define", "maven.artifact.threads="+cpuQuota) Review Comment: Yes, unless it’s already provided? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] astefanutti commented on a diff in pull request #3344: [WIP] configuring maven builds based on CPU quota if set any
astefanutti commented on code in PR #3344: URL: https://github.com/apache/camel-k/pull/3344#discussion_r893176091 ## pkg/util/maven/maven_command.go: ## @@ -74,6 +74,14 @@ func (c *Command) Do(ctx context.Context) error { args = append(args, "--settings", settingsPath) } + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { + args = append(args, "--define", "org.apache.camel.container.cpus="+cpuQuota) + } + + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { + args = append(args, "--define", "maven.artifact.threads="+cpuQuota) Review Comment: nit: maybe use the `-D` form to be consistent with the other system properties. ## pkg/util/maven/maven_command.go: ## @@ -74,6 +74,14 @@ func (c *Command) Do(ctx context.Context) error { args = append(args, "--settings", settingsPath) } + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { + args = append(args, "--define", "org.apache.camel.container.cpus="+cpuQuota) + } + + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { Review Comment: Following #2837, I think the `GOMAXPROCS` environment variable can be used here. ## pkg/util/maven/maven_command.go: ## @@ -74,6 +74,14 @@ func (c *Command) Do(ctx context.Context) error { args = append(args, "--settings", settingsPath) } + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { + args = append(args, "--define", "org.apache.camel.container.cpus="+cpuQuota) + } + + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { + args = append(args, "--define", "maven.artifact.threads="+cpuQuota) Review Comment: What about setting the `-T` option as well? ## pkg/util/maven/maven_command.go: ## @@ -74,6 +74,14 @@ func (c *Command) Do(ctx context.Context) error { args = append(args, "--settings", settingsPath) } + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { + args = append(args, "--define", "org.apache.camel.container.cpus="+cpuQuota) + } + + if cpuQuota, ok := os.LookupEnv("CPU_QUOTA"); ok { + args = append(args, "--define", "maven.artifact.threads="+cpuQuota) Review Comment: It should only be added if it's not already present in `AdditionalArguments`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org