def test_getCondorQ(self, m_exe_cmd, m_iGetEnv): f = open('cq.fixture') m_exe_cmd.return_value = f.readlines() cq = glideinFrontendLib.getCondorQ(['sched1']) condor_ids = cq['sched1'].fetchStored().keys() self.assertItemsEqual(condor_ids, [(12345, x) for x in xrange(0, self.total_jobs)])
def test_getCondorQ_no_constraints(self, m_getCondorQConstrained): schedd_names = ['test_sched1', 'test_sched2'] glideinFrontendLib.getCondorQ(schedd_names, job_status_filter=None) m_getCondorQConstrained.assert_called_with(schedd_names, 'True', None, None) glideinFrontendLib.getCondorQ(schedd_names) m_getCondorQConstrained.assert_called_with(schedd_names, '(JobStatus=?=1)||(JobStatus=?=2)', None, None) glideinFrontendLib.getCondorQ(schedd_names, job_status_filter=[5]) m_getCondorQConstrained.assert_called_with(schedd_names, '(JobStatus=?=5)', None, None) constraint = '(JobStatus=?=1)||(JobStatus=?=2)' format_list = list((('x509UserProxyFirstFQAN','s'),)) glideinFrontendLib.getCondorQ(schedd_names, 'True', format_list) m_getCondorQConstrained.assert_called_with( schedd_names, constraint, 'True', format_list + self.default_format)
def test_getCondorQ_no_constraints(self, m_getCondorQConstrained): schedd_names = ['test_sched1', 'test_sched2'] glideinFrontendLib.getCondorQ(schedd_names, job_status_filter=None) m_getCondorQConstrained.assert_called_with(schedd_names, 'True', None, None) glideinFrontendLib.getCondorQ(schedd_names) m_getCondorQConstrained.assert_called_with( schedd_names, '(JobStatus=?=1)||(JobStatus=?=2)', None, None) glideinFrontendLib.getCondorQ(schedd_names, job_status_filter=[5]) m_getCondorQConstrained.assert_called_with(schedd_names, '(JobStatus=?=5)', None, None) constraint = '(JobStatus=?=1)||(JobStatus=?=2)' format_list = list((('x509UserProxyFirstFQAN', 's'), )) glideinFrontendLib.getCondorQ(schedd_names, 'True', format_list) m_getCondorQConstrained.assert_called_with( schedd_names, constraint, 'True', format_list + self.default_format)
#condorq_format_list=list(condorq_format_list)+list((('x509UserProxyFirstFQAN','s'),)) #condorq_format_list=list(condorq_format_list)+list((('x509UserProxyFQAN','s'),)) #condorq_dict = glideinFrontendLib.getCondorQ(elementDescript.merged_data['JobSchedds'], # elementDescript.merged_data['JobQueryExpr'], # condorq_format_list) try: condorq_format_list = elementDescript.merged_data['JobMatchAttrs'] if x509_proxy_plugin is not None: condorq_format_list = list(condorq_format_list) + list(x509_proxy_plugin.get_required_job_attributes()) ### Add in elements to help in determining if jobs have voms creds condorq_format_list=list(condorq_format_list)+list((('x509UserProxyFirstFQAN','s'),)) condorq_format_list=list(condorq_format_list)+list((('x509UserProxyFQAN','s'),)) condorq_format_list=list(condorq_format_list)+list((('x509userproxy','s'),)) condorq_dict = glideinFrontendLib.getCondorQ(elementDescript.merged_data['JobSchedds'], expand_DD(elementDescript.merged_data['JobQueryExpr'],attr_dict), condorq_format_list) except Exception: logSupport.log.exception("In query schedd child, exception:") os.write(w,cPickle.dumps(condorq_dict)) except Exception, ex: tb = traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1], sys.exc_info()[2]) logSupport.log.debug("Error in retrieving information from schedd (condor_q): %s" % tb) os.close(w) # hard kill myself... don't want any cleanup, since i was created just for this calculation os.kill(os.getpid(),signal.SIGKILL) else: