nordugrid
- class pilot.user.atlas.nordugrid.XMLDictionary(rootname='outfiles')[source]
This is a helper class that is used to create the dictionary which is converted to the special XML files for Nordugrid pilots. Example dictionary:
- dictionary = { “outfiles”: [ { “file”: { “surl”: “some_surl”, “size”: “123”, “ad32”: “aaaaaaa”,
“guid”: “ababa22”, “lfn”: “some_lfn”, “dataset”: “some_dataset”, “date”: “11/11/11” } },
{}, {}, ..
]
}
- Usage:
xmldic = XMLDictionary() xmldic.add_to_list({“surl”: “some_surl1”, “size”: “123”, “ad32”: “aaaaaaa”, “guid”: “ababa22”, “lfn”: “some_lfn”,
“dataset”: “some_dataset”, “date”: “11/11/11”})
dictionary = xmldic.get_dictionary()
- __dict__ = mappingproxy({'__module__': 'pilot.user.atlas.nordugrid', '__doc__': '\n This is a helper class that is used to create the dictionary which is converted to the special XML files for\n Nordugrid pilots.\n Example dictionary:\n dictionary = { "outfiles": [ { "file": { "surl": "some_surl", "size": "123", "ad32": "aaaaaaa",\n "guid": "ababa22", "lfn": "some_lfn", "dataset": "some_dataset",\n "date": "11/11/11" } },\n {}, {}, ..\n ]\n }\n\n Usage:\n xmldic = XMLDictionary()\n xmldic.add_to_list({"surl": "some_surl1", "size": "123", "ad32": "aaaaaaa", "guid": "ababa22", "lfn": "some_lfn",\n "dataset": "some_dataset", "date": "11/11/11"})\n dictionary = xmldic.get_dictionary()\n ', '_dictionary': None, '__init__': <function XMLDictionary.__init__>, 'add_to_list': <function XMLDictionary.add_to_list>, 'get_dictionary': <function XMLDictionary.get_dictionary>, '__dict__': <attribute '__dict__' of 'XMLDictionary' objects>, '__weakref__': <attribute '__weakref__' of 'XMLDictionary' objects>, '__annotations__': {}})
- __init__(rootname='outfiles')[source]
Standard init function. :param rootname: name of the root key. There is only one root key in the Nordugrid XML file (‘outfiles’).
- __module__ = 'pilot.user.atlas.nordugrid'
- __weakref__
list of weak references to the object (if defined)
- _dictionary = None
- add_to_list(dictionary, rootname='outfiles', itemname='file')[source]
Add dictionary to itemname key. See example in class header. :param dictionary: dictionary to add to itemname key. :param rootname: name of the root key. There is only one root key in the Nordugrid XML file (‘outfiles’). :param itemname: name of the item key. In the Nordugrid XML it should be called ‘file’. :return:
- pilot.user.atlas.nordugrid.convert_to_prettyprint(xmlstr)[source]
Convert XML to pretty print for older python versions (< 2.7). :param xmlstr: input XML string :return: XML string (pretty printed)
- pilot.user.atlas.nordugrid.convert_to_xml(dictionary)[source]
Convert a dictionary to XML. The dictionary is expected to follow the Nordugrid format. See the XMLDictionary helper class.
Example of XML (OutputFiles.xml):
<?xml version=”1.0” ?> <outfiles> <file>
<ad32>aaaaaaa</ad32> <surl>some_surl1</surl> <lfn>some_lfn</lfn> <dataset>some_dataset</dataset> <date>11/11/11</date> <guid>ababa22</guid> <size>123</size>
</file> </outfiles>
- Parameters:
dictionary – dictionary created with XMLDictionary.
- Returns:
xml (pretty printed for python >= 2.7 - for older python, use the convert_to_prettyprint() function).