Search in sources :

Example 1 with TaskParameters

use of org.dcache.pool.migration.TaskParameters in project dcache by dCache.

the class CopyAdjuster method createTask.

/**
 * 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.
 */
private synchronized void createTask(PoolManagerPoolInformation targetInfo, String source) {
    LOGGER.debug("Configuring migration task for {}, {}.", pnfsId, action);
    StaticSinglePoolList list = new StaticSinglePoolList(targetInfo);
    TaskParameters taskParameters = new TaskParameters(pools, // PnfsManager cell stub not used
    null, pinManager, executorService, new DegenerateSelectionStrategy(), list, // eager; update should not happen
    false, // just move the metadata; not relevant here
    false, // compute checksum on update; should not happen
    false, // force copy even if pool is not readable
    false, // maintain atime
    true, // only one copy per task
    1);
    createTask(taskParameters, source);
    if (ACTIVITY_LOGGER.isInfoEnabled()) {
        List<String> allPools = list.getPools().stream().map(PoolManagerPoolInformation::getName).collect(Collectors.toList());
        ACTIVITY_LOGGER.info("Initiating migration for {} of {} from {} to" + " pools: {}, offline: {}", action, pnfsId, source, allPools, list.getOfflinePools());
    }
    LOGGER.debug("Created migration task for {} of {}: source {}, list {}.", action, pnfsId, source, list);
}
Also used : DegenerateSelectionStrategy(org.dcache.qos.services.adjuster.util.DegenerateSelectionStrategy) StaticSinglePoolList(org.dcache.qos.services.adjuster.util.StaticSinglePoolList) TaskParameters(org.dcache.pool.migration.TaskParameters)

Example 2 with TaskParameters

use of org.dcache.pool.migration.TaskParameters 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

TaskParameters (org.dcache.pool.migration.TaskParameters)2 CacheException (diskCacheV111.util.CacheException)1 PnfsId (diskCacheV111.util.PnfsId)1 NoSuchElementException (java.util.NoSuchElementException)1 Task (org.dcache.pool.migration.Task)1 DegenerateSelectionStrategy (org.dcache.qos.services.adjuster.util.DegenerateSelectionStrategy)1 StaticSinglePoolList (org.dcache.qos.services.adjuster.util.StaticSinglePoolList)1 FileOperation (org.dcache.resilience.data.FileOperation)1 ResilientFileTask (org.dcache.resilience.util.ResilientFileTask)1 StaticSinglePoolList (org.dcache.resilience.util.StaticSinglePoolList)1