use of diskCacheV111.vehicles.PoolManagerPoolInformation in project dcache by dCache.
the class SymbolTable method put.
public void put(String name, PoolManagerPoolInformation info) {
PoolCostInfo cost = info.getPoolCostInfo();
put(name + ".name", info.getName());
put(name + ".cpuCost", info.getCpuCost());
put(name + ".free", (cost == null) ? 0 : cost.getSpaceInfo().getFreeSpace());
put(name + ".total", (cost == null) ? 0 : cost.getSpaceInfo().getTotalSpace());
put(name + ".removable", (cost == null) ? 0 : cost.getSpaceInfo().getRemovableSpace());
put(name + ".used", (cost == null) ? 0 : cost.getSpaceInfo().getUsedSpace());
}
use of diskCacheV111.vehicles.PoolManagerPoolInformation in project dcache by dCache.
the class Task method selectPool.
/**
* Returns a pool from the pool list using the pool selection strategy.
*/
private CellPath selectPool() throws NoSuchElementException {
List<PoolManagerPoolInformation> pools = _parameters.poolList.getPools().stream().filter(pool -> !_replicas.contains(pool.getName())).collect(toList());
PoolManagerPoolInformation pool = _parameters.selectionStrategy.select(pools);
if (pool == null) {
if (pools.isEmpty()) {
throw new NoSuchElementException("No pools available.");
}
throw new NoSuchElementException("All target pools are full.");
}
return new CellPath(pool.getName());
}
use of diskCacheV111.vehicles.PoolManagerPoolInformation in project dcache by dCache.
the class PoolListFilter method getPools.
@Override
public synchronized ImmutableList<PoolManagerPoolInformation> getPools() {
if (!isValid()) {
return ImmutableList.of();
}
PoolManagerPoolInformation source = getSource();
if (source == null) {
return ImmutableList.of();
}
ImmutableList<PoolManagerPoolInformation> list = _poolList.getPools();
if (!list.equals(_cachedList)) {
ImmutableList.Builder<PoolManagerPoolInformation> filteredList = ImmutableList.builder();
for (PoolManagerPoolInformation pool : list) {
if (!isExcluded(source, pool) && isIncluded(source, pool)) {
filteredList.add(pool);
}
}
_filteredList = filteredList.build();
}
_cachedList = list;
return _filteredList;
}
use of diskCacheV111.vehicles.PoolManagerPoolInformation in project dcache by dCache.
the class PoolListFilter method getOfflinePools.
@Override
public ImmutableList<String> getOfflinePools() {
if (!isValid()) {
return ImmutableList.of();
}
PoolManagerPoolInformation source = getSource();
if (source == null) {
return ImmutableList.of();
}
ImmutableList<String> pools = _poolList.getOfflinePools();
if (!pools.equals(_cachedOfflinePools)) {
ImmutableList.Builder<String> filteredOfflinePools = ImmutableList.builder();
for (String pool : pools) {
if (!isExcluded(source, pool) && isIncluded(source, pool)) {
filteredOfflinePools.add(pool);
}
}
_filteredOfflinePools = filteredOfflinePools.build();
}
_cachedOfflinePools = pools;
return _filteredOfflinePools;
}
use of diskCacheV111.vehicles.PoolManagerPoolInformation in project dcache by dCache.
the class FileOperationHandler method handleMakeOneCopy.
/**
* <p>Wraps the creation of a migration {@link Task}. The task is given
* a static single pool list and a degenerate selection strategy, since the target has already
* been selected by this handler.</p>
*/
public Task handleMakeOneCopy(FileAttributes attributes) {
PnfsId pnfsId = attributes.getPnfsId();
FileOperation operation = fileOpMap.getOperation(pnfsId);
LOGGER.trace("Configuring migration task for {}.", pnfsId);
StaticSinglePoolList list;
try {
list = new StaticSinglePoolList(poolInfoMap.getPoolManagerInfo(operation.getTarget()));
} catch (NoSuchElementException e) {
CacheException exception = CacheExceptionUtils.getCacheException(CacheException.NO_POOL_CONFIGURED, "Copy %s, could not get PoolManager info for %s: %s.", pnfsId, Type.COPY, poolInfoMap.getPool(operation.getTarget()), e);
completionHandler.taskFailed(pnfsId, exception);
return null;
}
String source = poolInfoMap.getPool(operation.getSource());
TaskParameters taskParameters = new TaskParameters(pools, // PnfsManager cell stub not used
null, pinManager, migrationTaskService, taskSelectionStrategy, list, // eager; update should not happen
false, // isMetaOnly; just move the metadata
false, // compute checksum on update; should not happen
false, // force copy even if pool not readable
false, // maintain atime
true, 1);
Task task = new Task(taskParameters, completionHandler, source, pnfsId, ReplicaState.CACHED, ONLINE_STICKY_RECORD, Collections.EMPTY_LIST, attributes, attributes.getAccessTime());
if (ACTIVITY_LOGGER.isInfoEnabled()) {
List<String> allPools = list.getPools().stream().map(PoolManagerPoolInformation::getName).collect(Collectors.toList());
ACTIVITY_LOGGER.info("Initiating replication of {} from {} to" + " pools: {}, offline: {}", pnfsId, source, allPools, list.getOfflinePools());
}
LOGGER.trace("Created migration task for {}: source {}, list {}.", pnfsId, source, list);
return task;
}
Aggregations