80#include "gapi_job_operations.h"
100 if (!strlen(gurl->
GetHost())) {
142 if (options && (options[0] ==
't')) {
150 Error(
"TAlien",
"could not connect to a alien service at:");
161 Error(
"TAlien",
"we have no valid connection ... I try to connect ...");
173 sprintf(cwd,
"%s",cwdp);
182 if (!
fGc->Connected()) {
183 Error(
"TAlien",
"could not authenticate at:");
203 Info(
"~TAlien",
"destructor called");
223 output.ReplaceAll(
"\"",
"\\\"");
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());
292 GAPI_JOBARRAY* gjobarray = gapi_queryjobs(
"-",
gGrid->
GetUser(),
"-",
"-",
"-",
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();
385 fGc->PrintCommandStdout();
394 fGc->PrintCommandStderr();
401 const char *conditions,
const char *options)
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);
474 if (strlen(result) > 0) {
475 if (atoi(result) == 1) {
481 Error(
"Cd",
"Cannot change to directory %s\n",ldn);
514 Error(
"pwd",
"Cannot get current working directory\n");
524 if (strlen(options)) {
539 if (strlen(result) > 0) {
540 if (atoi(result) > 0) {
546 Error(
"Mkdir",
"Cannot create directory %s\n",ldn);
556 if (strlen(options)) {
571 if (strlen(result) > 0) {
572 if (atoi(result) == 1) {
578 Error(
"Rmdir",
"Cannot remove directory %s\n",ldn);
607 if (strlen(result) > 0) {
608 if (atoi(result) == 1) {
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());
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)