40 : fExport(256), fType(
'W'), fPort(-1), fPerfIdx(100), fNwrks(1), fActive(1)
42 fMutex =
new XrdSysRecMutex;
45 if (!str || strlen(str) <= 0)
64 fMutex =
new XrdSysRecMutex;
84 XPDLOC(NMGR,
"Worker::Reset")
101 if (!str || strlen(str) <= 0)
109 XrdOucString typestr =
"master|submaster|worker|slave";
110 int from = s.tokenize(tok, 0,
' ');
111 if (from == STR_NPOS || typestr.find(tok) == STR_NPOS)
113 if (tok ==
"submaster")
115 else if (tok ==
"master")
119 if ((from = s.tokenize(tok, from,
' ')) == STR_NPOS)
125 char *fullHostName = XrdSysDNS::getHostName((
char *)ui.
Host.c_str(), &err);
126 if (!fullHostName || (fullHostName && !strcmp(fullHostName,
"0.0.0.0"))) {
127 TRACE(XERR,
"DNS could not resolve '" << ui.
Host <<
"'");
131 fHost = fullHostName;
137 while ((from = s.tokenize(tok, from,
' ')) != STR_NPOS) {
138 if (tok.beginswith(
"workdir=")) {
140 tok.replace(
"workdir=",
"");
142 }
else if (tok.beginswith(
"image=")) {
144 tok.replace(
"image=",
"");
146 }
else if (tok.beginswith(
"msd=")) {
148 tok.replace(
"msd=",
"");
150 }
else if (tok.beginswith(
"port=")) {
152 tok.replace(
"port=",
"");
153 fPort = strtol(tok.c_str(), (
char **)0, 10);
154 }
else if (tok.beginswith(
"perf=")) {
156 tok.replace(
"perf=",
"");
157 fPerfIdx = strtol(tok.c_str(), (
char **)0, 10);
158 }
else if (!tok.beginswith(
"repeat=")) {
160 TRACE(XERR,
"ignoring unknown option '" << tok <<
"'");
171 return ((
fHost.matches(host)) ? 1 : 0);
205 XPDLOC(NMGR,
"Worker::Export")
211 if (
fUser.length() > 0) {
225 if (ord && strlen(ord) > 0) {
229 }
else if (
fOrd.length() > 0) {
245 if (
fImage.length() > 0) {
259 if (
fMsd.length() > 0) {
283 std::list<XrdProofdProofServ *>::iterator iter;
284 XrdSysMutexHelper mhp(
fMutex);
300 std::list<XrdProofdProofServ *>::const_iterator iter;
301 XrdSysMutexHelper mhp(
fMutex);
326 std::list<XrdProofWorker *>::iterator i = lst->begin();
329 for (; i != lst->end(); ++i)
339 if (
f(ta[j], ta[j+1]))
350 if (!
f(ta[k], ta[k-1])) {
367 lst->push_back(ta[
n]);
#define TRACE(Flag, Args)
int GetNActiveSessions()
Calculate the number of workers existing on this node which are currently running.
void Reset(const char *str)
Set content from a config file-like string.
bool Matches(const char *host)
Check compatibility of host with this instance.
std::list< XrdProofdProofServ * > fProofServs
void MergeProofServs(const XrdProofWorker &other)
Merge session objects from the other worker object in order to merge all the objects in only one.
XrdProofWorker(const char *str=0)
Constructor from a config file-like string.
static void Sort(std::list< XrdProofWorker * > *lst, bool(*f)(XrdProofWorker *&lhs, XrdProofWorker *&rhs))
Sort ascendingly the list according to the comparing algorithm defined by 'f'; 'f' should return 'tru...
virtual ~XrdProofWorker()
Destructor.
const char * Export(const char *ord=0)
Export current content in a form understood by parsing algorithms inside the PROOF session,...