12
Hands on session: the AMGA Metadata Catalogue Riccardo Bruno - INFN Sevilla, 10 th -14 th /09/2007

Hands on session: the AMGA Metadata Catalogue

Embed Size (px)

DESCRIPTION

Hands on session: the AMGA Metadata Catalogue. Riccardo Bruno - INFN Sevilla, 10 th -14 th /09/2007. Access the Metadata Catalog. Copy a template of config file for the MDC: $ cp $GLITE_LOCATION/etc/mdclient.config \ $HOME/.mdclient.config Start up the Metadata Catalog Client with - PowerPoint PPT Presentation

Citation preview

Page 1: Hands on session:  the AMGA Metadata Catalogue

Hands on session: the AMGA Metadata Catalogue

Riccardo Bruno - INFNSevilla, 10th-14th/09/2007

Page 2: Hands on session:  the AMGA Metadata Catalogue

Access the Metadata Catalog

• Copy a template of config file for the MDC:

$ cp $GLITE_LOCATION/etc/mdclient.config \ $HOME/.mdclient.config

• Start up the Metadata Catalog Client with

$ mdclient

• Once logged in, you can list the available commands, typing help. Connected to amga.ct.infn.it:8822ARDA Metadata Server 1.2.0Query> help>> >help [topic]<>> >Displays help on a command or a topic.<>> >Valid topics are: help metadata metadata-optional directory entry

group acl index schema sequence user view ticket commands<

• Commands are grouped by topic. You can get the list of valid commands for each topic, typing: help [topic]

• Example: help entry

Page 3: Hands on session:  the AMGA Metadata Catalogue

AMGA: List of topics (HELP)

• Valid topics: help metadata metadata-optional directory replication entry group acl index schema sequence user view ticket commands

Page 4: Hands on session:  the AMGA Metadata Catalogue

mdclient: Generic Commands

>> createdir <path> [options] Make a new folder. It can inherit the schema assosciated to the upper

level folder>> rm pattern Remove items corresponding to the given pattern>> link <file> Make a link to another file or to a external URL>> dir <directory> List the content of a directory>> listentries <directory> List the items (not the collections) of a directory>> stat <filepattern> Show the statistic information about a directory>> chown <file> <owner> Changhe the ownership of a file or a directory>> chmod <file> <rights> Change the access rights to a file or a directory>> rmdir <directory> Remove a directory>> dump <directory> Make a recursive dump startung from a given directory, (the default

is: ‘/’)

Page 5: Hands on session:  the AMGA Metadata Catalogue

MDC directory related commands• Browse the contents of a directory

dir [path] / ls [path]Returns the name of all subdirectories and files in the given path or in

the current directory if not specified• Print the current working directory

pwd• Change the current working directory

cd directoryExample: cd /gilda/sevilla

• Directory creation createdir /parentdir/dirCreates the directory dir if it does not yet exist but parentdir

already doesExample: createdir /gilda/sevilla/sevillaXX (XX=01…40)

• Directory removal rmdir pathRemoves the directory given by path

Page 6: Hands on session:  the AMGA Metadata Catalogue

MDC: Handling attributes

• Schema population addattr dir attr typeAdds a new attribute to the schema of a directory. Type is the

name of an SQL datatype which will translated (if necessary) into a data type understood by the back end DB.

Examples of valid datatypes are int, float, varchar(n), timestamp, text, numeric(p,s)

Examples: addattr /gilda/sevilla/sevillaXX id intaddattr /gilda/sevilla/sevillaXX name

varchar(32)addattr /gilda/sevilla/sevillaXX remark

varchar(128)

• Attribute listing listattr pathReturns a list of all attributes of the given file/direcory

• Attribute Removal removeattr dir attributeRemoves an attribute from a directory if it is not used by any

entry in the directory

Page 7: Hands on session:  the AMGA Metadata Catalogue

MDC: managing entries

• Entry creation addentry entry (attribute value)+Add a new entry and initializes some attributesExample: addentry /gilda/sevilla/sevillaXX/entry_01 id 1

name ‘name 01’ remark ‘remark of entry 01’• Setting attribute values

setattr entry (attribute value)+Sets one or more attributes of an entry to given valuesExample: setattr /gilda/sevilla/sevillaXX/entry_01 id 100

• Getting attribute values getattr pattern (attribute)+Returns the entries and all the attributes for every file matching

patternExample: getattr /gilda/sevilla/sevillaXX/* name

• Entry deletion rm patternRemoves all entries matching patternExample: rm /gilda/…/entry_*

Page 8: Hands on session:  the AMGA Metadata Catalogue

Metadata Queries

find pattern ‘query_condition’Returns all entries matching pattern for which

query_condition is trueExamples:

find /gilda/sevilla/sevillaXX ‘id > 10’find /gilda/sevilla/sevillaXX ‘like(name, “P%”)’find /gilda/sevilla/sevillaXX ‘like(name, “P%”) AND id > 10’

selectattr attr... conditionReturns the values of given attributes for all files

matching conditionExample:

cd /gilda/sevilla/sevillaXXselectattr .:id .:name ‘id > 10'

Page 9: Hands on session:  the AMGA Metadata Catalogue

Hands-on Session

Exercise:• Log into the Metadata Catalog• Create a directory with your surname into the

/grid/gilda/sevilla/sevillaXX directory• Add some attributes (id int, name varchar(32), remark

varchar(128)) to the directory just created• Add some entries, you may use any name or the LFNs you

uploaded and registered into the File Catalog during the DMS hands-on session

• Fill the attribute fields for the inserted entries• Look for the entries having ‘id’ > 50

Page 10: Hands on session:  the AMGA Metadata Catalogue

Solution

Query> createdir sevilla30Query> pwd>> /gilda/sevilla/sevilla30/Query> addattr /gilda/sevilla/sevilla30/ id intQuery> addattr /gilda/sevilla/sevilla30/ name varchar(32)Query> addattr /gilda/sevilla/sevilla30/ remark

varchar(128)Query> addentry /gilda/sevilla/sevilla30/entry_01 id 1

name ‘name 1' remark ‘remark 1‘…Query> addentry /gilda/sevilla/sevilla30/entry_0n id n

name ‘name n' remark ‘remark n‘Query> getattr /gilda/sevilla/sevilla30/* id name remark…Query> find /gilda/sevilla/sevilla30/ ‘id >= k‘ (k=1…n)

Page 11: Hands on session:  the AMGA Metadata Catalogue

GILDA wiki pages

• Introduction to AMGA https://grid.ct.infn.it/twiki/bin/view/GILDA/AMGAHandsOn

• AMGA Advanced usage https://grid.ct.infn.it/twiki/bin/view/GILDA/AMGAAdv

Page 12: Hands on session:  the AMGA Metadata Catalogue

Questions