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

Fixes #21118 - Verify if there are no any running tasks #114

Merged
merged 1 commit into from
Oct 18, 2017

Conversation

kgaikwad
Copy link
Member

No description provided.

failure_message(task_count),
:next_steps =>
[Procedures::ForemanTasks::Resume.new,
Procedures::ForemanTasks::UiInvestigate.new('search_query' => 'state = paused')])
Copy link
Member

Choose a reason for hiding this comment

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

The search query should be state = running, shouln't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, actually!!

assert(task_count == 0,
failure_message(task_count),
:next_steps =>
[Procedures::ForemanTasks::Resume.new,
Copy link
Member

Choose a reason for hiding this comment

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

The resume is not valid for running tasks. We could have a procedure, that polls and waits for the tasks to finish.

Copy link
Member Author

Choose a reason for hiding this comment

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

In the running_tasks_count, I have mentioned filter state field should be either running or paused. That's why I mentioned this step.

Should I remove paused from state filter values?

Copy link
Member Author

Choose a reason for hiding this comment

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

@iNecas ,

I have queries regarding this:

  • Do we need to set any timeout for this procedure to exit? Or we really need to wait till all tasks to finish.
  • What interval should we set before retrying status of tasks?

Copy link
Member

Choose a reason for hiding this comment

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

We have the ForemanTasks::NotPaused check for the paused, so this should be for running only.

Having a timeout is a good idea. I would suggest something around 5 minutes for start.

For the retry interval, I would go for every 10 seconds, as it's not very expensive operation.

Copy link
Member Author

@kgaikwad kgaikwad Oct 18, 2017

Choose a reason for hiding this comment

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

@iNecas ,
Is it okay if I change order for NotRunning check as it is showing after NotPaused check?

I know that it is a rare situation where any running task which will get paused somehow in NotRunning check. But in that scenario it will proceed with upgrade.

I have pushed the changes but they are incomplete. I just saw your comments.
I will update PR.

@kgaikwad kgaikwad force-pushed the 21118_detect_if_no_running_tasks branch 2 times, most recently from 5c3231f to 6012b93 Compare October 18, 2017 08:19
@kgaikwad
Copy link
Member Author

@iNecas ,

Updated the PR with timeout of 5 mins and interval of 10 sec.
Ready for review!

end

def run
with_spinner("wait till #{@state} tasks get finish") do |spinner|
Copy link
Member

Choose a reason for hiding this comment

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

till is quite informal, let's use until instead. I would also recommend using ing from, as we are describing, what's happening at the moment, and instead of get finish, it would sound better to me to waiting for 2 tasks to finish or waiting until tasks get finished.

I would recommend waiting for #{@state} tasks to finish

failure_message(task_count),
:next_steps =>
[Procedures::ForemanTasks::FetchTasksStatus.new(:state => 'running'),
Procedures::ForemanTasks::UiInvestigate.new('search_query' => 'state = running')])
Copy link
Member

@iNecas iNecas Oct 18, 2017

Choose a reason for hiding this comment

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

The search query should be state = running AND label !^(#{Features::ForemanTasks::EXCLUDE_ACTIONS_FOR_RUNNING_TASKS.join(" ")})

Copy link
Member

Choose a reason for hiding this comment

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

The UiInvestigate procedure is using press ENTER after the paused tasks are resolved wording, which is not precise for this case. Using press ENTER after the tasks are resolved would be matching both running and paused tasks.

Copy link
Member Author

@kgaikwad kgaikwad Oct 18, 2017

Choose a reason for hiding this comment

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

Good catch!! 👍

@kgaikwad kgaikwad force-pushed the 21118_detect_if_no_running_tasks branch from 6012b93 to 0d54f38 Compare October 18, 2017 14:03
@kgaikwad
Copy link
Member Author

@iNecas ,

Sorry for small mistakes.
Updated PR as per suggested changes. Ready for review.

@kgaikwad kgaikwad force-pushed the 21118_detect_if_no_running_tasks branch from 0d54f38 to 7b8d45b Compare October 18, 2017 14:11
@iNecas
Copy link
Member

iNecas commented Oct 18, 2017

Thanks @kgaikwad, tested and works well. Merging and will release a new version. Enjoy the holiday!

@iNecas iNecas merged commit b69fef1 into theforeman:master Oct 18, 2017
@kgaikwad
Copy link
Member Author

Thank you !! 😊
Yes, now we can release new version 👍

@iNecas
Copy link
Member

iNecas commented Oct 19, 2017

0.0.10 is out now

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.

None yet

2 participants