Changes between Version 22 and Version 23 of Tutorial/DataMgt


Ignore:
Timestamp:
Dec 11, 2008, 11:27:10 PM (16 years ago)
Author:
/O=GRID-FR/C=FR/O=CNRS/OU=LAL/CN=Michel Jouvin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tutorial/DataMgt

    v22 v23  
    1 = Gestion des Données =
     1= Data Management =
    22[[TracNav]]
    33
    44[[TOC(inline)]]
    55
    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.
     6Grid 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...
    79
    8 == Utilisation du File Catalog ==
    910
    10 Le service ''file catalog'' (ou ''replica catalog'') dans EGEE utilise le LFC. Il existe quelques commandes spécifiques au LFC qui commencent par `lfc-`. Elles ne sont généralement pas utilisées directement mais via les commandes qui permettent de manipuler et gérer les fichiers sur la grille, notamment les commandes appelées ''lcg_utils'' qui commencent par `lcg-`. Comme les commandes de soumissions de job, les commandes `lcg-` utilisent la VO du proxy de l'utilisateur par défaut.
     11== Main Data Management Commands ==
    1112
    12 ''Note : lorsqu'on souhaite utiliser les commandes `lfc-`, il est nécessaire de définir la variable d'environnement `LFC_HOST` avec le nom du serveur LFC à utiliser. Les commandes `lcg-` au contraire localisent directement le serveur approprié pour la VO de l'utilisateur. Dans ce cas, la variable `LFC_HOST` permet de forcer l'utilisation d'un autre serveur LFC que le serveur par défaut de la VO.''
     13A set of commands, known as ''lcg_utils'', are the main user-oriented tools to handle file and data management. They are completly independent of the actual SE implementation used and they take care of consistency between file catalog and storage elements. For example, they create logical file names in catalog when creating a file, they update a catalog entry when adding a new replica, they remove an entry from the catalog if the interaction with the SE is not successful...
    1314
    14 Sur la grille, un fichier peut avoir plusieurs replica. Dans ce cas, il n'y a qu'une seule entrée dans le catalogue à laquelle est associé l'ensemble des replica.
     15''Note: each SE implementation provides its private set of client commands. They are not described here, even though some of them are independent of the SE implementation and may work with others. They are not needed, except in very specific circumstances.''
    1516
    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.
     17Most 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`.
    2821
    29  * `lcg-lg` : retourne le GUID associé à un fichier.
     22When referring to local file, the prefix `file:` is optional and relative file names are supported.
    3023
    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.
     24Main 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.
    3432
    35 Toutes ces commandes ont une aide en ligne accessible accessible avec l'option `--help` ou via la commande `man`.
     33All these commands rely on BDII to guess defaults according to the VO used and to find the appropriate parameters to talk with the selected SE. In case BDII service is not functioning properly this may cause the commands to fail. Option `--nobdii` to `lcg-xxx` commands may help but requires to add a lot of parameters like SE port to use...
    3634
    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`.
     35All the commands have an online help available with option `--help` or through the `man` command.
    5036
    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`.
    5251
    53 Les commandes client ne trouvent pas automatiquement le serveur LFC pour votre VO. Pour la VO vo.lal.in2p3.fr, il est nécessaire de définir la variable d'environnement LFC_HOST”.
    54    * csh : `setenv LFC_HOST grid14.lal.in2p3.fr` pour le shell csh ou
    55    * sh/bash : `export LFC_HOST=grid14.lal.in2p3.fr` pour le shell sh.
    5652
    57 Normalement on ne change pas le contenu de ce catalogue manuellement. Si on supprime une entrée dans le catalogue, on peut laisser des fichiers qui seront introuvables dans la grille. Cependant, il peut être intéressant d'y regarder de temps en temps directement les informations et de créer des nouveaux répertoires.
     53== Using File Catalog ==
    5854
    59  * Pour trouver les fichiers dans  '' /grid/vo.lal.in2p3.fr'', faites :
    60    * `lfc-ls -l /grid/vo.lal.in2p3.fr`   On peut voir les permissions, la taille, la date de modification, et le nom avec l'option “-l”.   Vous allez trouver votre fichier dans la liste.
     55The ''File Catalog'' service (also known as ''replica catalog'') in gLite is implemented using LFC. LFC service has a client implemented through commands whose names start with `lfc-`. These commands are installed on every UI and WN.
    6156
    62  * Le LFC supporte les “Access Control Lists” (ACL). Pour  regarder l'ACL pour un fichier ou un répertoire :
    63    * `lfc-getacl /grid/vo.lal.in2p3.fr` A chaque répertoire correspond deux ACLs : l'ACL pour le répertoire et une ACL par défaut. L'ACL par défaut est appliqué aux nouveaux fichiers du répertoire. Normalement les commandes `lcg-*` mettent les bonnes permissions dans les fichiers et répertoires. Le LFC utilise les ACLs mais malheureusement cette fonctionnalité n'est pas très utilisable car l'accès est toujours lié au compte unix. On ne peut donc pas encore utiliser les ACLs pour contrôler finement l'accès aux fichiers.
     57These LFC commands are seldom used: LFC interaction is normally done with commands handling the necessary interactions with both LFC and SE services to implement actual file management (mainly the so-called ''lcg_utils'' commands whose names start with `lcg-`.). There is one exception, `lfc-mkdir`, that '''must be used to create directories''' before creating LFN in them (`lfc-mkdir` supports a `-p` option to create parent directories, similar to the same option in Unix `mkdir`).
    6458
    65  * On peut créer un nouvelle arborescence avec `lfc-mkdir`. On doit alors vérifier que le nouveau répertoire possède les bons droits.  Créez un  nouveau répertoire et copiez-y un fichier. Ensuite utilisez `lcg-del` avec l'option “-a” et `lfc-rm` pour nettoyer le LFC.
     59All of these commands require a valid VOMS proxy with a valid VOMS extension (use `voms-proxy-init --voms`), else you need to use option `--vo` with `lcg-xxx` commands. `lcg-xxx` commands locate the LFC server from the VO used. To use a LFC server other than the default (central) one or with `lfc-xxx` commands, define environment variable `LFC_HOST` to the host name of the LFC server to use.
    6660
    67 == Accéder depuis un job à des données stockées ==
     61''Note: this is not recommended to define `LFC_HOST` when this is not necessary as your command may fail if the default server is moved. An alternative to define `LFC_HOST` for using `lfc-xxx` commands is to prefix the LFN with `lfc.host.dom.ain:`.''
    6862
    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
     65The 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
     73In 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
     75To specify the grid files the job needs access to, it is necessary to add the 2 following lines to the JDL:
    7076{{{
    7177DataAccessProtocol ={ "gsiftp","rfio"};
    72 InputData = "lfn:<LFN>";
     78InputData = {"file1", "file2", ...};
    7379}}}
    74 ''Note : Les protocoles sont les moyens par lesquels votre exécutable peut télécharger ce fichier. Tous les SEs supportent le protocole gsiftp. Les autres ne sont pas obligatoires.''
    7580
    76  * Modifiez le fichier ''InputData.jdl''. Mettez le nom logique  de votre fichier.
     81`DataAccessProtocol` is a list of transfer/access protocol that the job will use to access the data. The protocols in the example are the most common but other possibilities are `xroot`, `dcap`, `https`... There is no default and this clause is required if `InputData` is present.
    7782
    78  * Affichez la liste des sites sur lesquels le job peut être  soumis. Pourquoi est-elle si réduite?
     83File names specified in `InputData` can be LFN, GUID or SURL. The standard syntax is used with the corresponding prefix `lfn:`, `guid:` or `srm:`. See [wiki:Tutorial/DataMgt#MainDataManagementCommands above].
    7984
    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
     106GFAL (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 
     111GFAL is available for C/C++, Python and Perl. There is no Java implementation. In fact, `lcg-xxx` commands are wrapper above GFAL.
     112
     113Documentation with examples is available in man pages for the functions.