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

Simplify execution requirements calculation in k6 inspect #2409

Merged
merged 1 commit into from
Mar 7, 2022
Merged

Conversation

na--
Copy link
Member

@na-- na-- commented Mar 5, 2022

I tried to read #1048 and honestly got lost in more than a few places... However, I am pretty sure this simplification is safe from reading through the code and thinking logically about it. There is no reason to create a runner and an execution scheduler to get the execution requirements a script. It should be enough to derive the scenarios and just use their GetFullExecutionRequirements() method, that's exactly what the execution scheduler does, after all... 😅

executionPlan := options.Scenarios.GetFullExecutionRequirements(et)

Anyway, tagged this as v0.38.0 since it doesn't really matter, but we should probably not introduce changes like this right before the release, even if they should not really change anything 😅 🤞

@na-- na-- added this to the v0.38.0 milestone Mar 5, 2022
@na-- na-- changed the title Simplify requirements calculation in k6 inspect Simplify execution requirements calculation in k6 inspect Mar 5, 2022
Base automatically changed from cleanup-1 to master March 7, 2022 11:57
Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

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

👍🏻 besides a few non-blocking documentation-related coments 😸

cmd/inspect.go Show resolved Hide resolved
@na-- na-- changed the base branch from master to next March 7, 2022 15:56
Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

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

LGTM, just a minor request

@@ -347,9 +347,10 @@ func (r *Runner) GetOptions() lib.Options {

// IsExecutable returns whether the given name is an exported and
// executable function in the script.
//
// TODO: completely remove this?
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// TODO: completely remove this?
// TODO: Bundle.IsExecutable is now available,
// it should be used directly and this method removed

I think we could be a bit lost if we read the comment from outside of the context of this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I am not sure if we can remove this without a lot more refactoring 🤔 Bundle.IsExecutable is not available everywhere as a substitute... 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

oh true, I always forgot about the Runner interface. Should we remove the comment? 🤔 It seems not really possible with the current code.

Copy link
Member Author

Choose a reason for hiding this comment

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

I dug a little more here and realized that the need for the public method in Bundle disappears because of the other simplifications I did in #2412 with loadedTest 🎉 So I ended up reverting this part of the change there, see c3fec32

I think it's fine to merge this as it is and remove it in the other PR, given that it allows us to merge these PRs one by one instead of all at once.

@na-- na-- merged commit 0a21f8f into next Mar 7, 2022
@na-- na-- deleted the cleanup-2 branch March 7, 2022 16:43
@yorugac
Copy link
Contributor

yorugac commented Mar 8, 2022

@na-- post-factum just in case 🙂
I think this is a nice neat change 👍 And together with other cmd PRs yes, looks like a first step to #1048

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.

4 participants