File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -546,7 +546,13 @@ def __init__(self, pilotParams):
546546
547547    @logFinalizer  
548548    def  execute (self ):
549-         """Calls dirac-admin-add-pilot""" 
549+         """Calls dirac-admin-add-pilot 
550+          
551+         Deprecated with DIRAC V9 and DiracX.""" 
552+ 
553+         if  self .pp .jwt :
554+             self .log .warn ("Skipping module, normally it is already done via DiracX secret-exchange." )
555+             return 
550556
551557        if  not  self .pp .pilotReference :
552558            self .log .warn ("Skipping module, no pilot reference found" )
Original file line number Diff line number Diff line change @@ -1072,12 +1072,27 @@ def __init__(self):
10721072                self .jwt  =  config .executeRequest ({
10731073                    "pilot_stamp" : self .pilotUUID ,
10741074                    "pilot_secret" : self .pilotSecret 
1075-                 },  insecure = True )
1076-             except  ( HTTPError ,  URLError )  as  e :
1075+                 })
1076+             except  HTTPError  as  e :
10771077                self .log .error ("Request failed: %s"  %  str (e ))
1078-                 self .log .error ("Could not fetch pilot tokens. Aborting..." )
1079-                 sys .exit (1 )
1080- 
1078+                 self .log .error ("Could not fetch pilot tokens." )
1079+                 if  e .code  ==  401 :
1080+                     # First test if the error occurred because of "bad pilot_stamp" 
1081+                     # If so, this pilot is in the vacuum case 
1082+                     # So we redo auth, but this time with the right data for vacuum cases 
1083+                     self .log .error ("Retrying with vacuum case data..." )
1084+                     self .jwt  =  config .executeRequest ({
1085+                         "pilot_stamp" : self .pilotUUID ,
1086+                         "pilot_secret" : self .pilotSecret ,
1087+                         "vo" : self .wnVO ,
1088+                         "grid_type" : self .gridCEType ,
1089+                         "grid_site" : self .site ,
1090+                         "status" : "Running" 
1091+                     })
1092+                 else :
1093+                     self .log .error ("Can't be a vacuum case. Aborting..." )
1094+                     sys .exit (- 1 )
1095+         
10811096            self .log .info ("Fetched the pilot token with the pilot secret." )
10821097        else :
10831098            self .log .info ("PilotUUID, pilotSecret, and diracXServer are needed to support DiracX." )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments