@@ -69,17 +69,17 @@ def add_deployment_parser(subparsers):
69
69
deployment_delete_parser .set_defaults (func = delete_deployment )
70
70
deployment_delete_parser .add_argument ("-a" , "--api_key" , help = "api key" )
71
71
deployment_delete_parser .add_argument ("deployment_name" , help = "deployment name" )
72
-
72
+
73
73
deployment_log_parser .set_defaults (func = get_deployment_log )
74
74
deployment_log_parser .add_argument ("-a" , "--api_key" , help = "api key" )
75
75
deployment_log_parser .add_argument ("deployment_name" , help = "deployment name" )
76
76
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
+ )
80
79
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
82
81
)
82
+ deployment_log_parser .add_argument ("-f" , "--follow" , help = "follow log output" , action = "store_true" )
83
83
84
84
85
85
def list_machine_types (args ):
@@ -168,14 +168,15 @@ def get_deployment_log(args):
168
168
if api_key is None :
169
169
print ("Please provide an api key" )
170
170
exit (1 )
171
-
171
+
172
172
to_timestamp = datetime .now ()
173
173
from_timestamp = (to_timestamp - timedelta (seconds = args .duration ))
174
174
last_log_timestamp = from_timestamp
175
175
log_ids = set () # to avoid duplicate logs
176
176
max_entries = args .tail
177
177
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 )
179
180
if status_code != 200 :
180
181
print (f"{ status_code } : { msg } " )
181
182
exit (status_code )
@@ -190,7 +191,7 @@ def get_deployment_log(args):
190
191
191
192
if not args .follow :
192
193
break
193
-
194
+
194
195
time .sleep (10 )
195
196
from_timestamp = last_log_timestamp
196
197
to_timestamp = datetime .now ()
0 commit comments