6 | | Les services qui permettent la gestion des fichiers sont ''file catalog'' (LFC) et le ''storage element'' (SE). Le ''file catalog'' est une base de données qui contient l'association entre un identifiant et les locations des fichiers dans lagrille. Le SE fourni l'espace pour stocker les fichiers. |
| 6 | Grid services participating to data management are the ''File Catalog'' (LFC) and the ''Storage Element'' (SE). |
| 7 | * File Catalog: this service manages file names used by the user and associates them with replicas. Every grid file with a catalog entry can have several replicas. Catalog file names are Unix-like. |
| 8 | * Storage Element: this is the service responsible for actually managing the data. It handles access to one file replica. Several SE implementations are available, interfacing with different back-ends like disks, distributed file systems, MSS (tapes). A SE is access through the ''SRM'' interface that has several advanced features like space reservation, file pinning, staging from MSS... |
16 | | Les principales commandes `lcg_utils` sont : |
17 | | * `lcg-cr` (copy and register) : cette commande permet de copier un fichier local ou résidant sur un SE sur un autre SE. '''La destination est nécessairement un SE'''. Par défaut, il enregistre le nom du fichier dans le LFC. Le ''nom logique'' enregistré est généré par défaut. Pour imposer un autre ''nom logique'' que celui par défaut, il faut utiliser l'option `-l`. Le nom du fichier sur le SE est lui aussi généré s'il n'est pas spécifié explicitement, c'est-à-dire lorsque l'option `-d` ne spécifie que le nom du serveur. On utilise généralement l'option `-v` (verbose) qui permet d'avoir un détail du déroulement de la copie et facilite l'analyse des éventuelles erreurs. |
18 | | |
19 | | * `lcg-cp` (copy) : proche d'une commande `cp` standard, il permet de copier un fichier entre une source et une destination. Source et destination peuvent être soit un fichier local, soit un fichier sur un SE avec toutes les combinaisons possibles. |
20 | | |
21 | | * `lcg-rep` : création d'un réplica supplémentaire d'un fichier déjà existant et enregistrement de ce nouveau replica dans le catalogue. A la différence de `lcg-cr`, cela ne crée pas de nouvelle entrée dans le catalogue. |
22 | | |
23 | | * `lcg-lr` (list replica) : donne la liste des différents replica associés à un ''nom logique''. |
24 | | |
25 | | * `lcg-ls` : équivalent de la commande Unix `ls`. |
26 | | |
27 | | * `lcg-del` : suppression d'un fichier d'un SE et éventuellement du catalogue LFC. |
| 17 | Most of the commands, when referring to grid files stored on a SE, can use one of the following identifier for the file: |
| 18 | * Logical File Name (LFN): entry name in the file catalog, with a Unix-like syntax and starting with `/grid/`''voname''. A LFN must be prefixed `lfn:`. |
| 19 | * GUID: immutable identifier associated with a catalog entry (doesn't change when the LFN is changed/renamed). A GUID must be prefixed `guid:`. |
| 20 | * SURL: name of a replica on a particular SE. It has a URL format like `srm://se.host.name/path/to/file`. |
31 | | Les noms de fichier doivent adhérer à la syntaxe `protocole:/path/to/file`. `protocole` est soit `file` pour un fichier local, soit `srm` pour un fichier sur un SE (appelé `SURL`), soit `lfn` pour un nom logique enregistré dans le catalogue LFC. Pour les fichiers locaux, le nom du fichier doit être une spécification absolue : les chemins relatifs ne sont pas acceptés. Pour spécifier un fichier du directory courant, il est possibilité d'utiliser la valeur `$PWD/filename`. |
32 | | |
33 | | Les commandes `lcg_utils` ont par défaut besoin d'accéder au BDII et ne peuvent utiliser que des ressources enregistrées dans le BDII. On peut aussi les utiliser sans BDII avec l'option `--nobdii` mais dans ce cas il faut fournir plus de paramètre sur les SE utilisés. |
| 24 | Main commands are: |
| 25 | * `lcg-cr` (copy and register): this command copies a file available locally (it can also copy a file from another SE) and create a new file on a SE, registering it in a file catalog. Copy destination '''must be''' a storage element. Even though the source is a file on a SE, this creates a new file and not a new replica of the existing file. By default logical file name registered in the LFC is generated but it can be set explicitly using option `-l` (''directories'' in the LFN must be created with `lfc-mkdir`, as in Unix they must be created with `mkdir` before being used). The storage element to use for the destination can be specified with option `-d`. If ommitted, the default SE (as specified by environment variable `VO_VONAME_DEFAULT_SE) for the VO is used. If `-d` is present but specifies only a host name, the file name on the SE is generated. It is recommended to use option `-v` (verbose) to get details about the copy operation and ease the troubleshooting in case of errors. |
| 26 | * `lcg-cp` (copy): feature and syntax very similar to Unix `cp` command. Source and destination can be either a local file or a file on a SE, with any combination. Conversely to `lcg-cr` destination is not registered into a catalog and cannot be a LFN (the input file may be identified with a LFN or GUID if it resides on a SE). This command is mainly used to get a local copy of a SE file on a UI or WN. |
| 27 | * `lcg-rep`: this command allow to add a new replica to an existing file registered in a file catalog. Syntax is similar to `lcg-cr` but the source '''must be''' a LFN. But conversely to `lcg-cr`, this command updates an existing entry in the file catalog but doesn't create a new one. |
| 28 | * `lcg-lr` (list replica): list all the replicas associated with a given LFN or GUID. |
| 29 | * `lcg-ls` : feature and syntax very similar to Unix `ls` command. |
| 30 | * `lcg-del` : removes a file replica from a SE and optionally remove entry from LFC after removing all replicas. |
| 31 | * `lcg-lg` : returns the GUID associated with a LFN. |
37 | | __Exercices__ : |
38 | | 1. Visualisez les informations concernant les ressources SE disponibles pour la VO vo.lal.in2p3.fr, en utilisant la commande [wiki:Tutorial/SystemInfo#LaCommandelcg-infosites lcg-infosites]. |
39 | | * Combien de 'storage elements' sont disponibles pour la VO vo.lal.in2p3.fr ? |
40 | | * Trouver la même information pour la VO `dteam`. Combien de SEs sont disponibles pour la VO dteam ? |
41 | | 1. Créez un fichier texte et copiez-le sur un SE à l'aide de la commande `lcg-cr` en définissant le nom logique à utiliser pour le fichier. Le format du nom logique doit être `lfn:/grid/voname/filename`, par exemple `lfn:/grid/vo.lal.in2p3.fr/myname-tot.txt`. |
42 | | 1. Vérifiez que le fichier copié est bien présent dans le catalogue à l'aide de la commande `lcg-lr`. Si cela se passe bien, la commande affiche un URL avec un protocole `srm`. |
43 | | 1. Afficher les informations sur le fichier avec la commande `lcg-ls`. |
44 | | 1. Retrouver le GUID associé au fichier précédent. |
45 | | 1. Répliquer le fichier précédemment créer avec la commande `lcg-rep` sur un autre SE ouvert à la VO, identifié à la première étape. |
46 | | 1. Vérifier que le nouveau replica a bien été ajouté dans le catalogue, en utilisant la commande `lgc-lr`. |
47 | | 1. On peutiliser la commande `lcg-lg` pour trouver le GUID pour un nom logique ou SURL. Regardez l'usage de cette commande et vérifiez que le GUID est correct pour votre nom logique. |
48 | | 1. Récupérez localement le fichier à l'aide de la commande `lcg-cp`. Utiliser d'abord le nom logique puis le nom d'un des replica (SURL). |
49 | | 1. Supprimez l'un des replica de ce fichier à l'aide de la commande `lcg-del` et verifier le résultat avec la commande `lcg-lr`. |
| 35 | All the commands have an online help available with option `--help` or through the `man` command. |
51 | | == Regarder les informations dans le LFC == |
| 37 | __Exercises__ : |
| 38 | 1. Display information about avaialable SE resources for VO `vo.lal.in2p3.fr`, using command [wiki:Tutorial/SystemInfo#LaCommandelcg-infosites lcg-infosites]. |
| 39 | * How many SEs are available for VO vo.lal.in2p3.fr ? |
| 40 | * Find the same information for VO `dteam`. How many SEs are available for this VO ? |
| 41 | 1. Create a text file and copy it on a SE using command `lcg-cr`, using option `-l` to define the logical name (see above for the logical name format). Try to define the SURL (replica name on SE) too. |
| 42 | 1. Check that the file(s) is present in the catalog and list its replicas, using command `lcg-lr`. This should return SURL for all the replicas (a SURL starts with prefix `srm:`). |
| 43 | 1. Display detailed information about the file, using command `lcg-ls`. |
| 44 | 1. Find the GUID associated with the previous files. |
| 45 | 1. Replicate the file on another SE open to the VO (using the information got with `lcg-infosites`). |
| 46 | 1. Check that the new replica has been added to the catalog entry for the file, using command `lcg-lr` as previously. Compare the information returned. |
| 47 | 1. Copy locally the file from the SE, using command `lcg-cp`. Do it using the GUID, the LFN and a replica SURL. |
| 48 | 1. Suppress one of the replica using command `lcg-del` and check the result with `lcg-lr`. |
| 49 | 1. Suppress the other replica using command `lcg-del` and check the result with `lcg-lr`. |
| 50 | 1. Recreate a file with 2 replicas and try to suppress all the replicas at once. Try to do a `lcg-lr` and a `lcg-ls`. |
69 | | * Regardez les fichiers ''InputData.jdl'' et ''InputData.sh''. Dans ''InputData.jdl'' il y a deux nouvelles lignes qui permettent d'exécuter les jobs sur un CE proche des fichiers de données : |
| 63 | === LFC client main commands === |
| 64 | |
| 65 | The main LFC commands that may be used under normal circumstances are: |
| 66 | * `lfc-mkdir [-]`: create a directory in LFC and optionally its parents. |
| 67 | * `lfs-ls [-l]`: similar to Unix `ls` command. Gives the content of a directory and optionally detailed information in a Unix like format. User and group are the DN of the owner and the FQAN of the primary VOMS group. |
| 68 | * `lfc-getacl / lfc-setacl`: LFC namespace supports Posix-like ACLs. See the man page for more information on the syntax, in particular for `lfc-setacl`. A file name has one ACL but a directory has 2 different ACLs: the ACL controlling access to the directory and the default ACL applied to new files (new sub-directories inherit the parent ACL). |
| 69 | |
| 70 | |
| 71 | == Access Data on the Grid from a Job == |
| 72 | |
| 73 | In the job description, this is possible to describe the data available on the grid that the job need to access. Data files can be identified by a LFN, a GUID or a SURL. This description is taken into account by WMS to select the appropriate site: a CE will be selected only if one the file replica is on one of the ''close SE'' for the CE (this is a configuration information for each CE). Then the job can retrieve the list of files provided, the replicas used... with command `glite-brokerinfo` (available only on WNs). |
| 74 | |
| 75 | To specify the grid files the job needs access to, it is necessary to add the 2 following lines to the JDL: |
80 | | * Lancez ce job et vérifiez que le fichier est bien lu. |
| 85 | ''Note: files specified in `InputData` are not copied to the WN, conversely to files in `InputSandbox`. This is the responsability of the job to do what is relevant and appropriate.'' |
| 86 | |
| 87 | `glite-brokerinfo` command accept many options, the main ones being: |
| 88 | * `getCE` |
| 89 | * `getDataAccessProtocol` |
| 90 | * `getInputData` |
| 91 | * `getSEs` |
| 92 | * `getCloseSEs` |
| 93 | * `getSEFreeSpace <SE> |
| 94 | * `getLFN2SFN <LFN>` |
| 95 | * `getSEProtocols <SE>` |
| 96 | |
| 97 | |
| 98 | __Exercises__: |
| 99 | 1. Modify one of your existing JDL file and add clauses described above with reference to a file you created with `lcg-cr` commands. |
| 100 | 1. Use `glite-wms-job-list-match` command to display the list of sites which can execute the job. Compare with the list without the `InputData` clause. |
| 101 | 1. Execute the job after adding `glite-brokerinfo closeSEs` and `glite-brokerinfo getInputData` commands to check the information passed to the job. |
| 102 | |
| 103 | |
| 104 | == GFAL == |
| 105 | |
| 106 | GFAL (Grid File Access Library) is a set of low-level and high-level APIs providing: |
| 107 | * Posix-like funtions to access files: gfal_open(), gfal_read(), gfal_write(), gfal_close()... These functions use a SURL to identify the file. |
| 108 | * API to the file catalog to do LFN/GUID to SURL translation |
| 109 | * API to the advanced features of SRM |
| 110 | |
| 111 | GFAL is available for C/C++, Python and Perl. There is no Java implementation. In fact, `lcg-xxx` commands are wrapper above GFAL. |
| 112 | |
| 113 | Documentation with examples is available in man pages for the functions. |