Skip to content

RHELMISC-4745: Add ability to bring up previous session #487

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jedoku
Copy link
Contributor

@Jedoku Jedoku commented Oct 7, 2024

WIP

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from a94ca1f to 71d5c6c Compare October 8, 2024 22:29
@akihikodaki
Copy link
Contributor

I'm not a fan of this idea. It brings significant complexity similar to --dump, which adds an alternative way to run tests.
Its use case is also unclear; I often repeatedly run tests using the command line history and I'm satisfied with it.

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 71d5c6c to 7e1ff8a Compare October 18, 2024 15:48
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 7e1ff8a to 8a79a7e Compare November 27, 2024 13:14
@Jedoku Jedoku requested a review from akihikodaki December 1, 2024 00:10
@Jedoku Jedoku changed the title RFC: Bring up previous session Bring up previous session Dec 2, 2024
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 8a79a7e to 0ba68bc Compare December 19, 2024 08:54
@Jedoku Jedoku requested a review from akihikodaki December 19, 2024 09:06
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from 72f53ca to dd5ec70 Compare January 22, 2025 09:01
@Jedoku Jedoku requested a review from akihikodaki January 22, 2025 11:17
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from a63b74b to 0f480a0 Compare January 30, 2025 03:51
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 0f480a0 to df1cc61 Compare January 31, 2025 00:09
Copy link
Contributor

@akihikodaki akihikodaki left a comment

Choose a reason for hiding this comment

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

The current implementation will leave an immature session if an error happens before clients get configured. Save the session after it is fully initialized (i.e., all clients are configured).

@Jedoku
Copy link
Contributor Author

Jedoku commented Jan 31, 2025

The current implementation will leave an immature session if an error happens before clients get configured. Save the session after it is fully initialized (i.e., all clients are configured).

But this is one of features, you can bring up VM`s for checking what's goin on and where it's crash

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from df1cc61 to 1684f10 Compare January 31, 2025 10:02
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds the ability to bring up a previous session by introducing session management and adjusting workspace and client configuration flows accordingly. Key changes include:

  • Introducing a new Session model (lib/session.rb) with save/load functionality.
  • Updating project initialization and workspace restoration logic (lib/project.rb and related files).
  • Extending CLI options to support session-related arguments and refining client and test configurations based on session status.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/setupmanagers/qemuhck/qemu_machine.rb Added "configured" flag to the machine options hash and adjusted instance variable usage.
lib/setupmanagers/hckstudio.rb Early return added when project is restored to prevent redundant pool creation.
lib/setupmanagers/hckclient.rb Modified client configuration logic to account for a restored session condition.
lib/session.rb New Session model added, providing save and load methods for session management.
lib/project.rb Updated initialization to accept a session, introduced workspace restore and save.
lib/engines/hcktest/tools.rb Modified conditional expression for results handling (potential issue identified).
lib/engines/hcktest/tests.rb Removed an extraneous blank line.
lib/engines/hcktest/hcktest.rb Adjusted restored session handling, updated snapshot options, and refined test logic.
lib/cli.rb Refactored CLI options using T::Struct and added session parameters.
lib/all.rb Added autoload for the new Session module.

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from b6b7346 to 76061d7 Compare April 29, 2025 11:22
@Jedoku Jedoku requested a review from akihikodaki April 29, 2025 11:25
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 76061d7 to ca47498 Compare May 25, 2025 17:48
@Jedoku Jedoku requested a review from akihikodaki May 25, 2025 18:58
Copy link
Contributor

@akihikodaki akihikodaki left a comment

Choose a reason for hiding this comment

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

Please look at unresolved comments:

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from 808104f to 7158cf5 Compare May 26, 2025 20:54
@Jedoku Jedoku requested a review from akihikodaki May 26, 2025 21:04
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 7158cf5 to af17bd2 Compare May 29, 2025 01:37
@Jedoku Jedoku requested a review from akihikodaki May 29, 2025 01:38
@@ -249,12 +250,24 @@ def prepare_tests
@project.logger.info('HLK test target is not defined, allow in manual mode')
end

@tests.verify_target if @project.restored?
Copy link
Contributor

Choose a reason for hiding this comment

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

What is it for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually don't clearly remember it but, i think it was some error relatet to target creation back then
Anyway it's works without it now

Copy link
Contributor

Choose a reason for hiding this comment

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

The new version removed the condition, but @tests.verify_target is still there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I, [2025-05-29T09:11:23.184397 #1941716]  INFO -- CmdRun PID:1943108: Command finished with code 0
F, [2025-05-29T09:11:23.184889 #1941716] FATAL -- : (NoMethodError) undefined method `[]' for nil
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/engines/hcktest/tests.rb:61:in `update_tests'
   -- /home/jedoku/HCK/repos/AutoHCK.git/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.12020/lib/types/private/methods/call_validation.rb:282:in `bind_call'
   -- /home/jedoku/HCK/repos/AutoHCK.git/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.12020/lib/types/private/methods/call_validation.rb:282:in `validate_call'
   -- /home/jedoku/HCK/repos/AutoHCK.git/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.12020/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/engines/hcktest/hcktest.rb:253:in `prepare_tests'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/engines/hcktest/hcktest.rb:281:in `block in run_tests_without_config'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:29:in `block (2 levels) in open'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:28:in `handle_interrupt'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:28:in `block in open'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:27:in `handle_interrupt'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:27:in `open'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/engines/hcktest/hcktest.rb:279:in `run_tests_without_config'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/engines/hcktest/hcktest.rb:271:in `block in auto_run'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:29:in `block (2 levels) in open'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:28:in `handle_interrupt'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:28:in `block in open'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:27:in `handle_interrupt'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:27:in `open'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/engines/hcktest/hcktest.rb:267:in `auto_run'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/engines/hcktest/hcktest.rb:329:in `run'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/project.rb:48:in `run'
   -- bin/auto_hck:30:in `block (2 levels) in <module:AutoHCK>'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:29:in `block (2 levels) in open'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:28:in `handle_interrupt'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:28:in `block in open'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:27:in `handle_interrupt'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auxiliary/resource_scope.rb:27:in `open'
   -- bin/auto_hck:27:in `block in <module:AutoHCK>'
   -- /home/jedoku/HCK/repos/AutoHCK.git/lib/auto_hck.rb:14:in `run'
   -- bin/auto_hck:9:in `<module:AutoHCK>'
   -- bin/auto_hck:8:in `<main>'
