80 #include "gapi_job_operations.h"
100 if (!strlen(gurl->
GetHost())) {
137 Info(
"TAlien",
"%s => %s port: %d user: %s",gridurl,fHost.Data(),fPort,fUser.Data());
142 if (options && (options[0] ==
't')) {
143 fGc = GapiUI::MakeGapiUI(
kTRUE);
146 fGc = GapiUI::MakeGapiUI(
kFALSE);
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());
160 if (!Command(
"motd")) {
161 Error(
"TAlien",
"we have no valid connection ... I try to connect ...");
162 fGc->Connect(fHost, fPort, fUser, passwd);
165 fGc->Connect(fHost, fPort, fUser, passwd);
173 sprintf(cwd,
"%s",cwdp);
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());
203 Info(
"~TAlien",
"destructor called");
240 cout << command << endl;
244 TList* list =
dynamic_cast<TList*
>(alienResult);
257 while ((
object = iter->
Next()) != 0) {
258 TMap* map =
dynamic_cast<TMap*
>(object);
270 Error(
"Submit",
"error submitting job");
274 Info(
"Submit",
"your job was submitted with the ID = %s", jobID.
Data());
297 if (gjobarray->size() == 0) {
304 for (
UInt_t i = 0; i < gjobarray->size(); i++ ) {
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) {
326 if (gapi_kill(atoi(jobid.
Data())))
337 if (gapi_resubmit(atoi(jobid.
Data())))
349 if (fGc->Command(command)) {
353 for (
Int_t column = 0 ; column < (fGc->GetStreamColumns(stream)); column++) {
356 for (
Int_t row=0;
row < fGc->GetStreamRows(stream,column);
row++) {
365 fGc->DebugDumpStreams();
377 return Command(
"locatesites");
385 fGc->PrintCommandStdout();
394 fGc->PrintCommandStderr();
401 const char *conditions,
const char *options)
404 return Command(cmdline);
412 return Command(cmdline,
kTRUE);
420 for (
Int_t row = 0;
row < fGc->GetStreamRows(stream,column);
row++) {
431 return fGc->GetStreamFieldValue(stream,column,row);
438 return fGc->GetStreamFieldKey(stream,column,row);
445 return fGc->GetStreamColumns(stream);
456 return Command(cmdline, verbose);
472 const char*
result = (GetStreamFieldValue(kOUTPUT,0,0));
474 if (strlen(result) > 0) {
475 if (atoi(result) == 1) {
481 Error(
"Cd",
"Cannot change to directory %s\n",ldn);
482 if (!verbose) Stdout();
514 Error(
"pwd",
"Cannot get current working directory\n");
515 if (!verbose) Stdout();
524 if (strlen(options)) {
537 const char*
result = (GetStreamFieldValue(kOUTPUT,0,0));
539 if (strlen(result) > 0) {
540 if (atoi(result) > 0) {
546 Error(
"Mkdir",
"Cannot create directory %s\n",ldn);
547 if (!verbose) Stdout();
556 if (strlen(options)) {
569 const char*
result = (GetStreamFieldValue(kOUTPUT,0,0));
571 if (strlen(result) > 0) {
572 if (atoi(result) == 1) {
578 Error(
"Rmdir",
"Cannot remove directory %s\n",ldn);
605 const char*
result = (GetStreamFieldValue(kOUTPUT,0,0));
607 if (strlen(result) > 0) {
608 if (atoi(result) == 1) {
630 const char*
result = (GetStreamFieldValue(kOUTPUT,0,0));
632 if (strlen(result) > 0) {
633 if (atoi(result) == 1) {
639 Error(
"Rm",
"Cannot remove %s\n",lfn);
653 Error(
"OpenCollection",
654 "Trying to read a collection, but gGrid not initialized with AliEn");
662 Error(
"OpenCollection",
663 "Could not retrieve collection %s from the catalog", collectionfile);
698 Error(
"Type",
"Did not receive TGridResult from query %s", cmdline.
Data());
702 const char* typeStr = gridResult->
GetKey(0,
"type");
703 if (!typeStr || !typeStr[0]) {
704 Error(
"Type",
"Could not get type of %s", lfn);
711 if (strcmp(typeStr,
"file") == 0) {
713 }
else if (strcmp(typeStr,
"directory") == 0) {
715 }
else if (strcmp(typeStr,
"collection") == 0) {
718 Error(
"Type",
"Unknown type %s", typeStr);
747 if (!alienpackagedir) {
748 alienpackagedir =
"/alice/packages";
771 allplatform+=pplatform;
781 Info(
"ListPackages",
"Package: %-16s Version: %-20s Platform: [ %s ]",pname.
Data(),pversion.
Data(),allplatform.
Data());
const char * GetHost() const
const char * GetName() const
Returns name of object.
virtual Bool_t ResubmitById(TString jobid)
Resubmit a specific job.
ClassImp(TAlienJob) TGridJobStatus *TAlienJob jobID
Queries the job for its status and returns a TGridJobStatus object.
virtual Int_t Mkdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
Collectable string class.
This class represents a WWW compatible URL.
TString & ReplaceAll(const TString &s1, const TString &s2)
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)
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual const char * GetFileName(UInt_t) const
virtual CatalogType Type(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
returns the type of the given lfn
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection)...
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Iterator abstract base class.
TString Escape(const char *input)
Escape " by \".
const char * Data() const
const char * GetStreamFieldKey(UInt_t stream, UInt_t column, UInt_t row)
static TAlienCollection * OpenAlienCollection(TGridResult *queryresult, Option_t *option="")
Static method used to create an Alien event collection, by creating collection from a TGridResult Get...
virtual TGridJobStatusList * Ps(const char *options, Bool_t verbose=kTRUE)
Get job status list.
virtual TGridCollection * OpenCollection(const char *collectionfile, UInt_t maxentries=kTRUE)
Factory function for a TAlienCollection based on an XML file.
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...
std::map< std::string, std::string >::const_iterator iter
virtual const char * Pwd(Bool_t verbose=kFALSE)
void Shell()
Start an interactive AliEn shell.
virtual const char * Getenv(const char *env)
Get environment variable.
void Info(const char *location, const char *msgfmt,...)
virtual Bool_t Rmdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
virtual TGridCollection * OpenCollectionQuery(TGridResult *queryresult, Bool_t nogrouping=kFALSE)
Factory function fo a TAlienCollection based on a gGrid Query.
void Error(const char *location, const char *msgfmt,...)
virtual TGridResult * ListPackages(const char *alienpackagedir="/alice/packages")
List packages in the specified directory.
TString GetString() const
virtual ~TAlien()
do we need to delete fGc ? (rdm)
R__EXTERN TSystem * gSystem
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.
char * Form(const char *fmt,...)
virtual void Unsetenv(const char *name)
Unset environment variable.
virtual TGridJob * Submit(const char *jdl)
Submit a command to AliEn. Returns 0 in case of error.
virtual Bool_t Cd(const char *ldn="", Bool_t verbose=kFALSE)
virtual TGridResult * Ls(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
virtual const char * GetKey(UInt_t, const char *) const
virtual Bool_t Rm(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
virtual Bool_t KillById(TString jobid)
Kill a specific job.
virtual TGridResult * OpenDataset(const char *lfn, const char *options="")
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
const char * GetUser() const
virtual TGridResult * LocateSites()
UInt_t GetNColumns(UInt_t stream)
Mother of all ROOT objects.
const char * GetStreamFieldValue(UInt_t stream, UInt_t column, UInt_t row)
virtual TGridResult * GetCollection(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
virtual TGridResult * Query(const char *path, const char *pattern, const char *conditions="", const char *options="")
virtual void Add(TObject *obj)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual TObject * Next()=0
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
static void output(int code)
TGridResult * Command(const char *command, bool interactive=kFALSE, UInt_t stream=kOUTPUT)
Execute AliEn command. Returns 0 in case or error.
GAPI_JOBARRAY * gjobarray
virtual TGridJDL * GetJDLGenerator()
Create a Alien JDL.
TMap * GetColumn(UInt_t stream=0, UInt_t column=0)