def cream_proxy_delegation(ce, delid, cred_req): """CREAM CE proxy delegation""" if not ce: logger.warning('No CREAM CE endpoint specified') return if not delid: logger.debug('making new proxy delegation to %s' % ce) cmd = 'glite-ce-delegate-proxy' cmd += ' -e %s' % ce.split('/cream')[0] delid = '%s_%s' % (credential_store[cred_req].identity, get_uuid()) cmd = '%s "%s"' % (cmd, delid) logger.debug('proxy delegation command: %s' % cmd) rc, output, m = getShell(cred_req).cmd1(cmd, allowed_exit=[0, 255], timeout=config['SubmissionTimeout']) if rc != 0: # failed to delegate proxy logger.error('proxy delegation error: %s' % output) delid = '' else: # proxy delegated successfully t_expire = datetime.datetime.now() + credential_store[cred_req].time_left() logger.debug('new proxy at %s valid until %s' % (ce, t_expire)) return delid
def cream_proxy_delegation(ce, delid, cred_req): """CREAM CE proxy delegation""" if not ce: logger.warning('No CREAM CE endpoint specified') return if not delid: logger.debug('making new proxy delegation to %s' % ce) cmd = 'glite-ce-delegate-proxy' cmd += ' -e %s' % ce.split('/cream')[0] delid = '%s_%s' % (credential_store[cred_req].identity, get_uuid()) cmd = '%s "%s"' % (cmd, delid) logger.debug('proxy delegation command: %s' % cmd) rc, output, m = getShell(cred_req).cmd1( cmd, allowed_exit=[0, 255], timeout=config['SubmissionTimeout']) if rc != 0: # failed to delegate proxy logger.error('proxy delegation error: %s' % output) delid = '' else: # proxy delegated successfully t_expire = datetime.datetime.now( ) + credential_store[cred_req].time_left() logger.debug('new proxy at %s valid until %s' % (ce, t_expire)) return delid
def __setup_sandboxcache__(self, job): '''Sets up the sandbox cache object to adopt the runtime configuration of the LCG backend''' re_token = re.compile('^token:(.*):(.*)$') self.sandboxcache.vo = config['VirtualOrganisation'] self.sandboxcache.middleware = 'GLITE' self.sandboxcache.timeout = config['SandboxTransferTimeout'] if self.sandboxcache._name == 'LCGSandboxCache': if not self.sandboxcache.lfc_host: self.sandboxcache.lfc_host = grids[ self.sandboxcache.middleware].__get_lfc_host__() if not self.sandboxcache.se: token = '' se_host = config['DefaultSE'] m = re_token.match(se_host) if m: token = m.group(1) se_host = m.group(2) self.sandboxcache.se = se_host if token: self.sandboxcache.srm_token = token if (self.sandboxcache.se_type in ['srmv2']) and (not self.sandboxcache.srm_token): self.sandboxcache.srm_token = config['DefaultSRMToken'] elif self.sandboxcache._name == 'DQ2SandboxCache': # generate a new dataset name if not given if not self.sandboxcache.dataset_name: from GangaAtlas.Lib.ATLASDataset.DQ2Dataset import dq2outputdatasetname self.sandboxcache.dataset_name, unused = dq2outputdatasetname( "%s.input" % get_uuid(), 0, False, '') # subjobs inherits the dataset name from the master job for sj in job.subjobs: sj.backend.sandboxcache.dataset_name = self.sandboxcache.dataset_name elif self.sandboxcache._name == 'GridftpSandboxCache': if config['CreamInputSandboxBaseURI']: self.sandboxcache.baseURI = config['CreamInputSandboxBaseURI'] elif self.CE: ce_host = re.sub(r'\:[0-9]+', '', self.CE.split('/cream')[0]) self.sandboxcache.baseURI = 'gsiftp://%s/opt/glite/var/cream_sandbox/%s' % ( ce_host, self.sandboxcache.vo) else: logger.error('baseURI not available for GridftpSandboxCache') return False return True
def cream_proxy_delegation(ce, delid): """CREAM CE proxy delegation""" if not __cream_ui_check__(): return if not ce: logger.warning('No CREAM CE endpoint specified') return if not delid: logger.debug('making new proxy delegation to %s' % ce) cmd = 'glite-ce-delegate-proxy' cmd += ' -e %s' % ce.split('/cream')[0] delid = '%s_%s' % (credential().identity(), get_uuid()) cmd = '%s "%s"' % (cmd, delid) logger.debug('proxy delegation command: %s' % cmd) rc, output, m = getShell().cmd1( '%s%s' % (__get_cmd_prefix_hack__(binary=True), cmd), allowed_exit=[0, 255], timeout=config['SubmissionTimeout']) if rc != 0: # failed to delegate proxy logger.error('proxy delegation error: %s' % output) delid = '' else: # proxy delegated successfully t_expire = time.time() + float(credential().timeleft( units="seconds", force_check=True)) logger.debug('new proxy at %s valid until %s' % (ce, t_expire)) return delid
def cream_proxy_delegation(ce, delid): """CREAM CE proxy delegation""" if not __cream_ui_check__(): return if not ce: logger.warning("No CREAM CE endpoint specified") return if not delid: logger.debug("making new proxy delegation to %s" % ce) cmd = "glite-ce-delegate-proxy" cmd += " -e %s" % ce.split("/cream")[0] delid = "%s_%s" % (credential().identity(), get_uuid()) cmd = '%s "%s"' % (cmd, delid) logger.debug("proxy delegation command: %s" % cmd) rc, output, m = getShell().cmd1( "%s%s" % (__get_cmd_prefix_hack__(binary=True), cmd), allowed_exit=[0, 255], timeout=config["SubmissionTimeout"], ) if rc != 0: # failed to delegate proxy logger.error("proxy delegation error: %s" % output) delid = "" else: # proxy delegated successfully t_expire = time.time() + float(credential().timeleft(units="seconds", force_check=True)) logger.debug("new proxy at %s valid until %s" % (ce, t_expire)) return delid
def __get_unique_fname__(self): """gets an unique filename""" cred = getCredential("GridProxy", self.middleware) uid = re.sub(r"[\:\-\(\)]{1,}", "", cred.identity()).lower() fname = "user.%s.%s" % (uid, get_uuid()) return fname
def __get_unique_fname__(self): '''gets an unique filename''' fname = 'user.%s' % (get_uuid()) return fname
def __get_unique_fname__(self): '''gets an unique filename''' cred = getCredential('GridProxy', self.middleware) uid = re.sub(r'[\:\-\(\)]{1,}', '', cred.identity()).lower() fname = 'user.%s.%s' % (uid, get_uuid()) return fname
def __get_unique_fname__(self): """gets an unique filename""" fname = "user.%s" % (get_uuid()) return fname