Github user aljoscha commented on the issue:
https://github.com/apache/flink/pull/3921
I think we can get by without changing `ClusterClient` and
`ContextEnvironment` by only reading the parallelism from the global config in
`CliFrontend` when trying to read the user parallelism from the parameters,
i.e. in `run()` and `info()`. In the example of `run()` we could change this
code:
```
int userParallelism = options.getParallelism();
LOG.debug("User parallelism is set to {}", userParallelism);
if (client.getMaxSlots() != -1 && userParallelism == -1) {
logAndSysout("Using the parallelism provided by the remote cluster ("
+ client.getMaxSlots() + "). "
+ "To use another parallelism, set it at the ./bin/flink
client.");
userParallelism = client.getMaxSlots();
}
return executeProgram(program, client, userParallelism);
```
to this
```
int parallelism = options.getParallelism();
LOG.debug("User parallelism is set to {}", parallelism);
if (client.getMaxSlots() != -1 && parallelism == -1) {
logAndSysout("Using the parallelism provided by the remote cluster ("
+ client.getMaxSlots() + "). "
+ "To use another parallelism, set it at the ./bin/flink
client.");
parallelism = client.getMaxSlots();
} else if (parallelism == ExecutionConfig.PARALLELISM_DEFAULT) {
parallelism = GlobalConfiguration.loadConfiguration().getInteger(
ConfigConstants.DEFAULT_PARALLELISM_KEY,
ConfigConstants.DEFAULT_PARALLELISM);
}
return executeProgram(program, client, parallelism);
```
with this change `StreamContextEnvironment` would simply need this:
```
if (ctx.getParallelism() > 0) {
setParallelism(ctx.getParallelism());
}
```
because the environment will have the default parallelism set (in
`ContextEnvironmentFactory`
https://github.com/apache/flink/blob/c793ea41d88fe84fa97d825728ad95f35e27ef82/flink-clients/src/main/java/org/apache/flink/client/program/ContextEnvironmentFactory.java#L52-L52)
What do you think?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---