D, [2025-05-29T09:11:23.185073 #1941716] DEBUG -- : Closing AutoHCK project

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's why it was there

Copy link
Contributor

Choose a reason for hiding this comment

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

The log indicates the underlying problem is that HCKClient#add_target_to_project is not called because
configure_and_synchronize_clients is skipped. Letting configure_and_synchronize_clients call HCKClient#add_target_to_project would be a proper fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Project was configured once and already has target, it'll cause error if we trying to add new one

Copy link
Contributor

Choose a reason for hiding this comment

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

Right. We need another method to call search_target instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's wrong with verify_target?

Copy link
Contributor

Choose a reason for hiding this comment

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

There are a few problems:

  • It is unclear why verify_target is needed. If we call search_target from configure_and_synchronize_clients, it will be obvious that it is compensating the operations skipped in configure_and_synchronize_clients.
  • It doesn't update HCKClient#target, which is supposed not to be nil.
  • It calls Playlist#update_target, which is unnecessary if the target is not nil in the first place.

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from af17bd2 to dd1caeb Compare May 29, 2025 05:03
@Jedoku Jedoku requested a review from akihikodaki May 29, 2025 05:04
Copy link
Contributor

@akihikodaki akihikodaki left a comment

Choose a reason for hiding this comment

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

Two of the last comments are not addressed.

@Jedoku
Copy link
Contributor Author

Jedoku commented May 29, 2025

Two of the last comments are not addressed.

@Jedoku Jedoku closed this May 29, 2025
@Jedoku Jedoku reopened this May 29, 2025
@Jedoku Jedoku requested a review from akihikodaki May 29, 2025 05:27
Copy link
Contributor

@akihikodaki akihikodaki left a comment

Choose a reason for hiding this comment

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

I replied to the comments so please check them out.

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from 3daf6f0 to 52ca3a4 Compare May 29, 2025 06:53
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 52ca3a4 to 74c4785 Compare June 9, 2025 22:58
@Jedoku Jedoku requested a review from akihikodaki June 9, 2025 22:59
@akihikodaki akihikodaki removed their request for review June 10, 2025 08:59
@akihikodaki akihikodaki dismissed their stale review June 10, 2025 09:01

Please ask @kostyanf14 for further review.

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

Successfully merging this pull request may close these issues.

3 participants