forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.ALIEN
130 lines (79 loc) · 3.52 KB
/
README.ALIEN
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
=========================================================================
How to use the TGrid/TAlien/TAlienFile class V1.1 - [email protected]
=========================================================================
TGrid-Plugin: TAlien
====================
To connect to Alien you have to connect to a running API service of your
virtual organization.
Creating <gGrid> instance:
a) // connecting to an API service
TGrid::Connect("alien://pcapiserv01.cern.ch:9000","aliprod);
// connecting to an API service which is defined already by the
environment variables:
export alien_API_HOST=...
export alien_API_PORT=...
export alien_API_USER=...
TGrid::Connect("alien://");
// connect to an API service with an authentication token established
previously with gShellq.
b) TGrid::Connect("alien://",0,0,"t");
In case a) the authentication is private to the process, while case b)
shares the authentication(session) with the shell, which has established
the session previously. Notice that a) is not thread-safe, while b) is!
If you have executed TGrid::Connect(), the gGrid global variable
should be set != 0.
Some examples:
- change the working directory
gGrid->Cd("/alice/"); // => returns 1 for success, 0 for error
- get the working directory
printf("GRID Working is %d",gGrid->Pwd());
- list a directory
TGridResult* result = gGrid->Ls("/alice");
Int_t i=0;
while (result->GetFileName(i))
printf("File %s\n",result->GetFileName(i++));
TGridResult* result = gGrid->Ls("/alice");
Int_t i=0;
while (result->GetFileName(i))
printf("File %s\n",result->GetFileName(i++));
- get all file permissions - using the GetKey function
TGridResult* result = gGrid->Ls("/alice","-la");
while (result->GetFileName(i))\
printf("The permissions are %s\n",result->GetKey(i++,"permissions")
// => the defined keys for GetKey can be seen using result->Print();
- query files under a certain namespace tree
TGridResult* result = gGrid->Query("/alice/,"*.root");
You can execute any existing command via the Command interface:
TGridResult* result = gGrid->Command("ls -la /",0,2);
// '0' switches of the output of stdout and stderr to the terminal
// '2' selects the result stream to be returned as TGridResult* :
'0' returns stdout,
'1' returns stderr,
'2' returns the result structure
-> This command is equivalent to:
gGrid->Ls("/","-la");
You can print the stdout of the last command via:
gGrid->Stdout();
You can print the stderr of the last command via:
gGrid->Stderr();
To see the result structure of a command, you can just use the 'Print' function for the
TGridResult:
result->Print();
TFile-Plugin: TAlienFile
========================
Files stored in Alien can be opened with the catalogue LFN or a GUID.
To open a file by LFN use:
TFile* myfile = TFile::Open("alien:///alice/cern.ch/file.root");
or
TFile* myfile = TFile::Open("/alien/alice/cern.ch/file.root");
To open a file by GUID use:
TFile* myfile = TFile::Open("alien://<guid>");
To address a certain storage element add to the URL
"?se=ALICE::CERN::Castor";
f.e. TFile::Open("/alien/alice/cern.ch/file.root?se=ALICE::CERN::Castor");
To open a ZIP file in an archive, use:
TFile::Open("/alien7alice/cern.ch/archivefile.zip#file.root");
- this assumes, that archivefile.zip is an UNCOMPRESSED zip archive containing
'file.root'.
- remember, that archives need to have the suffix '.zip' to be understood as
such.