12
12
import com .webank .wedatasphere .dss .standard .app .development .utils .DevelopmentOperationUtils ;
13
13
import com .webank .wedatasphere .dss .standard .app .sso .Workspace ;
14
14
import com .webank .wedatasphere .dss .standard .common .desc .AppInstance ;
15
+ import com .webank .wedatasphere .dss .standard .common .desc .AppInstanceImpl ;
15
16
import org .apache .linkis .server .Message ;
16
17
import org .apache .linkis .server .security .SecurityFilter ;
17
18
import org .slf4j .Logger ;
@@ -33,7 +34,9 @@ public class AppConn2LinkisRefExecutionRestfulApi {
33
34
34
35
private static final Logger LOGGER = LoggerFactory .getLogger (AppConn2LinkisRefExecutionRestfulApi .class );
35
36
37
+ private AppInstance emptyAppInstance = new AppInstanceImpl ();
36
38
39
+ // 仅仅用于表示依赖,希望AppConnManagerRestfulApi先完成所有AppConn的加载之后,本Restful再对外提供服务。
37
40
@ Autowired
38
41
private AppConnManagerRestfulApi appConnManagerRestfulApi ;
39
42
@@ -49,8 +52,10 @@ public Message execute(HttpServletRequest request, @RequestBody Map<String, Obje
49
52
OnlyDevelopmentAppConn appConn = (OnlyDevelopmentAppConn ) AppConnManager .getAppConnManager ().getAppConn (appConnName );
50
53
AppInstance appInstance ;
51
54
List <DSSLabel > labels = Arrays .asList (new EnvDSSLabel (labelStr ));
52
- if (appConn .getAppDesc ().getAppInstances ().size () == 1 ) {
53
- appInstance = appConn .getAppDesc ().getAppInstances ().get (0 );
55
+ // 原则上,AppConn2Linkis类型的AppConn,要么一个AppInstance都没有,要么就需按照AppConn的规范去录入AppInstance.
56
+ if (appConn .getAppDesc ().getAppInstances ().isEmpty ()) {
57
+ LOGGER .info ("AppConn {} has no appInstance, use empty appInstance to get operation." , appConnName );
58
+ appInstance = emptyAppInstance ;
54
59
} else {
55
60
appInstance = appConn .getAppDesc ().getAppInstancesByLabels (labels ).get (0 );
56
61
}
@@ -61,6 +66,7 @@ public Message execute(HttpServletRequest request, @RequestBody Map<String, Obje
61
66
developmentRequestRef .setWorkspace (workspace ).setUserName (userName ).setDSSLabels (labels );
62
67
return ((AppConn2LinkisRefExecutionOperation ) developmentOperation ).execute ((RefJobContentRequestRef ) developmentRequestRef );
63
68
}, null , "fetch linkis jobContent from appConn " + appConnName + " failed." );
69
+ LOGGER .info ("user {} transform jobContent from AppConn {} with responseRef {}." , userName , appConnName , DSSCommonUtils .COMMON_GSON .toJson (responseRef ));
64
70
return Message .ok ().data ("executionCode" , responseRef .getCode ()).data ("params" , responseRef .getParams ())
65
71
.data ("engineType" , responseRef .getEngineType ()).data ("runType" , responseRef .getRunType ());
66
72
}
0 commit comments