int CondorQ:: fetchQueue (ClassAdList &list, StringList &attrs, ClassAd *ad, CondorError* errstack) { Qmgr_connection *qmgr; ExprTree *tree; int result; char scheddString [32]; const char *constraint; bool useFastPath = false; // make the query ad if ((result = query.makeQuery (tree)) != Q_OK) return result; constraint = ExprTreeToString( tree ); delete tree; // connect to the Q manager init(); // needed to get default connect_timeout if (ad == 0) { // local case if( !(qmgr = ConnectQ( 0, connect_timeout, true, errstack)) ) { errstack->push("TEST", 0, "FOO"); return Q_SCHEDD_COMMUNICATION_ERROR; } useFastPath = true; } else { // remote case to handle condor_globalq if (!ad->LookupString (ATTR_SCHEDD_IP_ADDR, scheddString, sizeof(scheddString))) return Q_NO_SCHEDD_IP_ADDR; if( !(qmgr = ConnectQ( scheddString, connect_timeout, true, errstack)) ) return Q_SCHEDD_COMMUNICATION_ERROR; } // get the ads and filter them getAndFilterAds (constraint, attrs, list, useFastPath); DisconnectQ (qmgr); return Q_OK; }
int CondorQ:: fetchQueueFromHost (ClassAdList &list, StringList &attrs, const char *host, char const *schedd_version, CondorError* errstack) { Qmgr_connection *qmgr; ExprTree *tree; const char *constraint; int result; // make the query ad if ((result = query.makeQuery (tree)) != Q_OK) return result; constraint = ExprTreeToString( tree ); delete tree; /* connect to the Q manager. use a timeout of 20 seconds, and a read-only connection. why 20 seconds? because careful research by Derek has shown that whenever one needs a periodic time value, 20 is always optimal. :^). */ init(); // needed to get default connect_timeout if( !(qmgr = ConnectQ( host, connect_timeout, true, errstack)) ) return Q_SCHEDD_COMMUNICATION_ERROR; int useFastPath = 0; if( schedd_version && *schedd_version ) { CondorVersionInfo v(schedd_version); useFastPath = v.built_since_version(6,9,3) ? 1 : 0; if (v.built_since_version(8, 1, 5)) { useFastPath = 2; } } // get the ads and filter them result = getAndFilterAds (constraint, attrs, -1, list, useFastPath); DisconnectQ (qmgr); return result; }