79#include "gapi_job_operations.h"
141 if (options && (options[0] ==
't')) {
149 Error(
"TAlien",
"could not connect to a alien service at:");
160 Error(
"TAlien",
"we have no valid connection ... I try to connect ...");
172 sprintf(cwd,
"%s",cwdp);
181 if (!
fGc->Connected()) {
182 Error(
"TAlien",
"could not authenticate at:");
202 Info(
"~TAlien",
"destructor called");
222 output.ReplaceAll(
"\"",
"\\\"");
239 cout << command << endl;
243 TList* list =
dynamic_cast<TList*
>(alienResult);
256 while ((
object = iter->
Next()) != 0) {
269 Error(
"Submit",
"error submitting job");
273 Info(
"Submit",
"your job was submitted with the ID = %s", jobID.
Data());
291 GAPI_JOBARRAY* gjobarray = gapi_queryjobs(
"-",
gGrid->
GetUser(),
"-",
"-",
"-",
296 if (gjobarray->size() == 0) {
303 for (
UInt_t i = 0; i < gjobarray->size(); i++ ) {
305 GAPI_JOB gjob = gjobarray->at(i);
306 std::map<std::string, std::string>::const_iterator iter = gjob.gapi_jobmap.begin();
307 for (; iter != gjob.gapi_jobmap.end(); ++iter) {
325 if (gapi_kill(atoi(jobid.
Data())))
336 if (gapi_resubmit(atoi(jobid.
Data())))
348 if (
fGc->Command(command)) {
352 for (
Int_t column = 0 ; column < (
fGc->GetStreamColumns(stream)); column++) {
355 for (
Int_t row=0; row <
fGc->GetStreamRows(stream,column); row++) {
364 fGc->DebugDumpStreams();
384 fGc->PrintCommandStdout();
393 fGc->PrintCommandStderr();
400 const char *conditions,
const char *options)
419 for (
Int_t row = 0; row <
fGc->GetStreamRows(stream,column); row++) {
430 return fGc->GetStreamFieldValue(stream,column,row);
437 return fGc->GetStreamFieldKey(stream,column,row);
444 return fGc->GetStreamColumns(stream);
473 if (strlen(result) > 0) {
474 if (atoi(result) == 1) {
480 Error(
"Cd",
"Cannot change to directory %s\n",ldn);
513 Error(
"pwd",
"Cannot get current working directory\n");
523 if (strlen(options)) {
538 if (strlen(result) > 0) {
539 if (atoi(result) > 0) {
545 Error(
"Mkdir",
"Cannot create directory %s\n",ldn);
555 if (strlen(options)) {
570 if (strlen(result) > 0) {
571 if (atoi(result) == 1) {
577 Error(
"Rmdir",
"Cannot remove directory %s\n",ldn);
606 if (strlen(result) > 0) {
607 if (atoi(result) == 1) {
631 if (strlen(result) > 0) {
632 if (atoi(result) == 1) {
638 Error(
"Rm",
"Cannot remove %s\n",lfn);
652 Error(
"OpenCollection",
653 "Trying to read a collection, but gGrid not initialized with AliEn");
661 Error(
"OpenCollection",
662 "Could not retrieve collection %s from the catalog", collectionfile);
697 Error(
"Type",
"Did not receive TGridResult from query %s", cmdline.
Data());
701 const char* typeStr = gridResult->
GetKey(0,
"type");
702 if (!typeStr || !typeStr[0]) {
703 Error(
"Type",
"Could not get type of %s", lfn);
710 if (strcmp(typeStr,
"file") == 0) {
712 }
else if (strcmp(typeStr,
"directory") == 0) {
714 }
else if (strcmp(typeStr,
"collection") == 0) {
717 Error(
"Type",
"Unknown type %s", typeStr);
746 if (!alienpackagedir) {
747 alienpackagedir =
"/alice/packages";
770 allplatform+=pplatform;
780 Info(
"ListPackages",
"Package: %-16s Version: %-20s Platform: [ %s ]",pname.
Data(),pversion.
Data(),allplatform.
Data());
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
static TAlienCollection * OpenAlienCollection(TGridResult *queryresult, Option_t *option="")
Static method used to create an Alien event collection, by creating collection from a TGridResult Get...
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...
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 void DumpResult()
Dump result set.
TAlien(const char *gridurl, const char *uid=0, const char *passwd=0, const char *options=0)
virtual TGridJob * Submit(const char *jdl)
Submit a command to AliEn. Returns 0 in case of error.
void Shell()
Start an interactive AliEn shell.
virtual Bool_t ResubmitById(TString jobid)
Resubmit a specific job.
virtual TGridResult * LocateSites()
UInt_t GetNColumns(UInt_t stream)
virtual TGridResult * OpenDataset(const char *lfn, const char *options="")
virtual TGridJobStatusList * Ps(const char *options, Bool_t verbose=kTRUE)
Get job status list.
TGridResult * Command(const char *command, bool interactive=kFALSE, UInt_t stream=kOUTPUT)
Execute AliEn command. Returns 0 in case or error.
virtual TGridResult * ListPackages(const char *alienpackagedir="/alice/packages")
List packages in the specified directory.
const char * GetStreamFieldKey(UInt_t stream, UInt_t column, UInt_t row)
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 * Ls(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
virtual CatalogType Type(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
returns the type of the given lfn
virtual TGridResult * GetCollection(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
virtual Bool_t Rmdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
TString Escape(const char *input)
Escape " by \".
virtual TGridCollection * OpenCollectionQuery(TGridResult *queryresult, Bool_t nogrouping=kFALSE)
Factory function fo a TAlienCollection based on a gGrid Query.
virtual Bool_t Cd(const char *ldn="", Bool_t verbose=kFALSE)
virtual TGridJDL * GetJDLGenerator()
Create a Alien JDL.
TMap * GetColumn(UInt_t stream=0, UInt_t column=0)
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)
const char * GetStreamFieldValue(UInt_t stream, UInt_t column, UInt_t row)
virtual Int_t Mkdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
virtual TGridCollection * OpenCollection(const char *collectionfile, UInt_t maxentries=kTRUE)
Factory function for a TAlienCollection based on an XML file.
virtual TGridResult * Query(const char *path, const char *pattern, const char *conditions="", const char *options="")
virtual ~TAlien()
do we need to delete fGc ? (rdm)
virtual const char * Pwd(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 * GetKey(UInt_t, const char *) const
virtual const char * GetFileName(UInt_t) const
const char * GetUser() const
Iterator abstract base class.
virtual TObject * Next()=0
virtual void Add(TObject *obj)
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Collectable string class.
const char * GetName() const
Returns name of object.
const TString & GetString() const
Mother of all ROOT objects.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual const char * Getenv(const char *env)
Get environment variable.
virtual void Unsetenv(const char *name)
Unset environment variable.
This class represents a WWW compatible URL.
const char * GetHost() const
static void output(int code)