Search in sources :

Example 1 with ApplicationTimeoutMapProto

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

the class ApplicationSubmissionContextPBImpl method initApplicationTimeout.

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

Example 2 with ApplicationTimeoutMapProto

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

the class ApplicationStateDataPBImpl method addApplicationTimeouts.

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

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

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

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

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

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

Example 3 with ApplicationTimeoutMapProto

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

the class ApplicationSubmissionContextPBImpl method addApplicationTimeouts.

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

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

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

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

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

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

Example 4 with ApplicationTimeoutMapProto

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

the class ApplicationStateDataPBImpl method initApplicationTimeout.

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

Aggregations

ApplicationTimeoutType (org.apache.hadoop.yarn.api.records.ApplicationTimeoutType)4 ApplicationTimeoutMapProto (org.apache.hadoop.yarn.proto.YarnProtos.ApplicationTimeoutMapProto)4 Iterator (java.util.Iterator)2 ApplicationSubmissionContextProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnProtos.ApplicationSubmissionContextProtoOrBuilder)1 ApplicationStateDataProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnServerResourceManagerRecoveryProtos.ApplicationStateDataProtoOrBuilder)1