Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Timestamp-verified restart #703

@kford-oconnors

Description

@kford-oconnors

A restart function that verifies the restart was successful. Convenient for build scripts. Based on this example.

  def verified_restart
    old_timestamp = go(%Q{http://#{@properties["ml.server"]}:8001/admin/v1/timestamp}, "get").body
    restart
    retry_count = 0
    retry_max = 5
    retry_interval= 10
    new_timestamp = old_timestamp
    while retry_count < retry_max do
      begin
        new_timestamp = go(%Q{http://#{@properties["ml.server"]}:8001/admin/v1/timestamp}, "get").body
      rescue
        logger.debug 'Retry attempt ' + retry_count.to_s + ' failed'
      end
      if new_timestamp != old_timestamp
        logger.info 'Verfied restart.'
        break
      end
      logger.debug "Verifying restart..."
      sleep retry_interval
      retry_count += 1
    end
    if new_timestamp == old_timestamp
      logger.warn "Could not verify restart"
    end
  end
end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions