CoEPP RC
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
tier3:faq:accessing_xrootd_storage_using_pyxrootd [2014/03/24 14:55]
antonio
tier3:faq:accessing_xrootd_storage_using_pyxrootd [2014/03/24 15:22]
antonio
Line 40: Line 40:
 >>>​ from XRootD import client >>>​ from XRootD import client
 >>>​ with client.File() as f: >>>​ with client.File() as f:
-...      ​status ​= f.open('​root://​xrdmelsr.mel.coepp.org.au//​coepp/​atlas/​cloud/​antonio/​clare',​OpenFlags.NEW) +...     b=f.open('​root://​xrdmelsr.mel.coepp.org.au//​coepp/​atlas/​cloud/​antonio/​cath',​OpenFlags.NEW, AccessMode.OR
-...      ​status = f.write('​green\neggs\nand\nham\n'​) +...     ​f.write('​green\neggs\nand\nham\n'​) 
-...      data = f.readlines() +...     ​data = f.readlines() 
-...      print data +...     ​print data 
-...      print data[0] ​+...     ​print data[0]
 ...  ... 
 ['​green\n',​ '​eggs\n',​ '​and\n',​ '​ham\n'​] ['​green\n',​ '​eggs\n',​ '​and\n',​ '​ham\n'​]
 green green
 </​code>​ </​code>​
 +
 +Pay close attention to the attributes passed in as an argument to the file creation. OpenFlags.NEW ensures that a new file is opened only if it does not already exist. AccessMode.OR makes the file world readable. This is important if the file exists in an area which can be accessed via an alternative method to xrootd. In the example above, the file is written in the disk server that is also accessible from cxin01/02 machines as /​data/​antonio. This example writes a file named "​cath"​ at /​coepp/​atlas/​cloud/​antonio/​cath in the CoEPP xrootd namespace, which is equivalent to /​data/​antonio/​cath in cxin01. However the file although written in user antonio'​s directory "​antonio"​ will not be readable unless the AccessMode is set to world readable.
  
tier3/faq/accessing_xrootd_storage_using_pyxrootd.txt · Last modified: 2014/03/24 18:20 by antonio
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki