@Override public Float apply(HostRegistration h) { return h.getMaxLoad(); } };
public static void checkJobFitsCluster(float load, String loadType, List<HostRegistration> hosts) { boolean processable = false; if (hosts != null) { for (HostRegistration host : hosts) { if (host.getMaxLoad() >= load) { logger.trace("Host " + host.toString() + " can process jobs of type " + loadType + " with load " + load); processable = true; break; } } } if (!processable) { logger.warn("No hosts found that can process jobs of type {} with load {}", loadType, load); } } }
/** * {@inheritDoc} * * @see org.opencastproject.serviceregistry.api.ServiceRegistry#getMaxLoads() */ @Override public SystemLoad getMaxLoads() throws ServiceRegistryException { final SystemLoad loads = new SystemLoad(); for (HostRegistration host : getHostRegistrations()) { NodeLoad load = new NodeLoad(host.getBaseUrl(), host.getMaxLoad()); loads.addNodeLoad(load); } return loads; }
for (HostRegistration host : hostRegistrations) { if (host.getBaseUrl().equals(service.getHost())) { hostLoadMax = host.getMaxLoad(); break;
/** * Creates a new JAXB host registration based on an existing host registration * * @param hostRegistration */ public JaxbHostRegistration(HostRegistration hostRegistration) { this.baseUrl = hostRegistration.getBaseUrl(); this.address = hostRegistration.getIpAddress(); this.memory = hostRegistration.getMemory(); this.cores = hostRegistration.getCores(); this.maxLoad = hostRegistration.getMaxLoad(); this.online = hostRegistration.isOnline(); this.active = hostRegistration.isActive(); this.maintenanceMode = hostRegistration.isMaintenanceMode(); }