本文整理汇总了Java中org.apache.flink.api.common.ExecutionConfig.PARALLELISM_DEFAULT属性的典型用法代码示例。如果您正苦于以下问题:Java ExecutionConfig.PARALLELISM_DEFAULT属性的具体用法?Java ExecutionConfig.PARALLELISM_DEFAULT怎么用?Java ExecutionConfig.PARALLELISM_DEFAULT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.flink.api.common.ExecutionConfig
的用法示例。
在下文中一共展示了ExecutionConfig.PARALLELISM_DEFAULT属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConfigurationOfParallelism
@Test
public void testConfigurationOfParallelism() {
Operator operator = new MockOperator();
// verify explicit change in parallelism
int parallelism = 36;
operator.setParallelism(parallelism);
assertEquals(parallelism, operator.getParallelism());
// verify that parallelism is reset to default flag value
parallelism = ExecutionConfig.PARALLELISM_DEFAULT;
operator.setParallelism(parallelism);
assertEquals(parallelism, operator.getParallelism());
}
示例2: getOptimizerPlanAsJSON
/**
* Creates a JSON representation of the given dataflow's execution plan.
*
* @param plan The dataflow plan.
* @return The dataflow's execution plan, as a JSON string.
* @throws Exception Thrown, if the optimization process that creates the execution plan failed.
*/
@Override
public String getOptimizerPlanAsJSON(Plan plan) throws Exception {
final int parallelism = plan.getDefaultParallelism() == ExecutionConfig.PARALLELISM_DEFAULT ? 1 : plan.getDefaultParallelism();
Optimizer pc = new Optimizer(new DataStatistics(), this.configuration);
pc.setDefaultParallelism(parallelism);
OptimizedPlan op = pc.compile(plan);
return new PlanJSONDumpGenerator().getOptimizerPlanAsJSON(op);
}
示例3: optimizerPlanAsJSON
/**
* Creates a JSON representation of the given dataflow's execution plan.
*
* @param plan The dataflow plan.
* @return The dataflow's execution plan, as a JSON string.
* @throws Exception Thrown, if the optimization process that creates the execution plan failed.
*/
public static String optimizerPlanAsJSON(Plan plan) throws Exception {
final int parallelism = plan.getDefaultParallelism() == ExecutionConfig.PARALLELISM_DEFAULT ? 1 : plan.getDefaultParallelism();
Optimizer pc = new Optimizer(new DataStatistics(), new Configuration());
pc.setDefaultParallelism(parallelism);
OptimizedPlan op = pc.compile(plan);
return new PlanJSONDumpGenerator().getOptimizerPlanAsJSON(op);
}
示例4: getParallelism
public int getParallelism() {
if (parallelism == ExecutionConfig.PARALLELISM_DEFAULT) {
return env.getParallelism();
} else {
return parallelism;
}
}
示例5: toString
@Override
public String toString() {
return "Local Environment (parallelism = " + (getParallelism() == ExecutionConfig.PARALLELISM_DEFAULT ? "default" : getParallelism())
+ ") : " + getIdString();
}
示例6: toString
@Override
public String toString() {
return "Context Environment (parallelism = " + (getParallelism() == ExecutionConfig.PARALLELISM_DEFAULT ? "default" : getParallelism())
+ ") : " + getIdString();
}
示例7: info
/**
* Executes the info action.
*
* @param args Command line arguments for the info action.
*/
protected void info(String[] args) throws CliArgsException, FileNotFoundException, ProgramInvocationException {
LOG.info("Running 'info' command.");
final Options commandOptions = CliFrontendParser.getInfoCommandOptions();
final CommandLine commandLine = CliFrontendParser.parse(commandOptions, args, true);
InfoOptions infoOptions = new InfoOptions(commandLine);
// evaluate help flag
if (infoOptions.isPrintHelp()) {
CliFrontendParser.printHelpForInfo();
return;
}
if (infoOptions.getJarFilePath() == null) {
throw new CliArgsException("The program JAR file was not specified.");
}
// -------- build the packaged program -------------
LOG.info("Building program from JAR file");
final PackagedProgram program = buildProgram(infoOptions);
try {
int parallelism = infoOptions.getParallelism();
if (ExecutionConfig.PARALLELISM_DEFAULT == parallelism) {
parallelism = defaultParallelism;
}
LOG.info("Creating program plan dump");
Optimizer compiler = new Optimizer(new DataStatistics(), new DefaultCostEstimator(), configuration);
FlinkPlan flinkPlan = ClusterClient.getOptimizedPlan(compiler, program, parallelism);
String jsonPlan = null;
if (flinkPlan instanceof OptimizedPlan) {
jsonPlan = new PlanJSONDumpGenerator().getOptimizerPlanAsJSON((OptimizedPlan) flinkPlan);
} else if (flinkPlan instanceof StreamingPlan) {
jsonPlan = ((StreamingPlan) flinkPlan).getStreamingPlanAsJSON();
}
if (jsonPlan != null) {
System.out.println("----------------------- Execution Plan -----------------------");
System.out.println(jsonPlan);
System.out.println("--------------------------------------------------------------");
}
else {
System.out.println("JSON plan could not be generated.");
}
String description = program.getDescription();
if (description != null) {
System.out.println();
System.out.println(description);
}
else {
System.out.println();
System.out.println("No description provided.");
}
}
finally {
program.deleteExtractedLibraries();
}
}
示例8: setParallelism
/**
* Sets the parallelism for this optimizer node.
* The parallelism denotes how many parallel instances of the operator will be
* spawned during the execution.
*
* @param parallelism The parallelism to set. If this value is {@link ExecutionConfig#PARALLELISM_DEFAULT}
* then the system will take the default number of parallel instances.
* @throws IllegalArgumentException If the parallelism is smaller than one.
*/
public void setParallelism(int parallelism) {
if (parallelism < 1 && parallelism != ExecutionConfig.PARALLELISM_DEFAULT) {
throw new IllegalArgumentException("Parallelism of " + parallelism + " is invalid.");
}
this.parallelism = parallelism;
}