@@ -170,22 +170,23 @@ def get_deployment_log(args):
170170 exit (1 )
171171
172172 to_timestamp = datetime .now ()
173- from_timestamp = ( to_timestamp - timedelta (seconds = args .duration ) )
173+ from_timestamp = to_timestamp - timedelta (seconds = args .duration )
174174 last_log_timestamp = from_timestamp
175- log_ids = set () # to avoid duplicate logs
175+ log_ids = set () # to avoid duplicate logs
176176 max_entries = args .tail
177177 while True :
178178 status_code , msg = deploymentapi .get_deployment_log (
179- api_key , args .deployment_name , from_timestamp , to_timestamp , max_entries )
179+ api_key , args .deployment_name , from_timestamp , to_timestamp , max_entries
180+ )
180181 if status_code != 200 :
181182 print (f"{ status_code } : { msg } " )
182183 exit (status_code )
183184
184- for log in msg [::- 1 ]: # logs are sorted by reversed timestamp
185+ for log in msg [::- 1 ]: # logs are sorted by reversed timestamp
185186 log_timestamp = datetime .fromisoformat (log ["timestamp" ]).replace (tzinfo = None )
186- if (log [' insert_id' ] in log_ids ) or (log_timestamp < last_log_timestamp ):
187+ if (log [" insert_id" ] in log_ids ) or (log_timestamp < last_log_timestamp ):
187188 continue
188- log_ids .add (log [' insert_id' ])
189+ log_ids .add (log [" insert_id" ])
189190 last_log_timestamp = log_timestamp
190191 print (f'[{ log_timestamp .strftime ("%Y-%m-%d %H:%M:%S.%f" )} ] { log ["payload" ]} ' )
191192
@@ -195,5 +196,4 @@ def get_deployment_log(args):
195196 time .sleep (10 )
196197 from_timestamp = last_log_timestamp
197198 to_timestamp = datetime .now ()
198- max_entries = 300 # only set max_entries for the first request
199-
199+ max_entries = 300 # only set max_entries for the first request
0 commit comments