Tabnine Logo
Protos$Resource.getRole
Code IndexAdd Tabnine to your IDE (free)

How to use
getRole
method
in
org.apache.mesos.v1.Protos$Resource

Best Java code snippets using org.apache.mesos.v1.Protos$Resource.getRole (Showing top 7 results out of 315)

origin: HubSpot/Singularity

public static Set<String> getRoles(Offer offer) {
 Set<String> roles = Sets.newHashSet();
 for (Resource r : offer.getResourcesList()) {
  roles.add(r.getRole());
 }
 return roles;
}
origin: HubSpot/Singularity

private static boolean hasRequiredRole(Resource r, Optional<String> requiredRole) {
 if (requiredRole.isPresent() && hasRole(r)) {
  // required role with a resource with role
  return requiredRole.get().equals(r.getRole());
 } else if (requiredRole.isPresent() && !hasRole(r)) {
  // required role with a resource for any role
  return false;
 } else if (!requiredRole.isPresent() && hasRole(r)) {
  // no required role but resource with role
  return false;
 } else if (!requiredRole.isPresent() && !hasRole(r)) {
  // no required role and resource for any role
  return true;
 } else {
  return false;
 }
}
origin: HubSpot/Singularity

private static boolean hasRole(Resource r) {
 return r.hasRole() && !r.getRole().equals("*");
}
origin: mesosphere/mesos-rxjava

final Resource mem = memList.get(i);
if (desiredRole.equals(cpus.getRole()) && desiredRole.equals(mem.getRole())) {
  double availableCpu = cpus.getScalar().getValue();
  double availableMem = mem.getScalar().getValue();
    availableMem -= memMbPerTask;
    final String taskId = String.format("task-%d-%d", offerCount, state.getTotalTaskCounter().incrementAndGet());
    tasks.add(sleepTask(agentId, taskId, cpus.getRole(), cpusPerTask, mem.getRole(), memMbPerTask));
origin: com.hubspot/SingularityService

private static boolean hasRequiredRole(Resource r, Optional<String> requiredRole) {
 if (requiredRole.isPresent() && hasRole(r)) {
  // required role with a resource with role
  return requiredRole.get().equals(r.getRole());
 } else if (requiredRole.isPresent() && !hasRole(r)) {
  // required role with a resource for any role
  return false;
 } else if (!requiredRole.isPresent() && hasRole(r)) {
  // no required role but resource with role
  return false;
 } else if (!requiredRole.isPresent() && !hasRole(r)) {
  // no required role and resource for any role
  return true;
 } else {
  return false;
 }
}
origin: com.hubspot/SingularityService

private static boolean hasRole(Resource r) {
 return r.hasRole() && !r.getRole().equals("*");
}
origin: com.hubspot/SingularityService

public static Set<String> getRoles(Offer offer) {
 Set<String> roles = Sets.newHashSet();
 for (Resource r : offer.getResourcesList()) {
  roles.add(r.getRole());
 }
 return roles;
}
org.apache.mesos.v1Protos$ResourcegetRole

Popular methods of Protos$Resource

  • newBuilder
  • getScalar
  • getDefaultInstance
  • getName
  • getRanges
  • hasName
  • hasRanges
  • hasRole
  • hasScalar
  • isInitialized
  • toBuilder
  • toBuilder

Popular in Java

  • Creating JSON documents from java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • onRequestPermissionsResult (Fragment)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now