Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TTL (Time To Live) value for services. #148

Merged
merged 1 commit into from
Jul 25, 2017

Conversation

billfitzgerald0120
Copy link
Contributor

@billfitzgerald0120 billfitzgerald0120 commented Jul 20, 2017

Allow specifying the length of time to allow the check_completed step to run in the generic service state-machines.
This will allow long running processes to finish.

UI changes are needed for this.

https://www.pivotaltracker.com/n/projects/1937537/stories/147361947
https://bugzilla.redhat.com/show_bug.cgi?id=1459735

@miq-bot add_label enhancement, services
@miq-bot assign @gmcculloug

@billfitzgerald0120
Copy link
Contributor Author

@tinaafitz Please Review

@@ -17,6 +17,7 @@ def main
@handle.log('info', msg)
@handle.create_notification(:level => 'info', :subject => service, :message => msg)
@handle.root['ae_result'] = 'ok'
check_interval
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not call this method check_interval since it is setting, not checking and the name does not clarify what type of interval. A better name would be calculate_retry_internal and reduce the method to just returning the integer value.

This line would become:
@handle.root['ae_retry_interval'] = calculate_retry_internal

@@ -30,6 +31,17 @@ def service
end
end

def check_interval
return unless @handle.root['ae_retry_ttl']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tinaafitz @billfitzgerald0120 This logic is not taking the current generic state-machine action into account. Is this value being populated during an automate instance resolution?

If the value is coming straight from the service_template (or service) config settings I would not expect it to have the ae_ prefix.

def check_interval
return unless @handle.root['ae_retry_ttl']

interval = @handle.root['ae_retry_ttl'] / @handle.root['ae_state_max_retries']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should ensure that both of these values are integers. (.to_i) The ae_state_max_retries value is an optional value for a state machine step, what value would we end up with here when it is blank? Divide by zero? 💥

@billfitzgerald0120
Copy link
Contributor Author

@gmcculloug Made changes as requested, please review

@billfitzgerald0120
Copy link
Contributor Author

@tinaafitz
Please Review

Copy link
Member

@tinaafitz tinaafitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@billfitzgerald0120 Looks good.
@gmcculloug Please review.


def retry_interval
ttl = playbook_ttl
return if ttl.zero? || @handle.root['ae_state_max_retries'].zero?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving @handle.root['ae_state_max_retries'] into a variable will make this method easier to read.

def retry_interval
  ttl = playbook_ttl
  max_retry_count = @handle.root['ae_state_max_retries']

  return if ttl.zero? || max_retry_count.zero?
  ...

Allow specifying the length of time to allow the check_completed step to run in the generic service state-machines.
This will allow long running processes to finish.

UI changes are needed for this.

https://www.pivotaltracker.com/n/projects/1937537/stories/147361947
@miq-bot
Copy link
Member

miq-bot commented Jul 25, 2017

Checked commit billfitzgerald0120@6199d78 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 👍

@gmcculloug gmcculloug merged commit 148e5a6 into ManageIQ:master Jul 25, 2017
@gmcculloug gmcculloug added this to the Sprint 66 Ending Aug 7, 2017 milestone Jul 25, 2017
billfitzgerald0120 added a commit to billfitzgerald0120/manageiq-content that referenced this pull request Aug 4, 2017
Allow specifying the length of time to allow the check_completed step to run in the generic service state-machine.
This will allow long running processes to finish.

UI changes done.

https://www.pivotaltracker.com/n/projects/1937537/stories/147361947
https://bugzilla.redhat.com/show_bug.cgi?id=1459735

Initial PR: ManageIQ#148
Moved interval calculations from start to check_completed.

@miq-bot add_label enhancement, services
@miq-bot assign @gmcculloug
billfitzgerald0120 added a commit to billfitzgerald0120/manageiq-content that referenced this pull request Aug 4, 2017
Allow specifying the length of time to allow the check_completed step to run in the generic service state-machine.
This will allow long running processes to finish.

UI changes done.

https://www.pivotaltracker.com/n/projects/1937537/stories/147361947
https://bugzilla.redhat.com/show_bug.cgi?id=1459735

Initial PR: ManageIQ#148
Moved interval calculations from start to check_completed.

@miq-bot add_label enhancement, services
@miq-bot assign @gmcculloug
billfitzgerald0120 added a commit to billfitzgerald0120/manageiq-content that referenced this pull request Aug 7, 2017
Allow specifying the length of time to allow the check_completed step to run in the generic service state-machine.
This will allow long running processes to finish.

UI changes done.

https://www.pivotaltracker.com/n/projects/1937537/stories/147361947
https://bugzilla.redhat.com/show_bug.cgi?id=1459735

Initial PR: ManageIQ#148
Moved interval calculations from start to check_completed.
simaishi pushed a commit that referenced this pull request Aug 8, 2017
Support TTL (Time To Live) value for services.
(cherry picked from commit 148e5a6)

https://bugzilla.redhat.com/show_bug.cgi?id=1479407
@simaishi
Copy link
Contributor

simaishi commented Aug 8, 2017

Fine backport details:

$ git log -1
commit e972d62a545db0908eb7f7b9f81e267c1665249e
Author: Greg McCullough <[email protected]>
Date:   Tue Jul 25 16:00:53 2017 -0400

    Merge pull request #148 from billfitzgerald0120/timetolive
    
    Support TTL (Time To Live) value for services.
    (cherry picked from commit 148e5a681762fe62e32cccd0768b6e97d7e696e1)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1479407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants