本文整理汇总了Java中io.hops.metadata.yarn.entity.quota.PriceMultiplicator.MultiplicatorType方法的典型用法代码示例。如果您正苦于以下问题:Java PriceMultiplicator.MultiplicatorType方法的具体用法?Java PriceMultiplicator.MultiplicatorType怎么用?Java PriceMultiplicator.MultiplicatorType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.hops.metadata.yarn.entity.quota.PriceMultiplicator
的用法示例。
在下文中一共展示了PriceMultiplicator.MultiplicatorType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCurrentMultiplicator
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
private Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator> getCurrentMultiplicator()
throws IOException {
LightWeightRequestHandler currentPriceHandler
= new LightWeightRequestHandler(YARNOperationType.TEST) {
@Override
public Object performTask() throws StorageException {
connector.beginTransaction();
connector.readCommitted();
Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator> currentPrices
= priceMultiplicatorDA.getAll();
connector.commit();
return currentPrices;
}
};
return (Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator>) currentPriceHandler.
handle();
}
示例2: persistMultiplicators
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
private void persistMultiplicators() throws IOException {
LightWeightRequestHandler prepareHandler;
prepareHandler = new LightWeightRequestHandler(YARNOperationType.TEST) {
@Override
public Object performTask() throws IOException {
connector.beginTransaction();
connector.writeLock();
for (Map.Entry<PriceMultiplicator.MultiplicatorType, Float> entry : currentMultiplicators.entrySet()) {
priceMultiplicatorDA.add(new PriceMultiplicator(entry.getKey(), entry.getValue()));
}
connector.commit();
LOG.debug("Commited new multiplicator: " + currentMultiplicators + "for VARIABLE");
return null;
}
};
prepareHandler.handle();
}
示例3: recover
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
/**
* Retrieve tick counter, unfinished containers logs entries and container
* statuses entries. Merge them and then retrieve events that have arrived
* since launching service. Merge events and mark recovery as completed.
*/
public void recover() {
LOG.info("Starting containers logs recovery");
try {
tickCounter = getTickCounter();
activeContainers = getContainersLogs();
//recover current multiplicator
Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator> currentMultiplicators = getCurrentMultiplicator();
for (PriceMultiplicator.MultiplicatorType type : PriceMultiplicator.MultiplicatorType.values()) {
if (currentMultiplicators.get(type) != null) {
this.currentMultiplicators.put(type, currentMultiplicators.get(type).getValue());
}
}
//Finish to log all the containers for which we currently have logs
//they will restart once they send a new heartbeat
finishLogging();
updateContainersLogs(false);
LOG.info("Finished containers logs recovery");
} catch (Exception ex) {
LOG.warn("Unable to finish containers logs recovery", ex);
}
}
示例4: getCurrentMultiplicator
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
private Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator> getCurrentMultiplicator()
throws IOException {
LightWeightRequestHandler currentPriceHandler
= new LightWeightRequestHandler(YARNOperationType.TEST) {
@Override
public Object performTask() throws StorageException {
connector.beginTransaction();
connector.readCommitted();
PriceMultiplicatorDataAccess da
= (PriceMultiplicatorDataAccess) RMStorageFactory.getDataAccess(
PriceMultiplicatorDataAccess.class);
Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator> currentPrices
= da.getAll();
connector.commit();
return currentPrices;
}
};
return (Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator>) currentPriceHandler.
handle();
}
示例5: getMultiplicator
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
public YarnPriceMultiplicator getMultiplicator(PriceMultiplicator.MultiplicatorType multiplicatorType) {
try {
TypedQuery<YarnPriceMultiplicator> query = em.
createNamedQuery("YarnPriceMultiplicator.findById", YarnPriceMultiplicator.class).setParameter("id",
multiplicatorType.name());
return query.getSingleResult();
} catch (NoResultException e) {
return null;
}
}
示例6: serviceInit
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
@Override
public void serviceInit(Configuration conf) throws Exception {
LOG.info("Initializing price estimation service");
this.conf = conf;
// Initialize config parameters
this.tippingPoints.put(PriceMultiplicator.MultiplicatorType.GENERAL, this.conf.getFloat(
YarnConfiguration.QUOTA_MULTIPLICATOR_THRESHOLD_GENERAL,
YarnConfiguration.DEFAULT_QUOTA_MULTIPLICATOR_THRESHOLD_GENERAL));
this.tippingPoints.put(PriceMultiplicator.MultiplicatorType.GPU, this.conf.getFloat(
YarnConfiguration.QUOTA_MULTIPLICATOR_THRESHOLD_GPU,
YarnConfiguration.DEFAULT_QUOTA_MULTIPLICATOR_THRESHOLD_GPU));
this.incrementFactors.put(PriceMultiplicator.MultiplicatorType.GENERAL, this.conf.getFloat(
YarnConfiguration.QUOTA_INCREMENT_FACTOR_GENERAL,
YarnConfiguration.DEFAULT_QUOTA_INCREMENT_FACTOR_GENERAL));
this.incrementFactors.put(PriceMultiplicator.MultiplicatorType.GPU, this.conf.getFloat(
YarnConfiguration.QUOTA_INCREMENT_FACTOR_GPU,
YarnConfiguration.DEFAULT_QUOTA_INCREMENT_FACTOR_GPU));
this.priceMultiplicationFactorCalculationInterval = this.conf.getLong(
YarnConfiguration.QUOTA_PRICE_MULTIPLICATOR_INTERVAL,
YarnConfiguration.DEFAULT_QUOTA_PRICE_MULTIPLICATOR_INTERVAL);
// Initialize DataAccesses
this.priceMultiplicatorDA = (PriceMultiplicatorDataAccess) RMStorageFactory.
getDataAccess(PriceMultiplicatorDataAccess.class);
for(PriceMultiplicator.MultiplicatorType type: PriceMultiplicator.MultiplicatorType.values()){
currentMultiplicators.put(type, new Float(1));
}
recover();
}
示例7: recover
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
private void recover() throws IOException {
Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator> currentMultiplicators = getCurrentMultiplicator();
for (PriceMultiplicator.MultiplicatorType type : PriceMultiplicator.MultiplicatorType.values()) {
if (currentMultiplicators.get(type) != null) {
this.currentMultiplicators.put(type, currentMultiplicators.get(type).getValue());
}
}
}
示例8: CheckCurrentMultiplicator
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
private void CheckCurrentMultiplicator(final float generalMultiplicator, final float gpuMultiplicator) throws
Exception {
LightWeightRequestHandler currentMultiplicatorHandler
= new LightWeightRequestHandler(
YARNOperationType.TEST) {
@Override
public Object performTask() throws IOException {
connector.beginTransaction();
connector.writeLock();
PriceMultiplicatorDataAccess pmDA
= (PriceMultiplicatorDataAccess) RMStorageFactory.getDataAccess(
PriceMultiplicatorDataAccess.class);
Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator> priceList = pmDA.getAll();
connector.commit();
return priceList;
}
};
int nbTry=0;
Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator> currentMultiplicators = new HashMap<>();
while (nbTry < 10) {
currentMultiplicators
= (Map<PriceMultiplicator.MultiplicatorType, PriceMultiplicator>) currentMultiplicatorHandler.handle();
if (currentMultiplicators.get(PriceMultiplicator.MultiplicatorType.GENERAL).getValue() == generalMultiplicator
&& currentMultiplicators.get(PriceMultiplicator.MultiplicatorType.GPU).getValue() == gpuMultiplicator) {
break;
}
Thread.sleep(500);
nbTry++;
}
Assert.assertEquals(generalMultiplicator, currentMultiplicators.get(PriceMultiplicator.MultiplicatorType.GENERAL).
getValue(), 0);
Assert.
assertEquals(gpuMultiplicator, currentMultiplicators.get(PriceMultiplicator.MultiplicatorType.GPU).getValue(), 0);
}
示例9: getAll
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
Map<PriceMultiplicator.MultiplicatorType, T> getAll() throws
StorageException;
示例10: serviceInit
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
@Override
public void serviceInit(Configuration conf) throws Exception {
LOG.info("Initializing containers logs service");
this.conf = conf;
// Initialize config parameters
this.monitorInterval = this.conf.getLong(
YarnConfiguration.QUOTA_CONTAINERS_LOGS_MONITOR_INTERVAL,
YarnConfiguration.DEFAULT_QUOTA_CONTAINERS_LOGS_MONITOR_INTERVAL);
this.checkpointEnabled = this.conf.getBoolean(
YarnConfiguration.QUOTA_CONTAINERS_LOGS_CHECKPOINTS_ENABLED,
YarnConfiguration.DEFAULT_QUOTA_CONTAINERS_LOGS_CHECKPOINTS_ENABLED);
this.checkpointInterval = this.conf.getInt(
YarnConfiguration.QUOTA_CONTAINERS_LOGS_CHECKPOINTS_MINTICKS,
YarnConfiguration.DEFAULT_QUOTA_CONTAINERS_LOGS_CHECKPOINTS_MINTICKS)
* this.conf.getInt(YarnConfiguration.QUOTA_MIN_TICKS_CHARGE,
YarnConfiguration.DEFAULT_QUOTA_MIN_TICKS_CHARGE);
this.multiplicatorPeirod = this.conf.getLong(
YarnConfiguration.QUOTA_FIXED_MULTIPLICATOR_PERIOD,
YarnConfiguration.DEFAULT_QUOTA_FIXED_MULTIPLICATOR_PERIOD)
* checkpointInterval;
for(PriceMultiplicator.MultiplicatorType type: PriceMultiplicator.MultiplicatorType.values()){
currentMultiplicators.put(type, new Float(1));
}
// Initialize DataAccesses
containersLogsDA = (ContainersLogsDataAccess) RMStorageFactory.
getDataAccess(ContainersLogsDataAccess.class);
variableDA = (VariableDataAccess) RMStorageFactory.getDataAccess(
VariableDataAccess.class);
// Creates separate thread for retrieving container statuses
tickThread = new Thread(new TickThread());
tickThread.setName("ContainersLogs Tick Thread");
tickThread.setDaemon(true);
super.serviceInit(conf);
}
示例11: setCurrentPrices
import io.hops.metadata.yarn.entity.quota.PriceMultiplicator; //导入方法依赖的package包/类
public synchronized void setCurrentPrices(Map<PriceMultiplicator.MultiplicatorType,Float> currentPrices) {
this.currentMultiplicators = currentPrices;
}