コード例 #1
0
 def expand_role(self):
     if 'Model' not in self.config:
         return
     config = self.config['Model']
     if 'ExecutionRoleArn' in config:
         hook = AwsHook(self.aws_conn_id)
         config['ExecutionRoleArn'] = hook.expand_role(config['ExecutionRoleArn'])
コード例 #2
0
 def test_expand_role(self):
     conn = boto3.client('iam', region_name='us-east-1')
     conn.create_role(RoleName='test-role',
                      AssumeRolePolicyDocument='some policy')
     hook = AwsHook()
     arn = hook.expand_role('test-role')
     expect_arn = conn.get_role(RoleName='test-role').get('Role').get('Arn')
     self.assertEqual(arn, expect_arn)
コード例 #3
0
 def expand_role(self):
     if 'RoleArn' in self.config:
         hook = AwsHook(self.aws_conn_id)
         self.config['RoleArn'] = hook.expand_role(self.config['RoleArn'])
コード例 #4
0
ファイル: sagemaker_tuning.py プロジェクト: stu12345/airflow
 def expand_role(self):
     if 'TrainingJobDefinition' in self.config:
         config = self.config['TrainingJobDefinition']
         if 'RoleArn' in config:
             hook = AwsHook(self.aws_conn_id)
             config['RoleArn'] = hook.expand_role(config['RoleArn'])