30 |
|
|
31 |
|
self.ServerTwiki = 'https://twiki.cern.ch/twiki/bin/view/CMS/CrabServer#Server_available_for_users' |
32 |
|
|
33 |
– |
self.dontMoveProxy = False |
34 |
– |
if string.lower(cfg_params.get("CRAB.scheduler")) in ['lsf','caf']: |
35 |
– |
self.dontMoveProxy = True |
36 |
– |
|
33 |
|
self.asSession = C_AS_Session(serverName, serverPort) |
34 |
|
self.cfg_params = cfg_params |
35 |
|
self.userSubj = '' |
36 |
|
self.serverName = serverName |
37 |
< |
|
37 |
> |
credentialType = 'Proxy' |
38 |
> |
if common.scheduler.name().upper() in ['CAF','LSF']: |
39 |
> |
credentialType = 'Token' |
40 |
|
CliServerParams(self) |
41 |
|
self.crab_task_name = common.work_space.topDir().split('/')[-2] # nice task name "crab_0_..." |
42 |
|
|
43 |
< |
x509 = proxyPath |
44 |
< |
if self.dontMoveProxy == False: |
45 |
< |
if 'X509_USER_PROXY' in os.environ: |
46 |
< |
x509 = os.environ['X509_USER_PROXY'] |
47 |
< |
else: |
48 |
< |
exitCode, x509 = commands.getstatusoutput('ls /tmp/x509up_u`id -u`').strip() |
49 |
< |
if exitCode != 0: |
50 |
< |
raise CrabException("Error while locating the user proxy file") |
51 |
< |
return |
52 |
< |
|
55 |
< |
exitCode, self.userSubj = commands.getstatusoutput('openssl x509 -in %s -subject -noout'%x509) |
56 |
< |
if exitCode != 0: |
57 |
< |
raise CrabException("Error while getting the subject from the user proxy") |
58 |
< |
return |
59 |
< |
self.userSubj = str(self.userSubj).strip() |
60 |
< |
else: |
61 |
< |
x509 = '' |
62 |
< |
self.userSubj = str(os.environ['USER']) |
63 |
< |
pass |
64 |
< |
|
43 |
> |
from ProdCommon.Credential.CredentialAPI import CredentialAPI |
44 |
> |
configAPI = {'credential' : credentialType } |
45 |
> |
|
46 |
> |
CredAPI = CredentialAPI( configAPI ) |
47 |
> |
try: |
48 |
> |
self.userSubj = CredAPI.getSubject() |
49 |
> |
except Exception, err: |
50 |
> |
common.logger.debug(3, "Getting Credential Subject: " +str(traceback.format_exc())) |
51 |
> |
raise CrabException("Error Getting Credential Subject") |
52 |
> |
|
53 |
|
################################################### |
54 |
|
# Interactions with the server |
55 |
|
################################################### |
103 |
|
elif ret == 14: |
104 |
|
# Draining |
105 |
|
logMsg = 'Error The server %s refused to accept the task %s because it is Draining out\n'%(self.serverName, self.crab_task_name) |
106 |
< |
logMsg = '\t remaining jobs due to scheduled maintainence\n' |
106 |
> |
logMsg += '\t remaining jobs due to scheduled maintainence\n' |
107 |
|
logMsg += '\t For Further infos please contact the server Admin: %s'%self.server_admin |
108 |
|
elif ret == 101: |
109 |
|
# overlaod |