141
141
142
142
import org .apache .hadoop .classification .VisibleForTesting ;
143
143
144
- import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .GET_NEW_APP ;
145
- import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .SUBMIT_NEW_APP ;
146
- import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .GET_APP_REPORT ;
147
- import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .FORCE_KILL_APP ;
148
- import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .TARGET_CLIENT_RM_SERVICE ;
149
- import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .UNKNOWN ;
144
+ import static org .apache .hadoop .yarn .server .router .RouterAuditLogger .AuditConstants .*;
150
145
151
146
/**
152
147
* Extends the {@code AbstractRequestInterceptorClient} class and provides an
@@ -811,6 +806,8 @@ public GetApplicationsResponse getApplications(GetApplicationsRequest request)
811
806
throws YarnException , IOException {
812
807
if (request == null ) {
813
808
routerMetrics .incrMultipleAppsFailedRetrieved ();
809
+ RouterAuditLogger .logFailure (user .getShortUserName (), GET_APPLICATIONS , UNKNOWN ,
810
+ TARGET_CLIENT_RM_SERVICE , "Missing getApplications request." );
814
811
RouterServerUtil .logAndThrowException ("Missing getApplications request." , null );
815
812
}
816
813
long startTime = clock .getTime ();
@@ -834,6 +831,8 @@ public GetClusterMetricsResponse getClusterMetrics(
834
831
GetClusterMetricsRequest request ) throws YarnException , IOException {
835
832
if (request == null ) {
836
833
routerMetrics .incrGetClusterMetricsFailedRetrieved ();
834
+ RouterAuditLogger .logFailure (user .getShortUserName (), GET_CLUSTERMETRICS , UNKNOWN ,
835
+ TARGET_CLIENT_RM_SERVICE , "Missing getApplications request." );
837
836
RouterServerUtil .logAndThrowException ("Missing getClusterMetrics request." , null );
838
837
}
839
838
long startTime = clock .getTime ();
@@ -888,7 +887,7 @@ <R> Collection<R> invokeConcurrent(ClientMethod request, Class<R> clazz)
888
887
results .put (subClusterId , clazz .cast (result ));
889
888
} catch (InterruptedException | ExecutionException e ) {
890
889
Throwable cause = e .getCause ();
891
- LOG .error ("Cannot execute {} on {}: {}" , request .getMethodName (),
890
+ LOG .error ("Cannot execute {} on {} : {}" , request .getMethodName (),
892
891
subClusterId .getId (), cause .getMessage ());
893
892
exceptions .put (subClusterId , e );
894
893
}
@@ -914,6 +913,8 @@ public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request)
914
913
throws YarnException , IOException {
915
914
if (request == null ) {
916
915
routerMetrics .incrClusterNodesFailedRetrieved ();
916
+ RouterAuditLogger .logFailure (user .getShortUserName (), GET_CLUSTERNODES , UNKNOWN ,
917
+ TARGET_CLIENT_RM_SERVICE , "Missing getClusterNodes request." );
917
918
RouterServerUtil .logAndThrowException ("Missing getClusterNodes request." , null );
918
919
}
919
920
long startTime = clock .getTime ();
@@ -937,6 +938,8 @@ public GetQueueInfoResponse getQueueInfo(GetQueueInfoRequest request)
937
938
throws YarnException , IOException {
938
939
if (request == null || request .getQueueName () == null ) {
939
940
routerMetrics .incrGetQueueInfoFailedRetrieved ();
941
+ RouterAuditLogger .logFailure (user .getShortUserName (), GET_QUEUEINFO , UNKNOWN ,
942
+ TARGET_CLIENT_RM_SERVICE , "Missing getQueueInfo request or queueName." );
940
943
RouterServerUtil .logAndThrowException ("Missing getQueueInfo request or queueName." , null );
941
944
}
942
945
@@ -962,6 +965,8 @@ public GetQueueUserAclsInfoResponse getQueueUserAcls(
962
965
GetQueueUserAclsInfoRequest request ) throws YarnException , IOException {
963
966
if (request == null ){
964
967
routerMetrics .incrQueueUserAclsFailedRetrieved ();
968
+ RouterAuditLogger .logFailure (user .getShortUserName (), GET_QUEUE_USER_ACLS , UNKNOWN ,
969
+ TARGET_CLIENT_RM_SERVICE , "Missing getQueueUserAcls request." );
965
970
RouterServerUtil .logAndThrowException ("Missing getQueueUserAcls request." , null );
966
971
}
967
972
long startTime = clock .getTime ();
@@ -986,6 +991,9 @@ public MoveApplicationAcrossQueuesResponse moveApplicationAcrossQueues(
986
991
throws YarnException , IOException {
987
992
if (request == null || request .getApplicationId () == null || request .getTargetQueue () == null ) {
988
993
routerMetrics .incrMoveApplicationAcrossQueuesFailedRetrieved ();
994
+ RouterAuditLogger .logFailure (user .getShortUserName (), GET_QUEUE_USER_ACLS , UNKNOWN ,
995
+ TARGET_CLIENT_RM_SERVICE , "Missing moveApplicationAcrossQueues request or " +
996
+ "applicationId or target queue." );
989
997
RouterServerUtil .logAndThrowException ("Missing moveApplicationAcrossQueues request or " +
990
998
"applicationId or target queue." , null );
991
999
}
@@ -999,8 +1007,8 @@ public MoveApplicationAcrossQueuesResponse moveApplicationAcrossQueues(
999
1007
.getApplicationHomeSubCluster (applicationId );
1000
1008
} catch (YarnException e ) {
1001
1009
routerMetrics .incrMoveApplicationAcrossQueuesFailedRetrieved ();
1002
- RouterServerUtil .logAndThrowException ("Application " +
1003
- applicationId + " does not exist in FederationStateStore." , e );
1010
+ RouterServerUtil .logAndThrowException (e , "Application %s does not exist in FederationStateStore." ,
1011
+ applicationId );
1004
1012
}
1005
1013
1006
1014
ApplicationClientProtocol clientRMProxy = getClientRMProxyForSubCluster (subClusterId );
@@ -1009,8 +1017,9 @@ public MoveApplicationAcrossQueuesResponse moveApplicationAcrossQueues(
1009
1017
response = clientRMProxy .moveApplicationAcrossQueues (request );
1010
1018
} catch (Exception e ) {
1011
1019
routerMetrics .incrMoveApplicationAcrossQueuesFailedRetrieved ();
1012
- RouterServerUtil .logAndThrowException ("Unable to moveApplicationAcrossQueues for " +
1013
- applicationId + " to SubCluster " + subClusterId .getId (), e );
1020
+ RouterServerUtil .logAndThrowException (e ,
1021
+ "Unable to moveApplicationAcrossQueues for %s to SubCluster %s." , applicationId ,
1022
+ subClusterId .getId ());
1014
1023
}
1015
1024
1016
1025
if (response == null ) {
0 commit comments