How to lock datasets in SAM caches

This document describes the procedure to lock datasets in SAM caches and thus prevent their (accidental) removal. For completeness an example script is provided: pin.py

Note: the script does not yet use the SAM Python API but the command line tools to lock the file.This is not really a problem but not "nice".

General considerations

When adding cache areas to a SAM station, a file replacement policy has to be defined, usually LRU (least recently used). This way, SAM will erase the files which have not been used recently in order to make space for new ones. Note that this only happens on request, i.e. SAM will not suddenly erase files but if a new project starts and requests files which would not fit into the remaining free space, SAM deletes the files which have not been used for a while to fit all requested files on disk.

However, often this is not wanted, e.g. since file transfers take considerable amount of time and one wants to protect the files from accidental removal (e.g. by a user project) and keep the datasets "golden".

This can be done by "locking" or "pinning" the files on the disk, hence telling SAM that these files must not be deleted. To do this, the command "sam lock file" is used.

Locking entire datasets

A typical use case is that an entire SAM dataset is imported to a remote institution and then locked on the disks.

Note: You need to be a group administrator in order to be able lock files.

The script pin.py can be run to trigger the import of a dataset (which has to be created before), at each time a file is being delivered, the method "file_ready" is called and the file is locked (the call to os.system can be replaced by the appropieate Python method)

To run the script, execute:
sam run project --interactive pin.py
which will start a new project with the dataset "your_sam_dataset" at station "your_station", import the files and lock them to disk

The following things need to be adapted in the script:
sam_station to your station name, e.g. cdf-fzkka
project_definition to the predefined SAM dataset, e.g. jpmm08-1file

FQDN of SAM host to the FQDN of your host running the SAM station, e.g. cdf.fzk.de



 © 2002 by Ulrich Kerzel • Ulrich.Kerzel@cern.ch

[this page is part of a frameset]
LOAD FRAMESET
 
Last modified: Sat Mar 6 12:11:33 CST 2004