Difference between revisions of "DIRAC FileCatalog MetaData"
From GridPP Wiki
Line 4: | Line 4: | ||
<br> | <br> | ||
# Through the CLI: | # Through the CLI: | ||
+ | <pre> | ||
+ | dirac-dms-filecatalog-cli | ||
+ | for a file: | ||
+ | |||
+ | create index: | ||
+ | FC:/gridpp/user/d/daniela.bauer>meta index -f testfiles int | ||
+ | Added metadata field testfiles of type int | ||
+ | |||
+ | show will show you all the tags available for your VO (here:gridpp) | ||
+ | FC:/gridpp/user/d/daniela.bauer>meta show | ||
+ | FileMetaFields : {'testfiles': 'INT', 'experiment': 'VARCHAR(128)', 'JMMetaInt3': 'INT', 'JMMetaInt': 'INT'} | ||
+ | DirectoryMetaFields : {'JMMetaInt2': 'INT'} | ||
+ | |||
+ | attach metadata to files: | ||
+ | FC:/gridpp/user/d/daniela.bauer>meta set test-man testfile 1 | ||
+ | /gridpp/user/d/daniela.bauer/test-man {'testfile': '1'} | ||
+ | FC:/gridpp/user/d/daniela.bauer>meta set test-qmul testfile 1 | ||
+ | /gridpp/user/d/daniela.bauer/test-qmul {'testfile': '1'} | ||
+ | |||
+ | find all files that are associated with a certain metadata tag: | ||
+ | FC:/gridpp/user/d/daniela.bauer>find /gridpp testfiles=1 | ||
+ | Query: {'testfiles': 1} | ||
+ | /gridpp/user/d/daniela.bauer/test-man | ||
+ | /gridpp/user/d/daniela.bauer/test-qmul | ||
+ | |||
+ | </pre> | ||
# Through the API: | # Through the API: | ||
The official DIRAC documentation on the topic can be found [https://dirac.readthedocs.io/en/latest/UserGuide/HowTo/DataManagement/metadata.html here]. | The official DIRAC documentation on the topic can be found [https://dirac.readthedocs.io/en/latest/UserGuide/HowTo/DataManagement/metadata.html here]. |
Revision as of 15:32, 21 April 2022
The DIRAC FileCatalog has two types of Metadata:
Metadata for files and for directories.
Metadata should always be indexed. Unfortunately DIRAC currently allows you to create unindexed metadata. To avoid this, the correct procedure to create metadata is:
- Through the CLI:
dirac-dms-filecatalog-cli for a file: create index: FC:/gridpp/user/d/daniela.bauer>meta index -f testfiles int Added metadata field testfiles of type int show will show you all the tags available for your VO (here:gridpp) FC:/gridpp/user/d/daniela.bauer>meta show FileMetaFields : {'testfiles': 'INT', 'experiment': 'VARCHAR(128)', 'JMMetaInt3': 'INT', 'JMMetaInt': 'INT'} DirectoryMetaFields : {'JMMetaInt2': 'INT'} attach metadata to files: FC:/gridpp/user/d/daniela.bauer>meta set test-man testfile 1 /gridpp/user/d/daniela.bauer/test-man {'testfile': '1'} FC:/gridpp/user/d/daniela.bauer>meta set test-qmul testfile 1 /gridpp/user/d/daniela.bauer/test-qmul {'testfile': '1'} find all files that are associated with a certain metadata tag: FC:/gridpp/user/d/daniela.bauer>find /gridpp testfiles=1 Query: {'testfiles': 1} /gridpp/user/d/daniela.bauer/test-man /gridpp/user/d/daniela.bauer/test-qmul
- Through the API:
The official DIRAC documentation on the topic can be found here.