Download presentation
Presentation is loading. Please wait.
Published byEsmond Lambert Modified over 9 years ago
1
Hands on session: the AMGA Metadata Catalogue Riccardo Bruno - INFN Madrid, 07-11/05/2007
2
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:8822 ARDA Metadata Server 1.2.0 Query> 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
3
AMGA: List of topics (HELP) Valid topics: help metadata metadata-optional directory replication entry group acl index schema sequence user view ticket commands
4
mdclient: Generic Commands >> createdir [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 Make a link to another file or to a external URL >> dir List the content of a directory >> listentries List the items (not the collections) of a directory >> stat Show the statistic information about a directory >> chown Changhe the ownership of a file or a directory >> chmod Change the access rights to a file or a directory >> rmdir Remove a directory >> dump Make a recursive dump startung from a given directory, (the default is: ‘/’)
5
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 directory Example: cd /gilda/madrid Directory creation createdir /parentdir/dir Creates the directory dir if it does not yet exist but parentdir already does Example: createdir /gilda/Madrid/madridXX (XX=01…40) Directory removal rmdir path Removes the directory given by path
6
MDC: Handling attributes Schema population addattr dir attr type Adds 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/Madrid/madridXX id int addattr /gilda/Madrid/madridXX name varchar(32) addattr /gilda/Madrid/madridXX remark varchar(128) Attribute listing listattr path Returns a list of all attributes of the given file/direcory Attribute Removal removeattr dir attribute Removes an attribute from a directory if it is not used by any entry in the directory
7
MDC: managing entries Entry creation addentry entry (attribute value)+ Add a new entry and initializes some attributes Example: addentry /gilda/Madrid/madridXX/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 values Example: setattr /gilda/Madrid/madridXX/entry_01 id 100 Getting attribute values getattr pattern (attribute)+ Returns the entries and all the attributes for every file matching pattern Example: getattr /gilda/Madrid/madridXX/* name Entry deletion rm pattern Removes all entries matching pattern Example: rm /gilda/ … /entry_*
8
Metadata Queries find pattern ‘ query_condition ’ Returns all entries matching pattern for which query_condition is true Examples: find /gilda/Madrid/madridXX ‘ id > 10 ’ find /gilda/Madrid/madridXX ‘ like(name, “ P% ” ) ’ find /gilda/Madrid/madridXX ‘ like(name, “ P% ” ) AND id > 10 ’ selectattr attr... condition Returns the values of given attributes for all files matching condition Example: cd /gilda/Madrid/madrid selectattr.:id.:name ‘ id > 10'
9
Hands-on Session Exercise: Log into the Metadata Catalog Create a directory with your surname into the /grid/gilda/Madrid/madridXX 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
10
Solution Query> createdir madrid40 Query> pwd >> /gilda/Madrid/madrid40/ Query> addattr /gilda/Madrid/madrid40/ id int Query> addattr /gilda/Madrid/madrid40/ name varchar(32) Query> addattr /gilda/Madrid/madrid40/ remark varchar(128) Query> addentry /gilda/Madrid/madrid40/entry_01 id 1 name ‘ name 1' remark ‘ remark 1 ‘ … Query> addentry /gilda/Madrid/madrid40/entry_0n id n name ‘ name n' remark ‘ remark n ‘ Query> getattr /gilda/Madrid/madrid40/* id name remark … Query> find /gilda/Madrid/madrid40/ ‘ id >= k ‘ (k=1 … n)
11
GILDA wiki pages Introduction to AMGA https://grid.ct.infn.it/twiki/bin/view/GILDA/AMGAHandsOn https://grid.ct.infn.it/twiki/bin/view/GILDA/AMGAHandsOn AMGA Advanced usage https://grid.ct.infn.it/twiki/bin/view/GILDA/AMGAAdv https://grid.ct.infn.it/twiki/bin/view/GILDA/AMGAAdv
12
Questions
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.