Search in sources :

Example 1 with PoolManagerPoolInformation

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());
}
Also used : PoolCostInfo(diskCacheV111.pools.PoolCostInfo)

Example 2 with PoolManagerPoolInformation

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());
}
Also used : PinManagerMovePinMessage(org.dcache.services.pinmanager1.PinManagerMovePinMessage) ScheduledFuture(java.util.concurrent.ScheduledFuture) ReflectionUtils(org.dcache.util.ReflectionUtils) PoolManagerPoolInformation(diskCacheV111.vehicles.PoolManagerPoolInformation) Deque(java.util.Deque) Message(diskCacheV111.vehicles.Message) HashSet(java.util.HashSet) StickyRecord(org.dcache.pool.repository.StickyRecord) Collectors.toCollection(java.util.stream.Collectors.toCollection) CellStub(org.dcache.cells.CellStub) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) AbstractMessageCallback(org.dcache.cells.AbstractMessageCallback) ReplicaState(org.dcache.pool.repository.ReplicaState) NoSuchElementException(java.util.NoSuchElementException) Method(java.lang.reflect.Method) PrintWriter(java.io.PrintWriter) FileAttributes(org.dcache.vehicles.FileAttributes) PnfsId(diskCacheV111.util.PnfsId) FireAndForgetTask(org.dcache.util.FireAndForgetTask) TransitionUndefinedException(statemap.TransitionUndefinedException) Collection(java.util.Collection) Set(java.util.Set) UUID(java.util.UUID) PnfsGetCacheLocationsMessage(diskCacheV111.vehicles.PnfsGetCacheLocationsMessage) Preconditions.checkState(com.google.common.base.Preconditions.checkState) InvocationTargetException(java.lang.reflect.InvocationTargetException) TimeUnit(java.util.concurrent.TimeUnit) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) Stream(java.util.stream.Stream) Optional(java.util.Optional) FileAttribute(org.dcache.namespace.FileAttribute) CellPath(dmg.cells.nucleus.CellPath) ArrayDeque(java.util.ArrayDeque) CellPath(dmg.cells.nucleus.CellPath) PoolManagerPoolInformation(diskCacheV111.vehicles.PoolManagerPoolInformation) NoSuchElementException(java.util.NoSuchElementException)

Example 3 with PoolManagerPoolInformation

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;
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) PoolManagerPoolInformation(diskCacheV111.vehicles.PoolManagerPoolInformation)

Example 4 with PoolManagerPoolInformation

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;
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) PoolManagerPoolInformation(diskCacheV111.vehicles.PoolManagerPoolInformation)

Example 5 with PoolManagerPoolInformation

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;
}
Also used : ResilientFileTask(org.dcache.resilience.util.ResilientFileTask) Task(org.dcache.pool.migration.Task) CacheException(diskCacheV111.util.CacheException) StaticSinglePoolList(org.dcache.resilience.util.StaticSinglePoolList) TaskParameters(org.dcache.pool.migration.TaskParameters) PnfsId(diskCacheV111.util.PnfsId) FileOperation(org.dcache.resilience.data.FileOperation) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

PoolManagerPoolInformation (diskCacheV111.vehicles.PoolManagerPoolInformation)13 PoolListFilter (org.dcache.pool.migration.PoolListFilter)8 RefreshablePoolList (org.dcache.pool.migration.RefreshablePoolList)8 Test (org.junit.Test)8 ImmutableList (com.google.common.collect.ImmutableList)2 PoolCostInfo (diskCacheV111.pools.PoolCostInfo)2 PnfsId (diskCacheV111.util.PnfsId)2 NoSuchElementException (java.util.NoSuchElementException)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 CacheException (diskCacheV111.util.CacheException)1 Message (diskCacheV111.vehicles.Message)1 PnfsGetCacheLocationsMessage (diskCacheV111.vehicles.PnfsGetCacheLocationsMessage)1 CellPath (dmg.cells.nucleus.CellPath)1 PrintWriter (java.io.PrintWriter)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 ArrayDeque (java.util.ArrayDeque)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1