@@ -69,17 +69,17 @@ def add_deployment_parser(subparsers):
6969 deployment_delete_parser .set_defaults (func = delete_deployment )
7070 deployment_delete_parser .add_argument ("-a" , "--api_key" , help = "api key" )
7171 deployment_delete_parser .add_argument ("deployment_name" , help = "deployment name" )
72-
72+
7373 deployment_log_parser .set_defaults (func = get_deployment_log )
7474 deployment_log_parser .add_argument ("-a" , "--api_key" , help = "api key" )
7575 deployment_log_parser .add_argument ("deployment_name" , help = "deployment name" )
7676 deployment_log_parser .add_argument (
77- "-d" , "--duration" , help = "duration of log (from now) in seconds" , type = int , default = 3600 )
78- deployment_log_parser .add_argument (
79- "-n" , "--tail" , help = "number of lines to show from the end of the logs (<= 50)" , type = int , default = 10 )
77+ "-d" , "--duration" , help = "duration of log (from now) in seconds" , type = int , default = 3600
78+ )
8079 deployment_log_parser .add_argument (
81- "-f " , "--follow " , help = "follow log output " , action = "store_true"
80+ "-n " , "--tail " , help = "number of lines to show from the end of the logs (<= 50) " , type = int , default = 10
8281 )
82+ deployment_log_parser .add_argument ("-f" , "--follow" , help = "follow log output" , action = "store_true" )
8383
8484
8585def list_machine_types (args ):
@@ -168,14 +168,15 @@ def get_deployment_log(args):
168168 if api_key is None :
169169 print ("Please provide an api key" )
170170 exit (1 )
171-
171+
172172 to_timestamp = datetime .now ()
173173 from_timestamp = (to_timestamp - timedelta (seconds = args .duration ))
174174 last_log_timestamp = from_timestamp
175175 log_ids = set () # to avoid duplicate logs
176176 max_entries = args .tail
177177 while True :
178- status_code , msg = deploymentapi .get_deployment_log (api_key , args .deployment_name , from_timestamp , to_timestamp , max_entries )
178+ status_code , msg = deploymentapi .get_deployment_log (
179+ api_key , args .deployment_name , from_timestamp , to_timestamp , max_entries )
179180 if status_code != 200 :
180181 print (f"{ status_code } : { msg } " )
181182 exit (status_code )
@@ -190,7 +191,7 @@ def get_deployment_log(args):
190191
191192 if not args .follow :
192193 break
193-
194+
194195 time .sleep (10 )
195196 from_timestamp = last_log_timestamp
196197 to_timestamp = datetime .now ()
0 commit comments