@@ -520,7 +520,7 @@ def execute_query(query, properties = {})
520520 return r
521521 end
522522
523- def restart
523+ def restart_basic
524524 @ml_username = @properties [ 'ml.bootstrap-user' ] || @properties [ 'ml.user' ]
525525 if @ml_username == @properties [ 'ml.bootstrap-user' ]
526526 @ml_password = @properties [ 'ml.bootstrap-password' ]
@@ -556,6 +556,43 @@ def restart
556556 return true
557557 end
558558
559+ # implemented verified restart
560+ def restart
561+ verify = find_arg ( [ '--verify' ] )
562+ if verify ==='false'
563+ restart_basic
564+ else
565+ # defaults to verified restart
566+ old_timestamp = go ( %Q{http://#{ @properties [ "ml.server" ] } :8001/admin/v1/timestamp} , "get" ) . body
567+ restart_basic
568+ retry_count = 0
569+ retry_max = 5
570+ retry_interval = 10
571+ new_timestamp = old_timestamp
572+ while retry_count < retry_max do
573+ begin
574+ new_timestamp = go ( %Q{http://#{ @properties [ "ml.server" ] } :8001/admin/v1/timestamp} , "get" ) . body
575+ rescue
576+ logger . info 'Verifying restart ...'
577+ logger . debug 'Retry attempt ' + retry_count . to_s + ' failed'
578+ end
579+ if new_timestamp != old_timestamp
580+ # indicates that restart is confirmed successful
581+ break
582+ end
583+ logger . debug "Verifying restart..."
584+ sleep retry_interval
585+ retry_count += 1
586+ end
587+ if new_timestamp == old_timestamp
588+ logger . warn "Could not verify restart"
589+ else
590+ logger . info 'Verified restart.'
591+ logger . debug "Verified restart new #{ new_timestamp } old #{ old_timestamp } "
592+ end
593+ end
594+ end
595+
559596 def merge
560597 what = ARGV . shift
561598 raise HelpException . new ( "merge" , "Missing WHAT" ) unless what
0 commit comments