private FrameworkInfo buildFrameworkInfo() { final FrameworkInfo.Builder frameworkInfoBuilder = FrameworkInfo.newBuilder() .setCheckpoint(mesosConfiguration.isCheckpoint()) .setFailoverTimeout(mesosConfiguration.getFrameworkFailoverTimeout()) .setName(mesosConfiguration.getFrameworkName()) .setId(FrameworkID.newBuilder().setValue(mesosConfiguration.getFrameworkId())) .setUser(mesosConfiguration.getFrameworkUser()); // https://issues.apache.org/jira/browse/MESOS-3747 if (configuration.getMesosConfiguration().getCredentialPrincipal().isPresent()) { frameworkInfoBuilder.setPrincipal(configuration.getMesosConfiguration().getCredentialPrincipal().get()); } if (configuration.getHostname().isPresent()) { frameworkInfoBuilder.setHostname(configuration.getHostname().get()); } // only set the web UI URL if it's fully qualified if (singularityUriBase.startsWith("http://") || singularityUriBase.startsWith("https://")) { if (configuration.getUiConfiguration().getRootUrlMode() == UIConfiguration.RootUrlMode.INDEX_CATCHALL) { frameworkInfoBuilder.setWebuiUrl(singularityUriBase); } else { frameworkInfoBuilder.setWebuiUrl(singularityUriBase + UiResource.UI_RESOURCE_LOCATION); } } if (mesosConfiguration.getFrameworkRole().isPresent()) { frameworkInfoBuilder.setRole(mesosConfiguration.getFrameworkRole().get()); } return frameworkInfoBuilder.build(); }
/** * Utility method to more succinctly construct a {@link Call Call} of type {@link Type#SUBSCRIBE SUBSCRIBE}. * <p> * * @param frameworkId The frameworkId to set on the {@link Protos.FrameworkInfo FrameworkInfo} and * {@link Call Call} messages. * @param user The user to set on the {@link Protos.FrameworkInfo FrameworkInfo} message. * @param frameworkName The name to set on the {@link Protos.FrameworkInfo FrameworkInfo} message. * @param failoverTimeoutSeconds The failoverTimeoutSeconds to set on the * {@link Protos.FrameworkInfo FrameworkInfo} message. * @return An {@link Call Call} of type {@link Type#SUBSCRIBE SUBSCRIBE} with the configured * {@link Subscribe Subscribe} sub-message. */ @NotNull public static Call subscribe( @NotNull final Protos.FrameworkID frameworkId, @NotNull final String user, @NotNull final String frameworkName, final long failoverTimeoutSeconds ) { final Protos.FrameworkInfo frameworkInfo = Protos.FrameworkInfo.newBuilder() .setId(frameworkId) .setUser(user) .setName(frameworkName) .setFailoverTimeout(failoverTimeoutSeconds) .build(); return subscribe(frameworkId, frameworkInfo); }
/** * Utility method to more succinctly construct a {@link Call Call} of type {@link Type#SUBSCRIBE SUBSCRIBE}. * <p> * * @param frameworkId The frameworkId to set on the {@link Protos.FrameworkInfo FrameworkInfo} and * {@link Call Call} messages. * @param user The user to set on the {@link Protos.FrameworkInfo FrameworkInfo} message. * @param frameworkName The name to set on the {@link Protos.FrameworkInfo FrameworkInfo} message. * @param failoverTimeoutSeconds The failoverTimeoutSeconds to set on the * {@link Protos.FrameworkInfo FrameworkInfo} message. * @return An {@link Call Call} of type {@link Type#SUBSCRIBE SUBSCRIBE} with the configured * {@link Subscribe Subscribe} sub-message. */ @NotNull public static Call subscribe( @NotNull final Protos.FrameworkID frameworkId, @NotNull final String user, @NotNull final String frameworkName, final long failoverTimeoutSeconds ) { final Protos.FrameworkInfo frameworkInfo = Protos.FrameworkInfo.newBuilder() .setId(frameworkId) .setUser(user) .setName(frameworkName) .setFailoverTimeout(failoverTimeoutSeconds) .build(); return subscribe(frameworkId, frameworkInfo); }
Protos.FrameworkInfo.newBuilder() .setId(stateObject.getFwId()) .setUser(Optional.ofNullable(System.getenv("user")).orElse("root")) // https://issues.apache.org/jira/browse/MESOS-3747
/** * <pre> * See the comments below on 'framework_id' on the semantics for * 'framework_info.id'. * </pre> * * <code>required .mesos.v1.FrameworkInfo framework_info = 1;</code> */ public Builder mergeFrameworkInfo(org.apache.mesos.v1.Protos.FrameworkInfo value) { if (frameworkInfoBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && frameworkInfo_ != null && frameworkInfo_ != org.apache.mesos.v1.Protos.FrameworkInfo.getDefaultInstance()) { frameworkInfo_ = org.apache.mesos.v1.Protos.FrameworkInfo.newBuilder(frameworkInfo_).mergeFrom(value).buildPartial(); } else { frameworkInfo_ = value; } onChanged(); } else { frameworkInfoBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } /**
private FrameworkInfo buildFrameworkInfo() { final FrameworkInfo.Builder frameworkInfoBuilder = FrameworkInfo.newBuilder() .setCheckpoint(mesosConfiguration.isCheckpoint()) .setFailoverTimeout(mesosConfiguration.getFrameworkFailoverTimeout()) .setName(mesosConfiguration.getFrameworkName()) .setId(FrameworkID.newBuilder().setValue(mesosConfiguration.getFrameworkId())) .setUser(mesosConfiguration.getFrameworkUser()); // https://issues.apache.org/jira/browse/MESOS-3747 if (configuration.getMesosConfiguration().getCredentialPrincipal().isPresent()) { frameworkInfoBuilder.setPrincipal(configuration.getMesosConfiguration().getCredentialPrincipal().get()); } if (configuration.getHostname().isPresent()) { frameworkInfoBuilder.setHostname(configuration.getHostname().get()); } // only set the web UI URL if it's fully qualified if (singularityUriBase.startsWith("http://") || singularityUriBase.startsWith("https://")) { if (configuration.getUiConfiguration().getRootUrlMode() == UIConfiguration.RootUrlMode.INDEX_CATCHALL) { frameworkInfoBuilder.setWebuiUrl(singularityUriBase); } else { frameworkInfoBuilder.setWebuiUrl(singularityUriBase + UiResource.UI_RESOURCE_LOCATION); } } if (mesosConfiguration.getFrameworkRole().isPresent()) { frameworkInfoBuilder.setRole(mesosConfiguration.getFrameworkRole().get()); } return frameworkInfoBuilder.build(); }
/** * <code>required .mesos.v1.FrameworkInfo framework_info = 2;</code> */ public Builder mergeFrameworkInfo(org.apache.mesos.v1.Protos.FrameworkInfo value) { if (frameworkInfoBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002) && frameworkInfo_ != null && frameworkInfo_ != org.apache.mesos.v1.Protos.FrameworkInfo.getDefaultInstance()) { frameworkInfo_ = org.apache.mesos.v1.Protos.FrameworkInfo.newBuilder(frameworkInfo_).mergeFrom(value).buildPartial(); } else { frameworkInfo_ = value; } onChanged(); } else { frameworkInfoBuilder_.mergeFrom(value); } bitField0_ |= 0x00000002; return this; } /**