def submit(self, **opts): """Log submit event on client.""" j = self.job_info # called on client, so job_info is Job object self._log('debug', 'submit %s' % j.fqid) # ignore master wrapper jobs if j.subjobs: self._log( 'debug', 'Not sending unwanted message on submit for master wrapper job %s.' % j.fqid) return # send Ganga submitted job-status message message = self._cl_job_status_message( 'submitted', 'Ganga', CommonUtil.utcnow()) if message['GRIDJOBID'] is None: # This is to handle the temporary workaround in # IBackend.master_bulk_updateMonitoringInformation() which results in two # submit messages being sent, one without a grid_job_id. self._log( 'debug', 'Not sending redundant message on submit without grid_job_id for job %s.' % j.fqid) else: self._send(self.config_info['destination_job_status'], message) if j.master: j = j.master from Ganga.GPIDev import Credentials proxy = Credentials.getCredential('GridProxy') ownerdn = proxy.info('-subject') user = '******' # if no error in the proxy -> get the second CN value from right to # left if ownerdn.find('ERROR') == -1: if ownerdn.rfind('CN=') > -1: subownerdn = ownerdn[0:ownerdn.rfind('CN=') - 1] user = subownerdn[ subownerdn.rfind('CN=') + 3:].replace(' ', '') task_name = 'ganga:%s:%s' % (j.info.uuid, j.name,) task_mon_link = "http://dashb-atlas-jobdev.cern.ch/dashboard/templates/index.html#user=%s&from=&till=&timeRange=lastDay&refresh=0&tid=%s&p=1&uparam[]=all" % ( user, task_name) if j.backend.__class__.__name__ == 'Panda' and len(j.backend.buildjobs) > 0 and j.backend.buildjobs[0].url is not None: j.info.monitoring_links = [ (task_mon_link, 'dashboard'), (j.backend.buildjobs[0].url, 'panda')] else: j.info.monitoring_links = [(task_mon_link, 'dashboard')]
def cl_ownerdn(): """Build ownerdn. Only run on client.""" from Ganga.GPIDev import Credentials proxy = Credentials.getCredential('GridProxy') ownerdn = proxy.info('-subject') return CommonUtil.strip_to_none(ownerdn)