49 if (condorHome !=
"") {
51 path = condorHome +
"/bin:" + path;
56 if (condorConf !=
"") {
91 std::cout <<
"OBJ: " << IsA()->GetName()
92 <<
"\tPool: \"" <<
fPool <<
"\""
93 <<
"\tState: " <<
fState << std::endl;
105 TString claimCmd =
Form(
"condor_cod request -name %s -timeout 10 2>>%s/condor.proof.%d",
108 PDB(kCondor,2)
Info(
"ClaimVM",
"command: %s", claimCmd.
Data());
112 SysError(
"ClaimVM",
"cannot run command: %s", claimCmd.
Data());
118 while (
line.Gets(pipe)) {
119 PDB(kCondor,3)
Info(
"ClaimVM",
"line = %s",
line.Data());
121 if (
line.BeginsWith(
"ClaimId = \"")) {
125 PDB(kCondor,1)
Info(
"ClaimVM",
"claim = '%s'", claimId.
Data());
128 port = 37000 + atoi(num.
Data());
129 PDB(kCondor,1)
Info(
"ClaimVM",
"port = %d", port);
135 Error(
"ClaimVM",
"command: %s returned %d", claimCmd.
Data(),
r);
138 PDB(kCondor,1)
Info(
"ClaimVM",
"command: %s returned %d", claimCmd.
Data(),
r);
144 if (jf == 0)
return 0;
152 TString activateCmd =
Form(
"condor_cod activate -id '%s' -jobad %s",
155 PDB(kCondor,2)
Info(
"ClaimVM",
"command: %s", activateCmd.
Data());
159 SysError(
"ClaimVM",
"cannot run command: %s", activateCmd.
Data());
163 while (
line.Gets(pipe)) {
164 PDB(kCondor,3)
Info(
"ClaimVM",
"Activate: line = %s",
line.Data());
169 Error(
"ClaimVM",
"command: %s returned %d", activateCmd.
Data(),
r);
171 PDB(kCondor,1)
Info(
"ClaimVM",
"command: %s returned %d", activateCmd.
Data(),
r);
197 TString cmd =
Form(
"condor_status %s -format \"%%s\\n\" Name", poolopt.
Data());
199 PDB(kCondor,2)
Info(
"GetVirtualMachines",
"command: %s", cmd.
Data());
204 SysError(
"GetVirtualMachines",
"cannot run command: %s", cmd.
Data());
210 while (
line.Gets(pipe)) {
211 PDB(kCondor,3)
Info(
"GetVirtualMachines",
"line = %s",
line.Data());
218 Error(
"GetVirtualMachines",
"command: %s returned %d", cmd.
Data(),
r);
221 PDB(kCondor,1)
Info(
"GetVirtualMachines",
"command: %s returned %d", cmd.
Data(),
r);
236 Error(
"Claim",
"not in state Free");
268 Error(
"Claim",
"not in state Free or Active");
287 PDB(kCondor,1)
Info(
"SetState",
"state: %s (%lld)",
296 PDB(kCondor,2)
Info(
"SetState",
"command: %s", cmd.
Data());
300 SysError(
"SetState",
"cannot run command: %s", cmd.
Data());
305 while (
line.Gets(pipe)) {
306 PDB(kCondor,3)
Info(
"SetState",
"line = %s",
line.Data());
311 Error(
"SetState",
"command: %s returned %d", cmd.
Data(),
r);
314 PDB(kCondor,1)
Info(
"SetState",
"command: %s returned %d", cmd.
Data(),
r);
329 Error(
"Suspend",
"not in state Active");
343 Error(
"Suspend",
"not in state Suspended");
357 Error(
"Suspend",
"not in state Active or Suspended");
365 PDB(kCondor,2)
Info(
"SetState",
"command: %s", cmd.
Data());
369 SysError(
"Release",
"cannot run command: %s", cmd.
Data());
374 while (
line.Gets(pipe)) {
375 PDB(kCondor,3)
Info(
"Release",
"line = %s",
line.Data());
380 Error(
"Release",
"command: %s returned %d", cmd.
Data(),
r);
383 PDB(kCondor,1)
Info(
"Release",
"command: %s returned %d", cmd.
Data(),
r);
400 TString cmd =
Form(
"condor_status -format \"%%d:\" Mips -format \"%%s\\n\" FileSystemDomain "
401 "-const 'Name==\"%s\"'", vm);
403 PDB(kCondor,2)
Info(
"GetVmInfo",
"command: %s", cmd.
Data());
407 SysError(
"GetVmInfo",
"cannot run command: %s", cmd.
Data());
412 while (
line.Gets(pipe)) {
413 PDB(kCondor,3)
Info(
"GetVmInfo",
"line = %s",
line.Data());
416 perfidx = atoi(amips);
424 Error(
"GetVmInfo",
"command: %s returned %d", cmd.
Data(),
r);
427 PDB(kCondor,1)
Info(
"GetVmInfo",
"command: %s returned %d", cmd.
Data(),
r);
439 TString cmd =
Form(
"condor_status -direct %s -format \"Image:%%s\\n\" "
440 "FileSystemDomain", host);
442 PDB(kCondor,2)
Info(
"GetImage",
"command: %s", cmd.
Data());
447 SysError(
"GetImage",
"cannot run command: %s", cmd.
Data());
453 while (
line.Gets(pipe)) {
454 PDB(kCondor,3)
Info(
"GetImage",
"line = %s",
line.Data());
463 Error(
"GetImage",
"command: %s returned %d", cmd.
Data(),
r);
466 PDB(kCondor,1)
Info(
"GetImage",
"command: %s returned %d", cmd.
Data(),
r);
478 std::cout <<
"OBJ: " << IsA()->GetName()
481 <<
" Image: " <<
fImage << std::endl;
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
void Print(Option_t *option="") const
Print worker status.
Bool_t Suspend()
Suspend worker.
Bool_t Release()
Release worker.
Bool_t Resume()
Resume worker.
void Print(Option_t *option="") const
Print master status.
TList * Claim(Int_t n, const char *cmd)
Claim n virtual machines This function figures out the image and performance index before returning t...
TCondor(const char *pool="")
Create Condor interface object.
TCondorSlave * ClaimVM(const char *vm, const char *cmd)
Claim a VirtualMachine for PROOF usage.
virtual ~TCondor()
Cleanup Condor interface.
TString GetImage(const char *host) const
Get image of the worker.
Bool_t GetVmInfo(const char *vm, TString &image, Int_t &perfidx) const
Get info about worker status.
TList * GetVirtualMachines() const
Get the names of the virtual machines in the pool.
Bool_t SetState(EState state)
Set the state of workers.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Collectable string class.
const char * GetName() const
Returns name of object.
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
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.
Regular expression class.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TString & Remove(Ssiz_t pos)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual const char * Getenv(const char *env)
Get environment variable.
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
virtual FILE * OpenPipe(const char *command, const char *mode)
Open a pipe.
virtual FILE * TempFileName(TString &base, const char *dir=0)
Create a secure temporary file by appending a unique 6 letter string to base.
virtual int ClosePipe(FILE *pipe)
Close the pipe.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual Int_t GetUid(const char *user=0)
Returns the user's id. If user = 0, returns current user's id.
virtual void Setenv(const char *name, const char *value)
Set environment variable.
virtual int Unlink(const char *name)
Unlink, i.e.
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.