Skip to content

Commit 90e9aa2

Browse files
authored
YARN-11484. [Federation] Router Supports Yarn Client CLI Cmds. (#6132)
1 parent d9a6792 commit 90e9aa2

File tree

18 files changed

+777
-15
lines changed

18 files changed

+777
-15
lines changed

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,12 @@ public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(
399399
return client.getQueueInfo(queueName);
400400
}
401401

402+
@Override
403+
public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(
404+
String queueName, String subClusterId) throws YarnException, IOException {
405+
return client.getQueueInfo(queueName, subClusterId);
406+
}
407+
402408
@Override
403409
public List<org.apache.hadoop.yarn.api.records.QueueInfo> getAllQueues()
404410
throws YarnException, IOException {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueInfoRequest.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ public abstract class GetQueueInfoRequest {
4646
return request;
4747
}
4848

49+
@Public
50+
@Stable
51+
public static GetQueueInfoRequest newInstance(String queueName, boolean includeApplications,
52+
boolean includeChildQueues, boolean recursive, String subClusterId) {
53+
GetQueueInfoRequest request = Records.newRecord(GetQueueInfoRequest.class);
54+
request.setQueueName(queueName);
55+
request.setIncludeApplications(includeApplications);
56+
request.setIncludeChildQueues(includeChildQueues);
57+
request.setRecursive(recursive);
58+
request.setSubClusterId(subClusterId);
59+
return request;
60+
}
61+
4962
/**
5063
* Get the <em>queue name</em> for which to get queue information.
5164
* @return <em>queue name</em> for which to get queue information
@@ -114,5 +127,21 @@ public abstract class GetQueueInfoRequest {
114127
@Public
115128
@Stable
116129
public abstract void setRecursive(boolean recursive);
130+
131+
/**
132+
* Get SubClusterId.
133+
* @return SubClusterId.
134+
*/
135+
@Public
136+
@Stable
137+
public abstract String getSubClusterId();
138+
139+
/**
140+
* Set SubClusterId.
141+
* @param subClusterId SubClusterId.
142+
*/
143+
@Public
144+
@Stable
145+
public abstract void setSubClusterId(String subClusterId);
117146
}
118147

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,4 +340,177 @@ public abstract void setQueueConfigurations(
340340
@Unstable
341341
public abstract void setIntraQueuePreemptionDisabled(
342342
boolean intraQueuePreemptionDisabled);
343+
344+
/**
345+
* Get Scheduler type.
346+
*
347+
* @return SchedulerType.
348+
*/
349+
@Public
350+
@Stable
351+
public abstract String getSchedulerType();
352+
353+
/**
354+
* Set Scheduler type.
355+
* @param schedulerType scheduler Type.
356+
*/
357+
@Private
358+
@Unstable
359+
public abstract void setSchedulerType(String schedulerType);
360+
361+
/**
362+
* Get the minimum resource VCore.
363+
* @return minimum resource VCore.
364+
*/
365+
@Public
366+
@Stable
367+
public abstract int getMinResourceVCore();
368+
369+
/**
370+
* Set the minimum resource VCore.
371+
* @param vCore minimum resource VCore.
372+
*/
373+
@Private
374+
@Unstable
375+
public abstract void setMinResourceVCore(int vCore);
376+
377+
/**
378+
* Get the minimum resource Memory.
379+
* @return minimum resource Memory.
380+
*/
381+
@Public
382+
@Stable
383+
public abstract long getMinResourceMemory();
384+
385+
/**
386+
* Set the minimum resource Memory.
387+
* @param memory minimum resource Memory.
388+
*/
389+
@Private
390+
@Unstable
391+
public abstract void setMinResourceMemory(long memory);
392+
393+
/**
394+
* Get the maximum resource VCore.
395+
* @return maximum resource VCore.
396+
*/
397+
@Public
398+
@Stable
399+
public abstract int getMaxResourceVCore();
400+
401+
/**
402+
* Set the maximum resource Memory.
403+
* @param vCore maximum resource VCore.
404+
*/
405+
@Private
406+
@Unstable
407+
public abstract void setMaxResourceVCore(int vCore);
408+
409+
/**
410+
* Get the maximum resource Memory.
411+
* @return maximum resource Memory.
412+
*/
413+
@Public
414+
@Stable
415+
public abstract long getMaxResourceMemory();
416+
417+
/**
418+
* Set the maximum resource Memory.
419+
* @param memory maximum resource Memory.
420+
*/
421+
@Private
422+
@Unstable
423+
public abstract void setMaxResourceMemory(long memory);
424+
425+
/**
426+
* Get the reserved resource VCore.
427+
* @return reserved resource VCore.
428+
*/
429+
@Public
430+
@Stable
431+
public abstract int getReservedResourceVCore();
432+
433+
/**
434+
* Set the reserved resource VCore.
435+
* @param vCore reserved resource VCore.
436+
*/
437+
@Private
438+
@Unstable
439+
public abstract void setReservedResourceVCore(int vCore);
440+
441+
/**
442+
* Get the reserved resource Memory.
443+
* @return reserved resource Memory.
444+
*/
445+
@Public
446+
@Stable
447+
public abstract long getReservedResourceMemory();
448+
449+
/**
450+
* Set the reserved resource Memory.
451+
* @param memory reserved resource Memory.
452+
*/
453+
@Private
454+
@Unstable
455+
public abstract void setReservedResourceMemory(long memory);
456+
457+
/**
458+
* Get the SteadyFairShare VCore.
459+
* @return SteadyFairShare VCore.
460+
*/
461+
@Public
462+
@Stable
463+
public abstract int getSteadyFairShareVCore();
464+
465+
/**
466+
* Set the SteadyFairShare VCore.
467+
* @param vCore SteadyFairShare VCore.
468+
*/
469+
@Private
470+
@Unstable
471+
public abstract void setSteadyFairShareVCore(int vCore);
472+
473+
/**
474+
* Get the SteadyFairShare Memory.
475+
* @return SteadyFairShare Memory.
476+
*/
477+
@Public
478+
@Stable
479+
public abstract long getSteadyFairShareMemory();
480+
481+
/**
482+
* Set the SteadyFairShare Memory.
483+
* @param memory SteadyFairShare Memory.
484+
*/
485+
@Private
486+
@Unstable
487+
public abstract void setSteadyFairShareMemory(long memory);
488+
489+
/**
490+
* Get the SubClusterId.
491+
* @return the SubClusterId.
492+
*/
493+
@Public
494+
@Stable
495+
public abstract String getSubClusterId();
496+
497+
/**
498+
* Set the SubClusterId.
499+
* @param subClusterId the SubClusterId.
500+
*/
501+
@Private
502+
@Unstable
503+
public abstract void setSubClusterId(String subClusterId);
504+
505+
/**
506+
* Get the MaxRunningApp.
507+
* @return The number of MaxRunningApp.
508+
*/
509+
@Public
510+
@Stable
511+
public abstract int getMaxRunningApp();
512+
513+
@Private
514+
@Unstable
515+
public abstract void setMaxRunningApp(int maxRunningApp);
343516
}

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,17 @@ message QueueInfoProto {
636636
optional float weight = 14;
637637
optional string queuePath = 15;
638638
optional int32 maxParallelApps = 16;
639+
optional string schedulerType = 17;
640+
optional int32 minResourceVCore = 18;
641+
optional int64 minResourceMemory = 19;
642+
optional int32 maxResourceVCore = 20;
643+
optional int64 maxResourceMemory = 21;
644+
optional int32 reservedResourceVCore = 22;
645+
optional int64 reservedResourceMemory = 23;
646+
optional int32 steadyFairShareVCore = 24;
647+
optional int64 steadyFairShareMemory = 25;
648+
optional string subClusterId = 26;
649+
optional int32 maxRunningApp = 27;
639650
}
640651

641652
message QueueConfigurationsProto {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ message GetQueueInfoRequestProto {
232232
optional bool includeApplications = 2;
233233
optional bool includeChildQueues = 3;
234234
optional bool recursive = 4;
235+
optional string subClusterId = 5;
235236
}
236237

237238
message GetQueueInfoResponseProto {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/YarnClient.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,28 @@ public abstract Token getRMDelegationToken(Text renewer)
464464
* @throws YarnException
465465
* in case of errors or if YARN rejects the request due to
466466
* access-control restrictions.
467-
* @throws IOException
467+
* @throws IOException I/O exception has occurred.
468468
*/
469469
public abstract QueueInfo getQueueInfo(String queueName) throws YarnException,
470470
IOException;
471471

472+
/**
473+
* <p>
474+
* Get information ({@link QueueInfo}) about a given <em>queue</em>.
475+
* </p>
476+
*
477+
* @param queueName
478+
* Name of the queue whose information is needed.
479+
* @param subClusterId sub-cluster Id.
480+
* @return queue information.
481+
* @throws YarnException
482+
* in case of errors or if YARN rejects the request due to
483+
* access-control restrictions.
484+
* @throws IOException I/O exception has occurred.
485+
*/
486+
public abstract QueueInfo getQueueInfo(String queueName, String subClusterId)
487+
throws YarnException, IOException;
488+
472489
/**
473490
* <p>
474491
* Get information ({@link QueueInfo}) about all queues, recursively if there

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/YarnClientImpl.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,18 @@ public Token getRMDelegationToken(Text renewer)
735735
return request;
736736
}
737737

738+
private GetQueueInfoRequest getQueueInfoRequest(
739+
String queueName, String subClusterId, boolean includeApplications,
740+
boolean includeChildQueues, boolean recursive) {
741+
GetQueueInfoRequest request = Records.newRecord(GetQueueInfoRequest.class);
742+
request.setQueueName(queueName);
743+
request.setSubClusterId(subClusterId);
744+
request.setIncludeApplications(includeApplications);
745+
request.setIncludeChildQueues(includeChildQueues);
746+
request.setRecursive(recursive);
747+
return request;
748+
}
749+
738750
@Override
739751
public QueueInfo getQueueInfo(String queueName) throws YarnException,
740752
IOException {
@@ -744,6 +756,15 @@ public QueueInfo getQueueInfo(String queueName) throws YarnException,
744756
return rmClient.getQueueInfo(request).getQueueInfo();
745757
}
746758

759+
@Override
760+
public QueueInfo getQueueInfo(String queueName,
761+
String subClusterId) throws YarnException, IOException {
762+
GetQueueInfoRequest request =
763+
getQueueInfoRequest(queueName, subClusterId, true, false, false);
764+
Records.newRecord(GetQueueInfoRequest.class);
765+
return rmClient.getQueueInfo(request).getQueueInfo();
766+
}
767+
747768
@Override
748769
public List<QueueUserACLInfo> getQueueAclsInfo() throws YarnException,
749770
IOException {

0 commit comments

Comments
 (0)