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(); }
.setAgentId(AgentID.newBuilder().setValue("1")) .setId(OfferID.newBuilder().setValue("1")) .setFrameworkId(FrameworkID.newBuilder().setValue("1")) .setHostname("test") .build();
protected Offer createOffer(double cpus, double memory, double disk, String slave, String host, Optional<String> rack, Map<String, String> attributes, String[] portRanges, Optional<String> role) { AgentID slaveId = AgentID.newBuilder().setValue(slave).build(); FrameworkID frameworkId = FrameworkID.newBuilder().setValue("framework1").build();
.setId(org.apache.mesos.v1.Protos.OfferID.newBuilder().setValue(offerId)) .setAgentId(org.apache.mesos.v1.Protos.AgentID.newBuilder().setValue(agentId)) .setFrameworkId(org.apache.mesos.v1.Protos.FrameworkID.newBuilder().setValue(frameworkId)) .addResources(org.apache.mesos.v1.Protos.Resource.newBuilder() .setName("cpus")
final String role = args[2]; checkState(role != null && !role.trim().isEmpty(), "<mesos-resource-role> must not be empty"); final FrameworkID frameworkID = FrameworkID.newBuilder().setValue(fwId).build(); final State<FrameworkID, TaskID, TaskState> stateObject = new State<>(frameworkID, role.trim(), cpusPerTask, 16);
.setId(org.apache.mesos.v1.Protos.OfferID.newBuilder().setValue(offerId)) .setAgentId(org.apache.mesos.v1.Protos.AgentID.newBuilder().setValue(agentId)) .setFrameworkId(org.apache.mesos.v1.Protos.FrameworkID.newBuilder().setValue(frameworkId)) .addResources(org.apache.mesos.v1.Protos.Resource.newBuilder() .setName("cpus")
protected Offer createOffer(double cpus, double memory, double disk, String slave, String host, Optional<String> rack, Map<String, String> attributes, String[] portRanges, Optional<String> role) { AgentID slaveId = AgentID.newBuilder().setValue(slave).build(); FrameworkID frameworkId = FrameworkID.newBuilder().setValue("framework1").build();
.setAgentId(AgentID.newBuilder().setValue("1")) .setId(OfferID.newBuilder().setValue("1")) .setFrameworkId(FrameworkID.newBuilder().setValue("1")) .setHostname("test") .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 String frameworkId, @NotNull final String user, @NotNull final String frameworkName, final long failoverTimeoutSeconds ) { final Protos.FrameworkID frameworkID = Protos.FrameworkID.newBuilder().setValue(frameworkId).build(); return subscribe(frameworkID, user, frameworkName, failoverTimeoutSeconds); }
/** * Utility method to more succinctly construct an {@link Protos.Event Event} of type * {@link Protos.Event.Type#SUBSCRIBED SUBSCRIBED}. * * @param frameworkId The frameworkId to be set on the * {@link Protos.Event.Subscribed} message. * @param heartbeatIntervalSeconds The heartbeatIntervalSeconds to be set on the * {@link Protos.Event.Subscribed} message. * @return An instance of {@link Protos.Event Event} of type * {@link Protos.Event.Type#SUBSCRIBED SUBSCRIBED} and * {@link Protos.Event#getSubscribed() subscribed} set based on the provide parameters. */ @NotNull public static Protos.Event subscribed(@NotNull final String frameworkId, final int heartbeatIntervalSeconds) { return Protos.Event.newBuilder() .setType(Protos.Event.Type.SUBSCRIBED) .setSubscribed( Protos.Event.Subscribed.newBuilder() .setFrameworkId(org.apache.mesos.v1.Protos.FrameworkID.newBuilder() .setValue(frameworkId) ) .setHeartbeatIntervalSeconds(heartbeatIntervalSeconds) ) .build(); }
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 an {@link Protos.Event Event} of type * {@link Protos.Event.Type#SUBSCRIBED SUBSCRIBED}. * * @param frameworkId The frameworkId to be set on the * {@link Protos.Event.Subscribed} message. * @param heartbeatIntervalSeconds The heartbeatIntervalSeconds to be set on the * {@link Protos.Event.Subscribed} message. * @return An instance of {@link Protos.Event Event} of type * {@link Protos.Event.Type#SUBSCRIBED SUBSCRIBED} and * {@link Protos.Event#getSubscribed() subscribed} set based on the provide parameters. */ @NotNull public static Protos.Event subscribed(@NotNull final String frameworkId, final int heartbeatIntervalSeconds) { return Protos.Event.newBuilder() .setType(Protos.Event.Type.SUBSCRIBED) .setSubscribed( Protos.Event.Subscribed.newBuilder() .setFrameworkId(org.apache.mesos.v1.Protos.FrameworkID.newBuilder() .setValue(frameworkId) ) .setHeartbeatIntervalSeconds(heartbeatIntervalSeconds) ) .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 String frameworkId, @NotNull final String user, @NotNull final String frameworkName, final long failoverTimeoutSeconds ) { final Protos.FrameworkID frameworkID = Protos.FrameworkID.newBuilder().setValue(frameworkId).build(); return subscribe(frameworkID, user, frameworkName, failoverTimeoutSeconds); }
public static FrameworkID toFrameworkId(MesosStringValue stringValue) { return FrameworkID.newBuilder().setValue(stringValue.getValue()).build(); }
private Offer buildOffer(String... ranges) { Offer.Builder offer = Offer.newBuilder() .setId(OfferID.newBuilder().setValue("offerid").build()) .setFrameworkId(FrameworkID.newBuilder().setValue("frameworkid").build()) .setHostname("hostname") .setAgentId(AgentID.newBuilder().setValue("slaveid").build()); offer.addResources(buildPortRanges(ranges)); return offer.build(); }
public static FrameworkID toFrameworkId(MesosStringValue stringValue) { return FrameworkID.newBuilder().setValue(stringValue.getValue()).build(); }
private Offer buildOffer(String... ranges) { Offer.Builder offer = Offer.newBuilder() .setId(OfferID.newBuilder().setValue("offerid").build()) .setFrameworkId(FrameworkID.newBuilder().setValue("frameworkid").build()) .setHostname("hostname") .setAgentId(AgentID.newBuilder().setValue("slaveid").build()); offer.addResources(buildPortRanges(ranges)); return offer.build(); }