Commit b27d10ed authored by Volodymyr Yurchenko's avatar Volodymyr Yurchenko Committed by Nikola Hardi
Browse files

Add missing TJAlien files

parent 8f4c3708
void P030_TAlienSystem()
{
gPluginMgr->AddHandler("TSystem", "^alien:", "TJAlienSystem",
"RJAliEn", "TJAlienSystem()");
}
......@@ -6,10 +6,17 @@
#pragma link C++ class TJAlien;
#pragma link C++ class TJAlienCollection;
#pragma link C++ class TJAlienDirectory;
#pragma link C++ class TJAlienDirectoryEntry;
#pragma link C++ class TJAlienFile;
#pragma link C++ class TJAlienJDL;
#pragma link C++ class TJAlienJob;
#pragma link C++ class TJAlienJobStatus;
#pragma link C++ class TJAlienJobStatusList;
#pragma link C++ class TJAlienMasterJob;
#pragma link C++ class TJAlienMasterJobStatus;
#pragma link C++ class TJAlienPackage;
#pragma link C++ class TJAlienResult;
#pragma link C++ class TJAlienSAXHandler;
#pragma link C++ class TJAlienSystem;
#endif
......@@ -139,6 +139,7 @@ public:
TJAlienResult *RunJsonCommand(TString *command, TList *options);
TGridResult *Command(const char * command, bool interactive = kFALSE, UInt_t stream = kOUTPUT);
Int_t GetExitCode(TJAlienResult *result, TObjString* &message);
unsigned int ReadTags(int column, std::map<std::string, std::string> &tags) const;
virtual TGridResult *Query(const char *path, const char *pattern, const char *conditions = "", const char *options = "");
......@@ -167,6 +168,8 @@ public:
virtual TGridJobStatusList *Ps(const char* options="", Bool_t verbose=kFALSE);
virtual TGridCollection *OpenCollection(const char *, UInt_t maxentries = 1000000);
virtual TGridCollection *OpenCollectionQuery(TGridResult *queryresult, Bool_t nogrouping);
virtual void NotImplemented(const char *func, const char *file, int line);
ClassDef(TJAlien, 0) // Interface to JAliEn GRID services
......
// @(#)root/alien:$Id$
// Author: Jan Fiete Grosse-Oetringhaus 28/9/2004
/*************************************************************************
* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TJAlienDirectory
#define ROOT_TJAlienDirectory
//////////////////////////////////////////////////////////////////////////
// //
// TJAlienDirectory //
// //
// Class which creates Directory files for the AliEn middleware. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_Tlist
#include "TList.h"
#endif
#ifndef ROOT_TBrowser
#include "TBrowser.h"
#endif
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_TMap
#include "TMap.h"
#endif
class TJAlienDirectoryEntry : public TNamed {
private:
TString fLfn; // logical file name
TMap fBrowserObjects; // objects shown in browser
public:
TJAlienDirectoryEntry(const char *lfn, const char *name) : TNamed(name,name) { fLfn = lfn; }
virtual ~TJAlienDirectoryEntry() { }
Bool_t IsFolder() const { return kTRUE; }
void Browse(TBrowser *b);
ClassDef(TJAlienDirectoryEntry,1) // Creates Directory files entries for the AliEn middleware
};
class TJAlienDirectory : public TNamed {
private:
TList fEntries; // directory entries
TMap fBrowserObjects; // objects shown in browser
public:
TJAlienDirectory(const char *ldn, const char *name=0);
virtual ~TJAlienDirectory();
void Fill();
Bool_t IsFolder() const { return kTRUE; }
void Browse(TBrowser *b);
ClassDef(TJAlienDirectory,1) // Creates Directory files for the AliEn middleware
};
#endif
// @(#)root/alien:$Id$
// Author: Jan Fiete Grosse-Oetringhaus 28/9/2004
// Lucia.Jancurova@cern.ch Slovakia 2007
/*************************************************************************
* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TJAlienJDL
#define ROOT_TJAlienJDL
//////////////////////////////////////////////////////////////////////////
// //
// TJAlienJDL //
// //
// Class which creates JDL files for the alien middleware. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TGridJDL
#include "TGridJDL.h"
#endif
class TJAlienJDL : public TGridJDL {
public:
TJAlienJDL() : TGridJDL() { }
virtual ~TJAlienJDL() { }
virtual void SetExecutable(const char *value=0, const char *description=0);
virtual void SetArguments(const char *value=0, const char *description=0);
virtual void SetEMail(const char *value=0, const char *description=0);
virtual void SetOutputDirectory(const char *value=0, const char *description=0);
virtual void SetPrice(UInt_t price=1, const char *description=0);
virtual void SetMergedOutputDirectory(const char *value=0, const char *description=0);
virtual void SetTTL(UInt_t ttl=72000, const char *description=0);
virtual void SetJobTag(const char *jobtag=0, const char *description=0);
virtual void SetInputDataListFormat(const char *format="xml-single", const char *description=0);
virtual void SetInputDataList(const char *list="collection.xml", const char *description=0);
virtual void SetSplitMode(const char *value, UInt_t maxnumberofinputfiles=0,
UInt_t maxinputfilesize=0, const char *d1=0, const char *d2=0,
const char *d3=0);
virtual void SetSplitModeMaxNumOfFiles(UInt_t maxnumberofinputfiles=0, const char *description=0);
virtual void SetSplitModeMaxInputFileSize(UInt_t maxinputfilesize=0, const char *description=0);
virtual void SetSplitArguments(const char *splitarguments=0, const char *description=0);
virtual void SetValidationCommand(const char *value, const char *description=0);
virtual void SetMaxInitFailed(Int_t maxInitFailed, const char *description=0);
virtual void SetOwnCommand(const char *command=0, const char *value=0, const char *description=0);
virtual void AddToInputSandbox(const char *value=0, const char *description=0);
virtual void AddToOutputSandbox(const char *value=0, const char *description=0);
virtual void AddToInputData(const char *value=0, const char *description=0);
virtual void AddToInputDataCollection(const char *value=0, const char *description=0);
virtual void AddToRequirements(const char *value=0, const char *description=0);
virtual void AddToPackages(const char *name/*="AliRoot"*/, const char *version/*="newest"*/,
const char *type/*="VO_ALICE"*/, const char *description=0);
virtual void AddToPackages(const char *name/*="VO_ALICE@AliRoot::newest"*/,
const char *description=0);
virtual void AddToOutputArchive(const char *value=0, const char *description=0);
virtual void AddToReqSet(const char *key, const char *value=0);
virtual void AddToMerge(const char *filenameToMerge/*="histograms.root"*/,
const char *jdlToSubmit/*="/alice/jdl/mergerootfile.jdl"*/,
const char *mergedFile/*="histograms-merged.root"*/,
const char *description=0);
virtual void AddToMerge(const char *merge="histo.root:/alice/jdl/mergerootfile.jdl:histo-merged.root",
const char *description=0);
void SetValueByCmd(TString cmd, TString value);
virtual void Parse(const char *filename);
void Simulate();
Bool_t SubmitTest();
ClassDef(TJAlienJDL, 1) // Creates JDL files for the AliEn middleware
};
#endif
......@@ -23,29 +23,35 @@
#include "TMap.h"
#endif
class TAlienJob;
class TAlienMasterJob;
class TJAlienJob;
class TJAlienMasterJob;
class TJAlienJobStatus : public TGridJobStatus {
friend class TAlienJob;
friend class TAlienMasterJob;
friend class TJAlienJob;
friend class TJAlienMasterJob;
private:
TMap fStatus; // Contains the status information of the job.
// In the Alien implementation this is a string, string map.
TString fJdlTag; // JdlTag
TMap fStatus; // Contains the status information of the job.
// In the Alien implementation this is a string, string map.
TString fJdlTag; // JdlTag
public:
TJAlienJobStatus() {};
TJAlienJobStatus(TMap *status);
virtual ~TJAlienJobStatus();
TJAlienJobStatus() {};
TJAlienJobStatus(TMap *status);
virtual ~TJAlienJobStatus();
virtual TGridJobStatus::EGridJobStatus GetStatus() const;
virtual void Print(Option_t *) const;
virtual void PrintJob(Bool_t full) const;
const char *GetJdlKey(const char *key);
const char *GetKey(const char *key);
ClassDef(TJAlienJobStatus,1) // JAliEn implementation of TGridJobStatus
virtual TGridJobStatus::EGridJobStatus GetStatus() const;
virtual void Print(Option_t *) const;
virtual void PrintJob(Bool_t full) const;
Bool_t IsFolder() const { return kTRUE;}
void Browse(TBrowser *b);
ClassDef(TJAlienJobStatus,1) // JAliEn implementation of TGridJobStatus
};
#endif /* ROOT_TJAlienJobStatus */
......@@ -29,7 +29,7 @@ protected:
public:
TJAlienJobStatusList() { gGridJobStatusList = this; };
virtual ~TJAlienJobStatusList() { if (gGridJobStatusList == this) gGridJobStatusList=0; };
virtual ~TJAlienJobStatusList() { if (gGridJobStatusList == this) gGridJobStatusList = 0; };
ClassDef(TJAlienJobStatusList,1) // ABC defining interface to a list of JAliEn GRID jobs
......
// @(#)root/alien:$Id$
// Author: Jan Fiete Grosse-Oetringhaus 27/10/2004
/*************************************************************************
* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TJAlienMasterJob
#define ROOT_TJAlienMasterJob
//////////////////////////////////////////////////////////////////////////
// //
// TJAlienMasterJob //
// //
// Special Grid job which contains a master job which controls //
// underlying jobs resulting from job splitting. //
// //
// Related classes are TJAlienJobStatus. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TGridJob
#include "TGridJob.h"
#endif
class TJAlienMasterJob : public TGridJob {
public:
TJAlienMasterJob(TString jobID) : TGridJob(jobID) { }
virtual ~TJAlienMasterJob() { }
virtual TGridJobStatus *GetJobStatus() const;
void Print(Option_t *) const;
Bool_t Merge();
Bool_t Merge(const char *inputname, const char *mergeoutput = 0);
void Browse(TBrowser* b);
ClassDef(TJAlienMasterJob, 1) // Special Alien grid job controlling results of job splitting
};
#endif
// @(#)root/alien:$Id$
// Author: Jan Fiete Grosse-Oetringhaus 28/10/2004
/*************************************************************************
* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TJAlienMasterJobStatus
#define ROOT_TJAlienMasterJobStatus
//////////////////////////////////////////////////////////////////////////
// //
// TJAlienMasterJobStatus //
// //
// Status of a MasterJob. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TGridJobStatus
#include "TGridJobStatus.h"
#endif
#ifndef ROOT_TMap
#include "TMap.h"
#endif
class TJAlienJobStatus;
class TJAlienMasterJob;
class TJAlienMasterJobStatus : public TGridJobStatus {
friend class TJAlienMasterJob;
private:
TJAlienJobStatus *fMasterJob; // Status of the master job
TMap fJobs; // Map which contains the sub jobs,
// key is the job ID, values are
// TJAlienJobStatus objects
public:
TJAlienMasterJobStatus(const char* jobid) : fMasterJob(0)
{ TString name; name = jobid; SetName(name); SetTitle(name); }
virtual ~TJAlienMasterJobStatus();
EGridJobStatus GetStatus() const;
void Print(Option_t *) const;
Float_t PercentFinished();
Bool_t IsFolder() const { return kTRUE; }
void Browse(TBrowser *b);
TMap *GetJobs() { return &fJobs; }
Int_t GetNSubJobs() const { return fJobs.GetSize(); }
ClassDef(TJAlienMasterJobStatus, 1) // Status of Alien master job
};
#endif
// @(#)root/alien:$Id$
// Author: Lucia Jancurova/Andreas-Joachim Peters 1/10/2007
/*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TJAlienPackage
#define ROOT_TJAlienPackage
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
#ifndef ROOT_TList
#include "TList.h"
#endif
#ifndef ROOT_TGrid
#include "TGrid.h"
#endif
//////////////////////////////////////////////////////////////////////////
// //
// TJAlienPackage //
// //
// Class providing package management functionality like the AliEn //
// Package Management System. //
// Allows to setup software packages on a local desktop like in the //
// GRID environment. //
// //
//////////////////////////////////////////////////////////////////////////
class TJAlienPackage {
private:
TString fName; // package principal name
TString fVersion; // package version
TString fPlatform; // package platform
TString fInstallationDirectory; // installation directory
TString fAliEnMainPackageDir; // path to alien packages in the AliEn FC
TString fPostInstallCommand; // command to execute for postinstall
TString fEnableCommand; // command to enable the package
TList *fInstallList; // package list with names of dependency packages
TList *fPackages; // package list TPackage with this and dependency packages
Int_t fDebugLevel; // internal debug level
Bool_t fEnabled; // true if package is enabled for execution
Bool_t PostInstall (TString name, TString version); // runs the postinstall procedure for this package
Bool_t InstallSinglePackage (TString name, TString version, Bool_t isDep = kFALSE); // installs the defined package without dependencies
Bool_t InstallAllPackages (); // installs the defined package + all dependency packages
public:
TJAlienPackage();
TJAlienPackage(const char *name,
const char *version,
const char *platform,
const char *installationdirectory = "/var/tmp/alien/packages");
virtual ~TJAlienPackage();
Bool_t Enable(); // install/enable the defined package
const char *GetEnable(); // return shell command to enable package
Bool_t Exec(const char *cmdline); // execute <cmd> with this package
Bool_t UnInstall(); // uninstall the defined package
Bool_t ReInstall(); // reinstall the defined package
Bool_t CheckDependencies(); // get all the dependencies of a package
Bool_t IsDirectory(const char *dir1, const char *str); // check for <str> in GRID directory <dir1>
Bool_t CheckDirectories(TString name, TString version); // check that the defined package is existing as an alien package directory
void SetName(const TString & theValue) { fName = theValue; }
// set the name of the package
TString GetName() const { return fName; }
// get the name of the package
void SetVersion(const TString & theValue) { fVersion = theValue; }
// set the version of the package
TString GetVersion() const { return fVersion; }
// get the version of the package
void SetPlatform(const TString & theValue) { fPlatform = theValue; }
// set the platform for the package
TString GetPlatform() const { return fPlatform; }
// get the platform for the package
void SetInstallationDirectory(const TString & theValue) { fInstallationDirectory = theValue; }
// set the installation directory
TString GetInstallationDirectory() const { return fInstallationDirectory; }
// get the installation directory
void SeTJAlienMainPackageDir(const TString & theValue) { fAliEnMainPackageDir = theValue; }
// set the alien path to look for the named package
TString GeTJAlienMainPackageDir() const { return fAliEnMainPackageDir; }
// get the alien path to look for the named package
void SetInstallList(TList * theValue) { fInstallList = theValue; }
// set the install(dependency) package list
TList *GetInstallList() const { return fInstallList; }
// get the install(dependency) package list;
void SetDebugLevel(Int_t & theValue) { fDebugLevel = theValue; }
// set the internal debug level
Int_t GetDebugLevel() { return fDebugLevel; }
// get the internal debug level
ClassDef (TJAlienPackage, 0); // Alien package interface
};
#endif
// @(#)root/base:$Id$
// Author: Andreas Peters 15/05/2006
/*************************************************************************
* Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TJAlienSystem
#define ROOT_TJAlienSystem
//////////////////////////////////////////////////////////////////////////
// //
// TJAlienSystem //
// //
// TSystem Implementation of the AliEn GRID plugin. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef __CINT__
#include <stdio.h>
#endif
#ifndef ROOT_TSystem
#include "TSystem.h"
#endif
class TJAlienSystem : public TSystem {
protected:
char fWorkingDirectory[1024];
public:
TJAlienSystem(const char *name = "Generic", const char *title = "Generic System");
virtual ~TJAlienSystem();
//---- Misc
virtual Bool_t Init();
//---- Directories
virtual int MakeDirectory(const char *name);
virtual void *OpenDirectory(const char *name);
virtual void FreeDirectory(void *dirp);
virtual const char *GetDirEntry(void *dirp);
virtual void *GetDirPtr() const { return 0; }
virtual Bool_t ChangeDirectory(const char *path);
virtual const char *WorkingDirectory();
virtual const char *HomeDirectory(const char *userName = 0);
virtual int mkdir(const char *name, Bool_t recursive = kFALSE);
Bool_t cd(const char *path) { return ChangeDirectory(path); }
const char *pwd() { return WorkingDirectory(); }
//---- Paths & Files
virtual int CopyFile(const char *from, const char *to, Bool_t overwrite = kFALSE);
virtual int Rename(const char *from, const char *to);
virtual int Link(const char *from, const char *to);
virtual int Symlink(const char *from, const char *to);
virtual int Unlink(const char *name);
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime);
int GetPathInfo(const char *path, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);
virtual int GetPathInfo(const char *path, FileStat_t &buf);
virtual int JAlienFilestat(const char *fpath, FileStat_t &buf);
virtual int GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree);
virtual int Chmod(const char *file, UInt_t mode);
virtual int Umask(Int_t mask);
virtual int Utime(const char *file, Long_t modtime, Long_t actime);
virtual const char *FindFile(const char *search, TString& file, EAccessMode mode = kFileExists);
virtual Bool_t AccessPathName(const char *path, EAccessMode mode = kFileExists);
//---- Users & Groups
virtual Int_t GetUid(const char *user = 0);
virtual Int_t GetGid(const char *group = 0);
virtual Int_t GetEffectiveUid();
virtual Int_t GetEffectiveGid();
virtual UserGroup_t *GetUserInfo(Int_t uid);
virtual UserGroup_t *GetUserInfo(const char *user = 0);
virtual UserGroup_t *GetGroupInfo(Int_t gid);
virtual UserGroup_t *GetGroupInfo(const char *group = 0);
ClassDef(TJAlienSystem, 0) // System interface to the Alien Catalogue
};
#endif
......@@ -479,7 +479,7 @@ void TJAlien::Stdout()
{
if (TJAlien::readBuffer != NULL) {
json_object * jobj_res = json_tokener_parse(TJAlien::readBuffer.c_str());
Info("Stdout", "%s", TJAlien::readBuffer.c_str());
//Info("Stdout", "%s", TJAlien::readBuffer.c_str());
// get data from results
json_object *js_results;
json_object_object_get_ex(jobj_res, "results", &js_results);
......@@ -501,6 +501,40 @@ void TJAlien::Stdout()
}
}
//______________________________________________________________________________
unsigned int TJAlien::ReadTags(int column, std::map<std::string, std::string> &tags) const
{
/** Fills the key-value pairs of a response from the server into the
the associative array @tags. @column is the column of the
response you are interested in.
The return value is the number of tags found.
*/
UNUSED(column);
if (TJAlien::readBuffer != NULL) {
json_object * jobj_res = json_tokener_parse(TJAlien::readBuffer.c_str());
// get data from results
json_object *js_results;
json_object_object_get_ex(jobj_res, "results", &js_results);
if (js_results != NULL && json_object_is_type(js_results, json_type_array))
{
int arraylen = json_object_array_length(js_results);
int i;
for (i = 0; i < arraylen; i++)
{
Info("TJAlien", "===================");
json_object *jvalue = json_object_array_get_idx(js_results, i);
json_object_object_foreach(jvalue, key, val)