@@ -112,7 +112,11 @@ def __init__(
112
112
self .container = None
113
113
114
114
def process (
115
- self , processing_inputs , processing_output_config , environment , processing_job_name
115
+ self ,
116
+ processing_inputs ,
117
+ processing_output_config ,
118
+ environment ,
119
+ processing_job_name ,
116
120
):
117
121
"""Run a processing job locally using docker-compose.
118
122
@@ -139,7 +143,11 @@ def process(
139
143
for host in self .hosts :
140
144
_create_processing_config_file_directories (self .container_root , host )
141
145
self .write_processing_config_files (
142
- host , environment , processing_inputs , processing_output_config , processing_job_name
146
+ host ,
147
+ environment ,
148
+ processing_inputs ,
149
+ processing_output_config ,
150
+ processing_job_name ,
143
151
)
144
152
145
153
self ._generate_compose_file (
@@ -379,7 +387,12 @@ def retrieve_artifacts(self, compose_data, output_data_config, job_name):
379
387
return os .path .join (output_data , "model.tar.gz" )
380
388
381
389
def write_processing_config_files (
382
- self , host , environment , processing_inputs , processing_output_config , processing_job_name
390
+ self ,
391
+ host ,
392
+ environment ,
393
+ processing_inputs ,
394
+ processing_output_config ,
395
+ processing_job_name ,
383
396
):
384
397
"""Write the config files for the processing containers.
385
398
@@ -1078,8 +1091,28 @@ def _ecr_login_if_needed(boto_session, image):
1078
1091
token = raw_token .decode ("utf-8" ).strip ("AWS:" )
1079
1092
ecr_url = auth ["authorizationData" ][0 ]["proxyEndpoint" ]
1080
1093
1081
- cmd = "docker login -u AWS -p %s %s" % (token , ecr_url )
1082
- subprocess .check_output (cmd .split ())
1094
+ # Log in to ecr, but use communicate to not print creds to the console
1095
+ cmd = [
1096
+ "docker" ,
1097
+ "login" ,
1098
+ ecr_url ,
1099
+ "-u" ,
1100
+ "AWS" ,
1101
+ "--password-stdin" ,
1102
+ ]
1103
+ proc = subprocess .Popen (
1104
+ cmd ,
1105
+ stdin = subprocess .PIPE ,
1106
+ )
1107
+
1108
+ stdout , stderr = proc .communicate (input = token .encode ())
1109
+
1110
+ # Just in case, possibly need to replace the token with * in the output
1111
+ logger .info (
1112
+ "%s, %s" ,
1113
+ stdout .decode ().replace (token , "***" ),
1114
+ stderr .decode ().replace (token , "***" ),
1115
+ )
1083
1116
1084
1117
return True
1085
1118
0 commit comments