Logo ROOT   6.10/09
Reference Guide
TAlien.cxx
Go to the documentation of this file.
1 // @(#)root/alien:$Id: db925cce3e3dc34e650f92e7e84655fb84ef04e9 $
2 // Author: Andreas Peters 5/5/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TAlien //
15 // //
16 // Class defining interface to TAlien GRID services. //
17 // //
18 // To force to connect to a running API Service, use //
19 // - TGrid::Connect("alien://<apihosturl>/","user"); //
20 // //
21 // If you want to use TGrid::Connect("alien://"); //
22 // you have to set the environment variables //
23 // export alien_API_HOST=<host> //
24 // export alien_API_PORT=<port> //
25 // export alien_API_USER=<user> //
26 // //
27 // //
28 // some examples: //
29 // -------------------------------------------------------------------- //
30 // connect in an initialized API environemnt (see above) //
31 // > TGrid::Connect("alien://"); //
32 // -> this is not thread safe //
33 // connect using an already established shell token: //
34 // > TGrid::Connect("alien://",0,0,"t"); //
35 // -> this is thread safe //
36 // -------------------------------------------------------------------- //
37 // change the working directory //
38 // > gGrid->Cd("/alice"); //=> returns 1 for success, 0 for error //
39 // //
40 // //
41 // -------------------------------------------------------------------- //
42 // get the working directory //
43 // > printf("Working Directory is %s\n",gGrid->Pwd()); //
44 // //
45 // //
46 // -------------------------------------------------------------------- //
47 // get a filename list of the working directory and print it //
48 // > TGridResult* result = gGrid->Ls("/alice"); //
49 // > Int_t i=0; //
50 // > while (result->GetFileName(i))\ //
51 // printf("File %s\n",result->GetFileName(i++)); //
52 // -------------------------------------------------------------------- //
53 // //
54 // get all file permissions //
55 // > TGridResult* result = gGrid->Ls("/alice","-la"); //
56 // > while (result->GetFileName(i))\ //
57 // printf("The permissions are %s\n",result->GetKey(i++,"permissions") //
58 // //
59 // => the defined keys for GetKey can be seen using result->Print(); //
60 // -------------------------------------------------------------------- //
61 //////////////////////////////////////////////////////////////////////////
62 
63 #include <stdlib.h>
64 #include "TAlien.h"
65 #include "TUrl.h"
66 #include "Riostream.h"
67 #include "TString.h"
68 #include "TObjString.h"
69 #include "TObjArray.h"
70 #include "TMap.h"
71 #include "TSystem.h"
72 #include "TAlienJDL.h"
73 #include "TAlienResult.h"
74 #include "TAlienJob.h"
75 #include "TAlienCollection.h"
76 #include "TAlienMasterJobStatus.h"
77 #include "TAlienJobStatusList.h"
78 #include "TAlienJobStatus.h"
79 #include "gapiUI.h"
80 #include "gapi_job_operations.h"
81 
82 using namespace std;
83 
84 
85 
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 
90 TAlien::TAlien(const char *gridurl, const char *uid, const char * passwd,
91  const char *options)
92 {
93  gSystem->Unsetenv("GCLIENT_EXTRA_ARG");
94 
95  // Connect to the AliEn grid.
96  TUrl *gurl = new TUrl(gridurl);
97 
98  fGridUrl = gridurl;
99  fGrid = "alien";
100  if (!strlen(gurl->GetHost())) {
101  if (gSystem->Getenv("alien_API_HOST"))
102  fHost = gSystem->Getenv("alien_API_HOST");
103  else
104  fHost = "";
105  } else {
106  fHost = gurl->GetHost();
107  }
108 
109  if (gurl->GetPort()<=0) {
110  if (gSystem->Getenv("alien_API_PORT"))
111  fPort = atoi(gSystem->Getenv("alien_API_PORT"));
112  else
113  fPort = 0;
114  } else {
115  fPort = gurl->GetPort();
116  }
117 
118  if (!uid[0]) {
119  if (gSystem->Getenv("alien_API_USER")) {
120  fUser = gSystem->Getenv("alien_API_USER");
121  } else {
122  if (gSystem->Getenv("LOGNAME")) {
123  // we try the LOGNAME env
124  fUser = gSystem->Getenv("LOGNAME");
125  } else {
126  // we set the USER env
127  fUser = gSystem->Getenv("USER");
128  }
129  }
130  } else {
131  fUser = uid;
132  }
133 
134  fOptions = options;
135 
136  if (gDebug > 1)
137  Info("TAlien", "%s => %s port: %d user: %s",gridurl,fHost.Data(),fPort,fUser.Data());
138 
139  Bool_t fstoken;
140  fstoken = kFALSE;
141 
142  if (options && (options[0] == 't')) {
143  fGc = GapiUI::MakeGapiUI(kTRUE);
144  fstoken = kTRUE;
145  } else {
146  fGc = GapiUI::MakeGapiUI(kFALSE);
147  }
148 
149  if (!fGc) {
150  Error("TAlien", "could not connect to a alien service at:");
151  Error("TAlien", "host: %s port: %d user: %s", fHost.Data(), fPort, fUser.Data());
152  MakeZombie();
153  } else {
154  if (passwd) {
155  if (!passwd[0]) {
156  passwd = 0;
157  }
158  }
159  if (fstoken) {
160  if (!Command("motd")) {
161  Error("TAlien", "we have no valid connection ... I try to connect ...");
162  fGc->Connect(fHost, fPort, fUser, passwd);
163  }
164  } else {
165  fGc->Connect(fHost, fPort, fUser, passwd);
166  }
167 
168  char cwd[1024];
169  const char* cwdp=0;
170  cwdp=Pwd();
171  fHome=TString("/");
172  if (cwdp) {
173  sprintf(cwd,"%s",cwdp);
174  if (Cd("")) {
175  cwdp=Pwd();
176  if (cwdp) {
177  fHome = TString(cwdp);
178  }
179  }
180  }
181 
182  if (!fGc->Connected()) {
183  Error("TAlien", "could not authenticate at:");
184  Error("TAlien", "host: %s port: %d user: %s",fHost.Data(),fPort,fUser.Data());
185  MakeZombie();
186  } else {
187  gGrid = this;
188  Command("motd");
189  Stdout();
190  }
191  // export this UI to all POSIX functions like gapi_dir_xxx gapi_job_xxx
192  fGc->SetGapiUI(fGc);
193  }
194  delete gurl;
195 }
196 
197 ////////////////////////////////////////////////////////////////////////////////
198 /// do we need to delete fGc ? (rdm)
199 
201 {
202  if (gDebug > 1)
203  Info("~TAlien", "destructor called");
204 }
205 
206 ////////////////////////////////////////////////////////////////////////////////
207 /// Start an interactive AliEn shell.
208 
210 {
211  fGc->Shell();
212 }
213 
214 ////////////////////////////////////////////////////////////////////////////////
215 /// Escape \" by \\\".
216 
217 TString TAlien::Escape(const char *input)
218 {
219  if (!input)
220  return TString();
221 
222  TString output(input);
223  output.ReplaceAll("\"", "\\\"");
224 
225  return output;
226 }
227 
228 ////////////////////////////////////////////////////////////////////////////////
229 /// Submit a command to AliEn. Returns 0 in case of error.
230 
231 TGridJob *TAlien::Submit(const char *jdl)
232 {
233  if (!jdl)
234  return 0;
235 
236  TString command("submit =< ");
237  //command += Escape(jdl);
238  command += jdl;
239 
240  cout << command << endl;
241 
242  TGridResult* result = Command(command,kFALSE,kOUTPUT);
243  TAlienResult* alienResult = dynamic_cast<TAlienResult*>(result);
244  TList* list = dynamic_cast<TList*>(alienResult);
245  if (!list) {
246  if (result)
247  delete result;
248  return 0;
249  }
250 
251  alienResult->DumpResult();
252 
253  TString jobID = "0";
254 
255  TIterator* iter = list->MakeIterator();
256  TObject* object = 0;
257  while ((object = iter->Next()) != 0) {
258  TMap* map = dynamic_cast<TMap*>(object);
259 
260  TObject* jobIDObject = map->GetValue("jobId");
261  TObjString* jobIDStr = dynamic_cast<TObjString*>(jobIDObject);
262  if (jobIDStr) {
263  jobID = jobIDStr->GetString();
264  }
265  }
266  delete iter;
267  delete result;
268 
269  if (jobID == "0") {
270  Error("Submit", "error submitting job");
271  return 0;
272  }
273 
274  Info("Submit", "your job was submitted with the ID = %s", jobID.Data());
275 
276  return dynamic_cast<TGridJob*>(new TAlienJob(jobID));
277 }
278 
279 ////////////////////////////////////////////////////////////////////////////////
280 /// Create a Alien JDL.
281 
283 {
284  return new TAlienJDL();
285 }
286 
287 ////////////////////////////////////////////////////////////////////////////////
288 /// Get job status list.
289 
290 TGridJobStatusList *TAlien::Ps(const char* /*options*/, Bool_t verbose)
291 {
292  GAPI_JOBARRAY* gjobarray = gapi_queryjobs("-", gGrid->GetUser(), "-", "-", "-",
293  "-", "-", "-", "-");
294  if (!gjobarray)
295  return 0;
296 
297  if (gjobarray->size() == 0) {
298  delete gjobarray;
299  return 0;
300  }
301 
302  TGridJobStatusList* joblist = new TAlienJobStatusList();
303 
304  for (UInt_t i = 0; i < gjobarray->size(); i++ ) {
305  TMap* statusmap = new TMap();
306  GAPI_JOB gjob = gjobarray->at(i);
307  std::map<std::string, std::string>::const_iterator iter = gjob.gapi_jobmap.begin();
308  for (; iter != gjob.gapi_jobmap.end(); ++iter) {
309  // printf("Adding %s = %s\n", iter->first.c_str(),iter->second.c_str());
310  statusmap->Add(new TObjString(iter->first.c_str()), new TObjString(iter->second.c_str()));
311  }
312  TGridJobStatus *status = (TGridJobStatus*)new TAlienJobStatus(statusmap);
313  joblist->Add((TGridJobStatus*)status);
314  if (verbose) {
315  }
316  }
317  delete gjobarray;
318  return joblist;
319 }
320 
321 ////////////////////////////////////////////////////////////////////////////////
322 /// Kill a specific job.
323 
324 Bool_t TAlien::KillById(TString jobid)
325 {
326  if (gapi_kill(atoi(jobid.Data())))
327  return kFALSE;
328  else
329  return kTRUE;
330 }
331 
332 ////////////////////////////////////////////////////////////////////////////////
333 /// Resubmit a specific job.
334 
336 {
337  if (gapi_resubmit(atoi(jobid.Data())))
338  return kFALSE;
339  else
340  return kTRUE;
341 }
342 
343 ////////////////////////////////////////////////////////////////////////////////
344 /// Execute AliEn command. Returns 0 in case or error.
345 
346 TGridResult *TAlien::Command(const char *command, bool interactive, UInt_t stream)
347 {
348  if (fGc) {
349  if (fGc->Command(command)) {
350  // command successful
351  TAlienResult* gresult = new TAlienResult();
352 
353  for (Int_t column = 0 ; column < (fGc->GetStreamColumns(stream)); column++) {
354  TMap *gmap = new TMap();
355  gmap->SetOwner(kTRUE);
356  for (Int_t row=0; row < fGc->GetStreamRows(stream,column); row++) {
357  gmap->Add((TObject*)(new TObjString(fGc->GetStreamFieldKey(stream,column,row))),
358  (TObject*)(new TObjString(fGc->GetStreamFieldValue(stream,column,row))));
359  }
360  gresult->Add(gmap);
361  }
362 
363  if (interactive) {
364  // write also stdout/stderr to the screen
365  fGc->DebugDumpStreams();
366  }
367  return gresult;
368  }
369  }
370  return 0;
371 }
372 
373 ////////////////////////////////////////////////////////////////////////////////
374 
376 {
377  return Command("locatesites");
378 }
379 
380 ////////////////////////////////////////////////////////////////////////////////
381 
383 {
384  if (fGc) {
385  fGc->PrintCommandStdout();
386  }
387 }
388 
389 ////////////////////////////////////////////////////////////////////////////////
390 
392 {
393  if (fGc) {
394  fGc->PrintCommandStderr();
395  }
396 }
397 
398 ////////////////////////////////////////////////////////////////////////////////
399 
400 TGridResult *TAlien::Query(const char *path, const char *pattern,
401  const char *conditions, const char *options)
402 {
403  TString cmdline = TString("find -z ") + TString(options) + TString(" ") + TString(path) + TString(" ") + TString(pattern) + TString(" ") + TString(conditions);
404  return Command(cmdline);
405 }
406 
407 ////////////////////////////////////////////////////////////////////////////////
408 
409 TGridResult *TAlien::OpenDataset(const char *lfn, const char *options)
410 {
411  TString cmdline = TString("getdataset") + TString(" ") + TString(options) + TString(" ") + TString(lfn);
412  return Command(cmdline, kTRUE);
413 }
414 
415 ////////////////////////////////////////////////////////////////////////////////
416 
418 {
419  TMap *gmap = new TMap();
420  for (Int_t row = 0; row < fGc->GetStreamRows(stream,column); row++) {
421  gmap->Add((TObject*)(new TObjString(fGc->GetStreamFieldKey(stream,column,row))),
422  (TObject*)(new TObjString(fGc->GetStreamFieldValue(stream,column,row))));
423  }
424  return gmap;
425 }
426 
427 ////////////////////////////////////////////////////////////////////////////////
428 
429 const char *TAlien::GetStreamFieldValue(UInt_t stream, UInt_t column, UInt_t row)
430 {
431  return fGc->GetStreamFieldValue(stream,column,row);
432 }
433 
434 ////////////////////////////////////////////////////////////////////////////////
435 
436 const char *TAlien::GetStreamFieldKey(UInt_t stream, UInt_t column, UInt_t row)
437 {
438  return fGc->GetStreamFieldKey(stream,column,row);
439 }
440 
441 ////////////////////////////////////////////////////////////////////////////////
442 
444 {
445  return fGc->GetStreamColumns(stream);
446 }
447 
448 //--- Catalogue Interface
449 
450 ////////////////////////////////////////////////////////////////////////////////
451 
452 TGridResult *TAlien::Ls(const char* ldn, Option_t* options, Bool_t verbose)
453 {
454  TString cmdline = TString("ls") + TString(" ") + TString(options) + TString(" ") + TString(ldn);
455 
456  return Command(cmdline, verbose);
457 }
458 
459 ////////////////////////////////////////////////////////////////////////////////
460 
461 Bool_t TAlien::Cd(const char* ldn, Bool_t verbose)
462 {
463  TString cmdline = TString("cd") + TString(" ") + TString(ldn);
464 
465  Command(cmdline, kFALSE);
466 
467  if (verbose) {
468  Stdout();
469  Stderr();
470  }
471 
472  const char* result = (GetStreamFieldValue(kOUTPUT,0,0));
473  if (result) {
474  if (strlen(result) > 0) {
475  if (atoi(result) == 1) {
476  return kTRUE;
477  }
478  }
479  }
480 
481  Error("Cd","Cannot change to directory %s\n",ldn);
482  if (!verbose) Stdout();
483  return kFALSE;
484 }
485 
486 ////////////////////////////////////////////////////////////////////////////////
487 
489 {
490  TString cmdline = TString("pwd");
491 
492  TGridResult* result = Command(cmdline, kFALSE, kENVIR);
493 
494  if (verbose) {
495  Stdout();
496  Stderr();
497  }
498 
499  if (result) {
500  TMap* resultmap = ((TMap*)result->At(0));
501  if (resultmap) {
502  TObjString* pwd = (TObjString*)resultmap->GetValue("pwd");
503  if (pwd) {
504  fPwd = pwd->GetName();
505  delete resultmap;
506  return fPwd;
507  } else {
508  delete resultmap;
509  return 0;
510  }
511  }
512  }
513 
514  Error("pwd","Cannot get current working directory\n");
515  if (!verbose) Stdout();
516  return 0;
517 }
518 
519 ////////////////////////////////////////////////////////////////////////////////
520 
521 Int_t TAlien::Mkdir(const char* ldn, Option_t* options, Bool_t verbose)
522 {
523  TString cmdline = TString("mkdir");
524  if (strlen(options)) {
525  cmdline += (TString(" ") + TString(options));
526  }
527 
528  cmdline += (TString(" -s ") + TString(ldn));
529 
530  Command(cmdline, kFALSE);
531 
532  if (verbose) {
533  Stdout();
534  Stderr();
535  }
536 
537  const char* result = (GetStreamFieldValue(kOUTPUT,0,0));
538  if (result) {
539  if (strlen(result) > 0) {
540  if (atoi(result) > 0) {
541  return atoi(result);
542  }
543  }
544  }
545 
546  Error("Mkdir","Cannot create directory %s\n",ldn);
547  if (!verbose) Stdout();
548  return 0;
549 }
550 
551 ////////////////////////////////////////////////////////////////////////////////
552 
553 Bool_t TAlien::Rmdir(const char* ldn, Option_t* options, Bool_t verbose)
554 {
555  TString cmdline = TString("rmdir");
556  if (strlen(options)) {
557  cmdline += (TString(" ") + TString(options));
558  } else {
559  cmdline += (TString(" -s ") + TString(ldn));
560  }
561 
562  Command(cmdline, kFALSE);
563 
564  if (verbose) {
565  Stdout();
566  Stderr();
567  }
568 
569  const char* result = (GetStreamFieldValue(kOUTPUT,0,0));
570  if (result) {
571  if (strlen(result) > 0) {
572  if (atoi(result) == 1) {
573  return kTRUE;
574  }
575  }
576  }
577 
578  Error("Rmdir","Cannot remove directory %s\n",ldn);
579  return kTRUE;
580 }
581 
582 ////////////////////////////////////////////////////////////////////////////////
583 
584 Bool_t TAlien::Register(const char* lfn, const char* turl, Long_t size, const char* se, const char* guid, Bool_t verbose)
585 {
586  TString cmdline = TString("register") + TString(" ") + TString(lfn) + TString(" ") + TString(turl);
587  if (se) {
588  cmdline += TString(" ");
589  cmdline += size;
590  cmdline += TString(" ");
591  cmdline += TString(se);
592  if (guid) {
593  cmdline += TString(" ");
594  cmdline += TString(guid);
595  }
596  }
597 
598  Command(cmdline, kFALSE);
599 
600  if (verbose) {
601  Stdout();
602  Stderr();
603  }
604 
605  const char* result = (GetStreamFieldValue(kOUTPUT,0,0));
606  if (result) {
607  if (strlen(result) > 0) {
608  if (atoi(result) == 1) {
609  return kTRUE;
610  }
611  }
612  }
613 
614  return kFALSE;
615 }
616 
617 ////////////////////////////////////////////////////////////////////////////////
618 
619 Bool_t TAlien::Rm(const char* lfn, Option_t* options, Bool_t verbose)
620 {
621  TString cmdline = TString("rm") + TString(" -s ") + TString(options) + TString(" ") + TString(lfn);
622 
623  Command(cmdline, kFALSE);
624 
625  if (verbose) {
626  Stdout();
627  Stderr();
628  }
629 
630  const char* result = (GetStreamFieldValue(kOUTPUT,0,0));
631  if (result) {
632  if (strlen(result) > 0) {
633  if (atoi(result) == 1) {
634  return kTRUE;
635  }
636  }
637  }
638 
639  Error("Rm","Cannot remove %s\n",lfn);
640  return kFALSE;
641 }
642 
643 ////////////////////////////////////////////////////////////////////////////////
644 /// Factory function for a TAlienCollection based on an XML file.
645 
646 TGridCollection *TAlien::OpenCollection(const char *collectionfile,
647  UInt_t maxentries)
648 {
649  TString path(collectionfile);
650  if (path.BeginsWith("alien://", TString::kIgnoreCase)) {
651  TAlien* alien = dynamic_cast<TAlien*> (gGrid);
652  if (!alien) {
653  Error("OpenCollection",
654  "Trying to read a collection, but gGrid not initialized with AliEn");
655  return 0;
656  }
657  TString lfn = path(strlen("alien://"), path.Length());
658  if (alien->Type(lfn) == kCollection) {
659  // it is a collection
660  TGridResult* gridResult = alien->GetCollection(lfn);
661  if (!gridResult) {
662  Error("OpenCollection",
663  "Could not retrieve collection %s from the catalog", collectionfile);
664  return 0;
665  }
666 
667  return TAlienCollection::OpenAlienCollection(gridResult);
668  }
669  }
670 
671  return TAlienCollection::Open(collectionfile, maxentries);
672 }
673 
674 ////////////////////////////////////////////////////////////////////////////////
675 /// Factory function fo a TAlienCollection based on a gGrid Query.
676 
678  Bool_t nogrouping)
679 {
680  return (TGridCollection*)TAlienCollection::OpenQuery(queryresult, nogrouping);
681 }
682 
683 ////////////////////////////////////////////////////////////////////////////////
684 /// returns the type of the given lfn
685 
687 {
688  TString cmdline = TString("type -z") + TString(" ") + TString(option) + TString(" ") + TString(lfn);
689 
690  TGridResult* gridResult = Command(cmdline, kFALSE);
691 
692  if (verbose) {
693  Stdout();
694  Stderr();
695  }
696 
697  if (!gridResult) {
698  Error("Type", "Did not receive TGridResult from query %s", cmdline.Data());
699  return kFailed;
700  }
701 
702  const char* typeStr = gridResult->GetKey(0, "type");
703  if (!typeStr || !typeStr[0]) {
704  Error("Type", "Could not get type of %s", lfn);
705  delete gridResult;
706  return kFailed;
707  }
708 
709  TAlien::CatalogType type = kFailed;
710 
711  if (strcmp(typeStr, "file") == 0) {
712  type = kFile;
713  } else if (strcmp(typeStr, "directory") == 0) {
714  type = kDirectory;
715  } else if (strcmp(typeStr, "collection") == 0) {
716  type = kCollection;
717  } else
718  Error("Type", "Unknown type %s", typeStr);
719 
720  delete gridResult;
721 
722  return type;
723 }
724 
725 ////////////////////////////////////////////////////////////////////////////////
726 ///
727 
729 {
730  TString cmdline = TString("listFilesFromCollection -z -v") + TString(" ") + TString(option) + TString(" ") + TString(lfn);
731 
732  TGridResult* gridResult = Command(cmdline, kFALSE);
733 
734  if (verbose) {
735  Stdout();
736  Stderr();
737  }
738 
739  return gridResult;
740 }
741 
742 ////////////////////////////////////////////////////////////////////////////////
743 /// List packages in the specified directory.
744 
745 TGridResult* TAlien::ListPackages(const char* alienpackagedir)
746 {
747  if (!alienpackagedir) {
748  alienpackagedir = "/alice/packages";
749  }
750 
752 
753  TGridResult* result = Ls(alienpackagedir);
754  if (result) {
755  Int_t i=0;
756  while ( result->GetFileName(i)) {
757  TString pname=result->GetFileName(i);
758  TGridResult* version = Ls(Form("%s/%s",alienpackagedir,pname.Data()));
759  if (version) {
760  Int_t j=0;
761  while (version->GetFileName(j)) {
762  TString pversion=version->GetFileName(j);
763  if ((pversion.Contains("post_"))) {
764  } else {
765  TGridResult* platform = Ls(Form("%s/%s/%s",alienpackagedir,pname.Data(),pversion.Data()));
766  if (platform) {
767  Int_t k=0;
768  TString allplatform="";
769  while (platform->GetFileName(k)) {
770  TString pplatform=platform->GetFileName(k);
771  allplatform+=pplatform;
772  allplatform+=" ";
773  TMap* grmap = new TMap();
774  grmap->Add((TObject*) new TObjString("name"),
775  (TObject*) new TObjString(pplatform.Data()));
776  grmap->Add((TObject*) new TObjString("path"),
777  new TObjString( Form ( "%s/%s/%s/%s" , alienpackagedir,pname.Data(),pversion.Data(),pplatform.Data())));
778  gr->Add(grmap);
779  k++;
780  }
781  Info("ListPackages","Package: %-16s Version: %-20s Platform: [ %s ]",pname.Data(),pversion.Data(),allplatform.Data());
782  delete platform;
783  }
784  }
785  j++;
786  }
787  delete version;
788  }
789  i++;
790  }
791  delete result;
792  }
793  return gr;
794 }
virtual Bool_t ResubmitById(TString jobid)
Resubmit a specific job.
Definition: TAlien.cxx:335
virtual const char * GetKey(UInt_t, const char *) const
Definition: TGridResult.h:45
virtual Int_t Mkdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:521
Collectable string class.
Definition: TObjString.h:28
CatalogType
Definition: TAlien.h:38
void Stderr()
Definition: TAlien.cxx:391
const char Option_t
Definition: RtypesCore.h:62
R__EXTERN TGrid * gGrid
Definition: TGrid.h:129
This class represents a WWW compatible URL.
Definition: TUrl.h:35
virtual Bool_t Register(const char *lfn, const char *turl, Long_t size=-1, const char *se=0, const char *guid=0, Bool_t verbose=kFALSE)
Definition: TAlien.cxx:584
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual CatalogType Type(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
returns the type of the given lfn
Definition: TAlien.cxx:686
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection)...
Definition: TMap.cxx:53
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Definition: TAlien.h:34
STL namespace.
Iterator abstract base class.
Definition: TIterator.h:30
TString Escape(const char *input)
Escape " by \".
Definition: TAlien.cxx:217
const char * GetStreamFieldKey(UInt_t stream, UInt_t column, UInt_t row)
Definition: TAlien.cxx:436
static TAlienCollection * OpenAlienCollection(TGridResult *queryresult, Option_t *option="")
Static method used to create an Alien event collection, by creating collection from a TGridResult Get...
const char * GetHost() const
Definition: TUrl.h:70
virtual TGridJobStatusList * Ps(const char *options, Bool_t verbose=kTRUE)
Get job status list.
Definition: TAlien.cxx:290
virtual TGridCollection * OpenCollection(const char *collectionfile, UInt_t maxentries=kTRUE)
Factory function for a TAlienCollection based on an XML file.
Definition: TAlien.cxx:646
static TGridCollection * Open(const char *collectionurl, UInt_t maxentries=1000000)
Static method used to create an Alien event collection, by reading an XML collection from the specifi...
virtual const char * Pwd(Bool_t verbose=kFALSE)
Definition: TAlien.cxx:488
void Shell()
Start an interactive AliEn shell.
Definition: TAlien.cxx:209
virtual const char * Getenv(const char *env)
Get environment variable.
Definition: TSystem.cxx:1634
void Info(const char *location, const char *msgfmt,...)
virtual Bool_t Rmdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:553
virtual TGridCollection * OpenCollectionQuery(TGridResult *queryresult, Bool_t nogrouping=kFALSE)
Factory function fo a TAlienCollection based on a gGrid Query.
Definition: TAlien.cxx:677
void Error(const char *location, const char *msgfmt,...)
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Definition: TList.cxx:608
A doubly linked list.
Definition: TList.h:43
const char * GetName() const
Returns name of object.
Definition: TObjString.h:39
const TString & GetString() const
Definition: TObjString.h:47
virtual TGridResult * ListPackages(const char *alienpackagedir="/alice/packages")
List packages in the specified directory.
Definition: TAlien.cxx:745
virtual ~TAlien()
do we need to delete fGc ? (rdm)
Definition: TAlien.cxx:200
R__EXTERN TSystem * gSystem
Definition: TSystem.h:539
static TGridCollection * OpenQuery(TGridResult *queryresult, Bool_t nogrouping=kFALSE)
Static method used to create an Alien event collection, by creating collection from a TGridResult Que...
virtual void DumpResult()
Dump result set.
unsigned int UInt_t
Definition: RtypesCore.h:42
bool verbose
char * Form(const char *fmt,...)
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:315
virtual void Unsetenv(const char *name)
Unset environment variable.
Definition: TSystem.cxx:1626
TGraphErrors * gr
Definition: legend1.C:25
virtual TGridJob * Submit(const char *jdl)
Submit a command to AliEn. Returns 0 in case of error.
Definition: TAlien.cxx:231
const Bool_t kFALSE
Definition: RtypesCore.h:92
virtual Bool_t Cd(const char *ldn="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:461
long Long_t
Definition: RtypesCore.h:50
virtual TGridResult * Ls(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:452
virtual Bool_t Rm(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:619
#define ClassImp(name)
Definition: Rtypes.h:336
virtual Bool_t KillById(TString jobid)
Kill a specific job.
Definition: TAlien.cxx:324
virtual TGridResult * OpenDataset(const char *lfn, const char *options="")
Definition: TAlien.cxx:409
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
int type
Definition: TGX11.cxx:120
virtual TGridResult * LocateSites()
Definition: TAlien.cxx:375
UInt_t GetNColumns(UInt_t stream)
Definition: TAlien.cxx:443
Int_t GetPort() const
Definition: TUrl.h:81
Mother of all ROOT objects.
Definition: TObject.h:37
const char * GetStreamFieldValue(UInt_t stream, UInt_t column, UInt_t row)
Definition: TAlien.cxx:429
virtual TGridResult * GetCollection(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:728
virtual TGridResult * Query(const char *path, const char *pattern, const char *conditions="", const char *options="")
Definition: TAlien.cxx:400
virtual void Add(TObject *obj)
Definition: TList.h:77
virtual TObject * Next()=0
virtual const char * GetFileName(UInt_t) const
Definition: TGridResult.h:37
void Stdout()
Definition: TAlien.cxx:382
R__EXTERN Int_t gDebug
Definition: Rtypes.h:83
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Definition: TMap.cxx:235
double result[121]
const char * GetUser() const
Definition: TGrid.h:63
TGridResult * Command(const char *command, bool interactive=kFALSE, UInt_t stream=kOUTPUT)
Execute AliEn command. Returns 0 in case or error.
Definition: TAlien.cxx:346
const Bool_t kTRUE
Definition: RtypesCore.h:91
virtual TGridJDL * GetJDLGenerator()
Create a Alien JDL.
Definition: TAlien.cxx:282
TMap * GetColumn(UInt_t stream=0, UInt_t column=0)
Definition: TAlien.cxx:417