-
Notifications
You must be signed in to change notification settings - Fork 18
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
Modify p4studio interactive to use limited parallel jobs #78
Merged
jafingerhut
merged 16 commits into
p4lang:main
from
jafingerhut:modify-p4studio-interactive-to-use-limited-parallel-jobs
Feb 20, 2025
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
39d35f3
Enable batch-install.sh to run on Ubuntu 22.04
jafingerhut ecc22c1
Merge remote-tracking branch 'upstream/main' into main
jafingerhut 5f5c312
Merge branch 'main' of https://github.com/p4lang/open-p4studio into main
jafingerhut 113e4f1
Merge branch 'main' of https://github.com/p4lang/open-p4studio
jafingerhut 4becb30
Merge branch 'main' of github.com:jafingerhut/open-p4studio
jafingerhut d94cdd5
Merge branch 'main' of https://github.com/p4lang/open-p4studio
jafingerhut 5a28bf0
Merge branch 'main' of https://github.com/p4lang/open-p4studio
jafingerhut 14807ca
Merge remote-tracking branch 'upstream/main'
jafingerhut 38a5340
Merge remote-tracking branch 'upstream/main' into main
jafingerhut 09b4a9c
Merge branch 'main' of https://github.com/p4lang/open-p4studio into main
jafingerhut 2f3cf06
Merge branch 'main' of https://github.com/p4lang/open-p4studio into main
jafingerhut f7ea382
Merge remote-tracking branch 'up/main'
jafingerhut 7533bd6
Merge branch 'main' of https://github.com/p4lang/open-p4studio into main
jafingerhut ce6ab36
Merge branch 'main' of https://github.com/p4lang/open-p4studio into main
jafingerhut 4798fe8
Fix #77 Limit parallel jobs used during command 'p4studio interactive'
jafingerhut dfabc14
Force CI to use `nproc` parallel jobs
jafingerhut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be an argument from the previous calculation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry, but I do not understand the comment. The new first line of
build_sde
calculates and stores a value in variablejobs
. The second line callsProfileExecutionPlan
, with the 3rd parameter beingjobs
instead ofos.cpu_count()
.What are you recommending I change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open-p4studio/p4studio/profile/profile_command.py
Line 215 in c5c4e98
this calculation is already done here, no? Ideally, we should only do this once and then reuse the result in other contexts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case it is not obvious: the code in this file is run if you do a command
p4studio interactive
, which is what theinstall.sh
bash script invokes. If you do this, the other Python source file that has the definition ofcalculate_jobs_from_available_cpus_and_memory
has none of its code executed at all, unless it is explicitly called from somewhere in this file. That is what this change is adding -- an explicit call from this file into the function defined in the other file, that calculates a reasonable number of parallel jobs to use.This is not a repeated call of that function in this code path. It is the only one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the common ancestor between the profile and the interactive command? I was thinking that this ancestor should call the function, then pass the result to either one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the common ancestor is some
click
module Python code that parses some command line arguments, and decides via click annotations on Python methods which function to invoke. If you dop4studio profile <some args>
on the command line, it invokes a method in the fileprofile_command.py
. If you dop4studio interactive
, it iknvokes a method in this file being modified.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this line early in this file:
There is an
execute_plan
function called from bothprofile_command.py
andinteractive_command.py
that is doing most of the work of building and installing the software. Whoever wrote this code decided to define it inprofile_command.py
and call it from here, rather than puttingexecute_plan
in some common 3rd file and calling it from both places. I'm not adding new code flows that didn't exist between files already here. I'm adding one more cross-file call where there was already a more significant one before.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think we can leave it there then. It seems like checks like these should be set from both workflows, but it may be that the interactive command has less restrictions and doesn't even invoke system checks or common code.