Search in sources :

Example 6 with ApplicationTimeoutType

use of org.apache.hadoop.yarn.api.records.ApplicationTimeoutType 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 7 with ApplicationTimeoutType

use of org.apache.hadoop.yarn.api.records.ApplicationTimeoutType 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 8 with ApplicationTimeoutType

use of org.apache.hadoop.yarn.api.records.ApplicationTimeoutType in project hadoop by apache.

the class UpdateApplicationTimeoutsRequestPBImpl method addApplicationTimeouts.

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

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

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

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

                @Override
                public ApplicationUpdateTimeoutMapProto next() {
                    ApplicationTimeoutType key = iterator.next();
                    return ApplicationUpdateTimeoutMapProto.newBuilder().setExpireTime(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) ApplicationUpdateTimeoutMapProto(org.apache.hadoop.yarn.proto.YarnProtos.ApplicationUpdateTimeoutMapProto)

Example 9 with ApplicationTimeoutType

use of org.apache.hadoop.yarn.api.records.ApplicationTimeoutType 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)

Example 10 with ApplicationTimeoutType

use of org.apache.hadoop.yarn.api.records.ApplicationTimeoutType 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)

Aggregations

ApplicationTimeoutType (org.apache.hadoop.yarn.api.records.ApplicationTimeoutType)17 HashMap (java.util.HashMap)4 Iterator (java.util.Iterator)4 ApplicationTimeoutMapProto (org.apache.hadoop.yarn.proto.YarnProtos.ApplicationTimeoutMapProto)4 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)3 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)3 MockNM (org.apache.hadoop.yarn.server.resourcemanager.MockNM)3 MockRM (org.apache.hadoop.yarn.server.resourcemanager.MockRM)3 RMApp (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp)3 Test (org.junit.Test)3 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 UpdateApplicationTimeoutsRequest (org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest)2 ApplicationTimeout (org.apache.hadoop.yarn.api.records.ApplicationTimeout)2 AppTimeoutsMapProto (org.apache.hadoop.yarn.proto.YarnProtos.AppTimeoutsMapProto)2 ApplicationUpdateTimeoutMapProto (org.apache.hadoop.yarn.proto.YarnProtos.ApplicationUpdateTimeoutMapProto)2 MockAM (org.apache.hadoop.yarn.server.resourcemanager.MockAM)2 MemoryRMStateStore (org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore)2 ApplicationStateData (org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData)2