Search in sources :

Example 1 with AppTimeoutsMapProto

use of org.apache.hadoop.yarn.proto.YarnProtos.AppTimeoutsMapProto in project hadoop by apache.

the class ApplicationReportPBImpl method addApplicationTimeouts.

private void addApplicationTimeouts() {
    maybeInitBuilder();
    builder.clearAppTimeouts();
    if (applicationTimeouts == null) {
        return;
    }
    Iterable<? extends AppTimeoutsMapProto> values = new Iterable<AppTimeoutsMapProto>() {

        @Override
        public Iterator<AppTimeoutsMapProto> iterator() {
            return new Iterator<AppTimeoutsMapProto>() {

                private Iterator<ApplicationTimeoutType> iterator = applicationTimeouts.keySet().iterator();

                @Override
                public boolean hasNext() {
                    return iterator.hasNext();
                }

                @Override
                public AppTimeoutsMapProto next() {
                    ApplicationTimeoutType key = iterator.next();
                    return AppTimeoutsMapProto.newBuilder().setApplicationTimeout(convertToProtoFormat(applicationTimeouts.get(key))).setApplicationTimeoutType(ProtoUtils.convertToProtoFormat(key)).build();
                }

                @Override
                public void remove() {
                    throw new UnsupportedOperationException();
                }
            };
        }
    };
    this.builder.addAllAppTimeouts(values);
}
Also used : ApplicationTimeoutType(org.apache.hadoop.yarn.api.records.ApplicationTimeoutType) Iterator(java.util.Iterator) AppTimeoutsMapProto(org.apache.hadoop.yarn.proto.YarnProtos.AppTimeoutsMapProto)

Example 2 with AppTimeoutsMapProto

use of org.apache.hadoop.yarn.proto.YarnProtos.AppTimeoutsMapProto in project hadoop by apache.

the class ApplicationReportPBImpl method initApplicationTimeout.

private void initApplicationTimeout() {
    if (this.applicationTimeouts != null) {
        return;
    }
    ApplicationReportProtoOrBuilder p = viaProto ? proto : builder;
    List<AppTimeoutsMapProto> lists = p.getAppTimeoutsList();
    this.applicationTimeouts = new HashMap<ApplicationTimeoutType, ApplicationTimeout>(lists.size());
    for (AppTimeoutsMapProto timeoutProto : lists) {
        this.applicationTimeouts.put(ProtoUtils.convertFromProtoFormat(timeoutProto.getApplicationTimeoutType()), convertFromProtoFormat(timeoutProto.getApplicationTimeout()));
    }
}
Also used : ApplicationReportProtoOrBuilder(org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProtoOrBuilder) ApplicationTimeoutType(org.apache.hadoop.yarn.api.records.ApplicationTimeoutType) ApplicationTimeout(org.apache.hadoop.yarn.api.records.ApplicationTimeout) AppTimeoutsMapProto(org.apache.hadoop.yarn.proto.YarnProtos.AppTimeoutsMapProto)

Aggregations

ApplicationTimeoutType (org.apache.hadoop.yarn.api.records.ApplicationTimeoutType)2 AppTimeoutsMapProto (org.apache.hadoop.yarn.proto.YarnProtos.AppTimeoutsMapProto)2 Iterator (java.util.Iterator)1 ApplicationTimeout (org.apache.hadoop.yarn.api.records.ApplicationTimeout)1 ApplicationReportProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProtoOrBuilder)1