23
23
import com .dtstack .flink .sql .launcher .factory .YarnClusterClientFactory ;
24
24
import com .dtstack .flink .sql .launcher .utils .JobGraphBuildUtil ;
25
25
import org .apache .commons .lang3 .StringUtils ;
26
- import org .apache .flink .api .common .cache .DistributedCache ;
27
26
import org .apache .flink .client .deployment .ClusterSpecification ;
28
27
import org .apache .flink .client .program .ClusterClientProvider ;
29
28
import org .apache .flink .configuration .Configuration ;
39
38
40
39
import java .io .File ;
41
40
import java .net .MalformedURLException ;
42
- import java .net .URL ;
43
41
import java .util .ArrayList ;
44
42
import java .util .List ;
45
- import java .util .Map ;
46
43
import java .util .Optional ;
47
44
48
45
@@ -58,12 +55,10 @@ public class YarnJobClusterExecutor {
58
55
private static final String CONFIG_FILE_LOG4J_NAME = "log4j.properties" ;
59
56
private static final String DEFAULT_TOTAL_PROCESS_MEMORY = "1024m" ;
60
57
61
- YarnClusterClientFactory yarnClusterClientFactory ;
62
58
JobParamsInfo jobParamsInfo ;
63
59
64
60
public YarnJobClusterExecutor (JobParamsInfo jobParamsInfo ) {
65
61
this .jobParamsInfo = jobParamsInfo ;
66
- yarnClusterClientFactory = new YarnClusterClientFactory ();
67
62
}
68
63
69
64
public void exec () throws Exception {
@@ -75,12 +70,13 @@ public void exec() throws Exception {
75
70
Configuration flinkConfiguration = JobGraphBuildUtil .getFlinkConfiguration (jobParamsInfo .getFlinkConfDir (), jobParamsInfo .getConfProperties ());
76
71
appendApplicationConfig (flinkConfiguration , jobParamsInfo );
77
72
78
- YarnClusterDescriptor clusterDescriptor = (YarnClusterDescriptor ) yarnClusterClientFactory .createClusterDescriptor (jobParamsInfo .getYarnConfDir (), flinkConfiguration );
73
+ YarnClusterDescriptor clusterDescriptor = (YarnClusterDescriptor ) YarnClusterClientFactory .INSTANCE
74
+ .createClusterDescriptor (jobParamsInfo .getYarnConfDir (), flinkConfiguration );
79
75
80
76
List <File > shipFiles = getShipFiles (jobParamsInfo .getFlinkJarPath (), jobParamsInfo .getPluginLoadMode (), jobGraph , clusterDescriptor );
81
77
clusterDescriptor .addShipFiles (shipFiles );
82
78
83
- ClusterSpecification clusterSpecification = yarnClusterClientFactory .getClusterSpecification (flinkConfiguration );
79
+ ClusterSpecification clusterSpecification = YarnClusterClientFactory . INSTANCE .getClusterSpecification (flinkConfiguration );
84
80
ClusterClientProvider <ApplicationId > applicationIdClusterClientProvider = clusterDescriptor .deployJobCluster (clusterSpecification , jobGraph , true );
85
81
86
82
String applicationId = applicationIdClusterClientProvider .getClusterClient ().getClusterId ().toString ();
0 commit comments