@@ -47,7 +47,8 @@ def abbreviate_image(image):
47
47
48
48
49
49
abbrev_role_pat = re .compile (
50
- r"arn:aws([^:]*):iam::(?P<account>\d+):role/(?P<name>[^/]+)" )
50
+ r"arn:aws([^:]*):iam::(?P<account>\d+):role/(?P<name>[^/]+)"
51
+ )
51
52
52
53
53
54
def abbreviate_role (role ):
@@ -127,15 +128,14 @@ def execute_notebook(
127
128
elif "/" not in role :
128
129
identity = session .client ("sts" ).get_caller_identity ()
129
130
account = identity ["Account" ]
130
- partition = identity ["Arn" ].split (':' )[1 ]
131
+ partition = identity ["Arn" ].split (":" )[1 ]
131
132
role = "arn:{}:iam::{}:role/{}" .format (partition , account , role )
132
133
133
134
if "/" not in image :
134
135
account = session .client ("sts" ).get_caller_identity ()["Account" ]
135
136
region = session .region_name
136
137
domain = domain_for_region (region )
137
- image = "{}.dkr.ecr.{}.{}/{}:latest" .format (
138
- account , region , domain , image )
138
+ image = "{}.dkr.ecr.{}.{}/{}:latest" .format (account , region , domain , image )
139
139
140
140
if notebook == None :
141
141
notebook = input_path
@@ -145,8 +145,7 @@ def execute_notebook(
145
145
timestamp = time .strftime ("%Y-%m-%d-%H-%M-%S" , time .gmtime ())
146
146
147
147
job_name = (
148
- ("papermill-" + re .sub (r"[^-a-zA-Z0-9]" ,
149
- "-" , nb_name ))[: 62 - len (timestamp )]
148
+ ("papermill-" + re .sub (r"[^-a-zA-Z0-9]" , "-" , nb_name ))[: 62 - len (timestamp )]
150
149
+ "-"
151
150
+ timestamp
152
151
)
@@ -636,7 +635,7 @@ def create_lambda(role=None, session=None):
636
635
if "/" not in role :
637
636
identity = session .client ("sts" ).get_caller_identity ()
638
637
account = identity ["Account" ]
639
- partition = identity ["Arn" ].split (':' )[1 ]
638
+ partition = identity ["Arn" ].split (":" )[1 ]
640
639
role = "arn:{}:iam::{}:role/{}" .format (partition , account , role )
641
640
642
641
code_bytes = zip_bytes (code_file )
@@ -788,9 +787,8 @@ def proc(extras):
788
787
if "/" not in image :
789
788
account = session .client ("sts" ).get_caller_identity ()["Account" ]
790
789
region = session .region_name
791
- domain = domain_for_region (region )
792
- image = "{}.dkr.ecr.{}.{}/{}:latest" .format (
793
- account , region , domain , image )
790
+ domain = domain_for_region (region )
791
+ image = "{}.dkr.ecr.{}.{}/{}:latest" .format (account , region , domain , image )
794
792
795
793
if not role :
796
794
try :
@@ -801,7 +799,7 @@ def proc(extras):
801
799
if "/" not in role :
802
800
identity = session .client ("sts" ).get_caller_identity ()
803
801
account = identity ["Account" ]
804
- partition = identity ["Arn" ].split (':' )[1 ]
802
+ partition = identity ["Arn" ].split (":" )[1 ]
805
803
role = "arn:{}:iam::{}:role/{}" .format (partition , account , role )
806
804
807
805
if input_path is None :
@@ -918,8 +916,7 @@ def proc(extras):
918
916
account = session .client ("sts" ).get_caller_identity ()["Account" ]
919
917
region = session .region_name
920
918
domain = domain_for_region (region )
921
- image = "{}.dkr.ecr.{}.{}/{}:latest" .format (
922
- account , region , domain , image )
919
+ image = "{}.dkr.ecr.{}.{}/{}:latest" .format (account , region , domain , image )
923
920
924
921
if not role :
925
922
try :
@@ -930,7 +927,7 @@ def proc(extras):
930
927
if "/" not in role :
931
928
identity = session .client ("sts" ).get_caller_identity ()
932
929
account = identity ["Account" ]
933
- partition = identity ["Arn" ].split (':' )[1 ]
930
+ partition = identity ["Arn" ].split (":" )[1 ]
934
931
role = "arn:{}:iam::{}:role/{}" .format (partition , account , role )
935
932
936
933
if input_path is None :
@@ -963,7 +960,7 @@ def proc(extras):
963
960
)
964
961
identity = session .client ("sts" ).get_caller_identity ()
965
962
account = identity ["Account" ]
966
- partition = identity ["Arn" ].split (':' )[1 ]
963
+ partition = identity ["Arn" ].split (":" )[1 ]
967
964
region = session .region_name
968
965
target_arn = "arn:{}:lambda:{}:{}:function:{}" .format (
969
966
partition , region , account , lambda_function_name
0 commit comments