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;
107 TString claimCmd =
Form(
"condor_cod request -name %s -timeout 10 2>>%s/condor.proof.%d",
110 PDB(kCondor,2)
Info(
"ClaimVM",
"command: %s", claimCmd.
Data());
114 SysError(
"ClaimVM",
"cannot run command: %s", claimCmd.
Data());
120 while (line.
Gets(pipe)) {
121 PDB(kCondor,3)
Info(
"ClaimVM",
"line = %s", line.
Data());
127 PDB(kCondor,1)
Info(
"ClaimVM",
"claim = '%s'", claimId.
Data());
130 port = 37000 + atoi(num.
Data());
131 PDB(kCondor,1)
Info(
"ClaimVM",
"port = %d", port);
137 Error(
"ClaimVM",
"command: %s returned %d", claimCmd.
Data(),
r);
140 PDB(kCondor,1)
Info(
"ClaimVM",
"command: %s returned %d", claimCmd.
Data(),
r);
146 if (jf == 0)
return 0;
154 TString activateCmd =
Form(
"condor_cod activate -id '%s' -jobad %s",
155 claimId.
Data(), jobad.Data() );
157 PDB(kCondor,2)
Info(
"ClaimVM",
"command: %s", activateCmd.
Data());
161 SysError(
"ClaimVM",
"cannot run command: %s", activateCmd.
Data());
165 while (line.
Gets(pipe)) {
166 PDB(kCondor,3)
Info(
"ClaimVM",
"Activate: line = %s", line.
Data());
171 Error(
"ClaimVM",
"command: %s returned %d", activateCmd.
Data(),
r);
173 PDB(kCondor,1)
Info(
"ClaimVM",
"command: %s returned %d", activateCmd.
Data(),
r);
199 TString cmd =
Form(
"condor_status %s -format \"%%s\\n\" Name", poolopt.
Data());
201 PDB(kCondor,2)
Info(
"GetVirtualMachines",
"command: %s", cmd.Data());
206 SysError(
"GetVirtualMachines",
"cannot run command: %s", cmd.Data());
212 while (line.
Gets(pipe)) {
213 PDB(kCondor,3)
Info(
"GetVirtualMachines",
"line = %s", line.
Data());
220 Error(
"GetVirtualMachines",
"command: %s returned %d", cmd.Data(),
r);
223 PDB(kCondor,1)
Info(
"GetVirtualMachines",
"command: %s returned %d", cmd.Data(),
r);
238 Error(
"Claim",
"not in state Free");
270 Error(
"Claim",
"not in state Free or Active");
289 PDB(kCondor,1)
Info(
"SetState",
"state: %s (%lld)",
298 PDB(kCondor,2)
Info(
"SetState",
"command: %s", cmd.
Data());
302 SysError(
"SetState",
"cannot run command: %s", cmd.
Data());
307 while (line.
Gets(pipe)) {
308 PDB(kCondor,3)
Info(
"SetState",
"line = %s", line.
Data());
313 Error(
"SetState",
"command: %s returned %d", cmd.
Data(),
r);
316 PDB(kCondor,1)
Info(
"SetState",
"command: %s returned %d", cmd.
Data(),
r);
331 Error(
"Suspend",
"not in state Active");
345 Error(
"Suspend",
"not in state Suspended");
359 Error(
"Suspend",
"not in state Active or Suspended");
367 PDB(kCondor,2)
Info(
"SetState",
"command: %s", cmd.
Data());
371 SysError(
"Release",
"cannot run command: %s", cmd.
Data());
376 while (line.
Gets(pipe)) {
377 PDB(kCondor,3)
Info(
"Release",
"line = %s", line.
Data());
382 Error(
"Release",
"command: %s returned %d", cmd.
Data(),
r);
385 PDB(kCondor,1)
Info(
"Release",
"command: %s returned %d", cmd.
Data(),
r);
402 TString cmd =
Form(
"condor_status -format \"%%d:\" Mips -format \"%%s\\n\" FileSystemDomain " 403 "-const 'Name==\"%s\"'", vm);
405 PDB(kCondor,2)
Info(
"GetVmInfo",
"command: %s", cmd.
Data());
409 SysError(
"GetVmInfo",
"cannot run command: %s", cmd.
Data());
414 while (line.
Gets(pipe)) {
415 PDB(kCondor,3)
Info(
"GetVmInfo",
"line = %s", line.
Data());
418 perfidx = atoi(amips);
426 Error(
"GetVmInfo",
"command: %s returned %d", cmd.
Data(),
r);
429 PDB(kCondor,1)
Info(
"GetVmInfo",
"command: %s returned %d", cmd.
Data(),
r);
441 TString cmd =
Form(
"condor_status -direct %s -format \"Image:%%s\\n\" " 442 "FileSystemDomain", host);
444 PDB(kCondor,2)
Info(
"GetImage",
"command: %s", cmd.
Data());
449 SysError(
"GetImage",
"cannot run command: %s", cmd.
Data());
455 while (line.
Gets(pipe)) {
456 PDB(kCondor,3)
Info(
"GetImage",
"line = %s", line.
Data());
465 Error(
"GetImage",
"command: %s returned %d", cmd.
Data(),
r);
468 PDB(kCondor,1)
Info(
"GetImage",
"command: %s returned %d", cmd.
Data(),
r);
480 std::cout <<
"OBJ: " << IsA()->GetName()
481 <<
" " << fHostname <<
":" << fPort
482 <<
" Perf: " << fPerfIdx
483 <<
" Image: " << fImage << std::endl;
Bool_t Release()
Release worker.
TList * GetVirtualMachines() const
Get the names of the virtual machines in the pool.
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
Bool_t Suspend()
Suspend worker.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Collectable string class.
Bool_t SetState(EState state)
Set the state of workers.
TString & ReplaceAll(const TString &s1, const TString &s2)
TString GetImage(const char *host) const
Get image of the worker.
Regular expression class.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual FILE * OpenPipe(const char *command, const char *mode)
Open a pipe.
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
virtual FILE * TempFileName(TString &base, const char *dir=0)
Create a secure temporary file by appending a unique 6 letter string to base.
virtual const char * Getenv(const char *env)
Get environment variable.
TList * Claim(Int_t n, const char *cmd)
Claim n virtual machines This function figures out the image and performance index before returning t...
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
virtual void Setenv(const char *name, const char *value)
Set environment variable.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
R__EXTERN TSystem * gSystem
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Bool_t Gets(FILE *fp, Bool_t chop=kTRUE)
Read one line from the stream, including the , or until EOF.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
virtual int ClosePipe(FILE *pipe)
Close the pipe.
virtual ~TCondor()
Cleanup Condor interface.
TString & Remove(Ssiz_t pos)
Bool_t GetVmInfo(const char *vm, TString &image, Int_t &perfidx) const
Get info about worker status.
virtual Int_t GetUid(const char *user=0)
Returns the user's id. If user = 0, returns current user's id.
void Print(Option_t *option="") const
Print worker status.
virtual void Add(TObject *obj)
void Print(Option_t *option="") const
Print master status.
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
TCondorSlave * ClaimVM(const char *vm, const char *cmd)
Claim a VirtualMachine for PROOF usage.
Bool_t Resume()
Resume worker.
const char * Data() const