File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -687,6 +687,10 @@ def create_signer(self) -> Dict:
687687 logger .info (f"Using 'resource_principal' authentication." )
688688 return signer_dict
689689
690+ @staticmethod
691+ def supported ():
692+ return any (os .environ .get (var ) for var in ['JOB_RUN_OCID' , 'NB_SESSION_OCID' , 'DATAFLOW_RUN_ID' ])
693+
690694
691695class InstancePrincipal (AuthSignerGenerator ):
692696 """
Original file line number Diff line number Diff line change 1111
1212import yaml
1313
14- from ads .common .auth import AuthType
14+ from ads .common .auth import AuthType , ResourcePrincipal
1515from ads .opctl import logger
1616from ads .opctl .config .base import ConfigProcessor
1717from ads .opctl .config .utils import read_from_ini , _DefaultNoneDict
@@ -115,7 +115,7 @@ def _fill_config_with_defaults(self, ads_config_path: str) -> None:
115115 )
116116 # set default auth
117117 if not self .config ["execution" ].get ("auth" , None ):
118- if is_in_notebook_session () or is_in_jobrun ():
118+ if ResourcePrincipal . supported ():
119119 self .config ["execution" ]["auth" ] = (
120120 exec_config .get ("auth" ) or AuthType .RESOURCE_PRINCIPAL
121121 )
You can’t perform that action at this time.
0 commit comments