-
Notifications
You must be signed in to change notification settings - Fork 2
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 optional python and r section attributes #2568
Conversation
…nfiguration initialization if told to. This will return new configs with empty sections (signaling to use defaults from interpreters), but still allow testing.
… config to fill in the missing pieces using the active interpreters (in config.FromFile)
…sing the active interpreters
…vs. Python), since they are only strings by nature and order in the call functions can get very messed up.
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'll note that we should definitely change the Configuration file reference document as part of this PR since this will make the Python settings and R settings sections out of date.
…n-and-r-section-attributes-2
I pushed up an update! |
get( | ||
configName: string, | ||
dir: string, | ||
r: RExecutable, | ||
python: PythonExecutable, | ||
) { |
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.
Could you elaborate more on why it is required to send an R and Python executables to get a configuration? Shouldn't the configuration response be what the existing file contains?
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.
but when it is passed around internally (and retrieved by the UX), that it have the current defaults inserted into the config object.
As a part of keeping this PR as narrow as possible we didn't change the behavior in the API and frontend.
Currently in main
the defaults are inserted into the response even if the file doesn't have those attributes set (like the packageFile = 'requirements.txt
settings). Rather than changing both the backend and frontend here we kept the API behavior the same.
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 I understand the reason of having the resulting config in the UI to have some defaults, but it feels confusing the way it is being handled.
This method is one of many that now accepts R and Python executables, but feels out of place, for example the getPythonPackages
calling configurations/{name}/packages/python
also accepts an R
executable, and I find it confusing for future folks to have a method responsible to get python packages to accept an R executable.
The go
method FromFile
now accepts overriding defaults as activeRInterpreter
and activePythonInterpreter
, and we are now having a method that at first look suggests to load the configuration as it is on file, but consumers of it could find surprises from it.
My suggestion would be, to take a step back a bit and think how these signatures bring clarity or confusion to future folks working on this, specifically from the point that future folks might not have all the context on how this works or the history behind this.
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.
Great point. The effort here was to avoid making changes on the frontend, but creating confusion by needing to pass in the Python and R executables everywhere is confusing.
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.
The go method FromFile now accepts overriding defaults as activeRInterpreter and activePythonInterpreter
To clarify, it's not overriding defaults but actually implementing them. The defaults come from the active interpreters, passed in at the time of the API request. Our current architecture requires all the levels of calls to pass these down into the deepest functions that need it. Unfortunately, that is very deep in this case.
I understand about the confusion. Let me think about this, and I'll signal for another review. Thanks.
I've thought about the approach used in this PR and I've concluded that we introduced confusion because we were attempting to not modify the extension UX. I'm going to update the related issue with our learnings, so that we can implement something else here. I'll be closing this PR without merging. |
Intent
The changes within this PR support the initialization of config files to have default attributes associated with R and Python dependencies, allowing the sections to be empty within the config file. When values are present, they are used by the back end, but when they are not present, the current values from the active interpreters are used, as the deployment manifest is built from the config file.
Resolves #2468
Resolves #2470
Type of Change
Approach
To implement this functionality, it is important to have the config file written out without the attributes, but when it is passed around internally (and retrieved by the UX), that it have the current defaults inserted into the config object. Since the UX only patches the config file, it is important that the handling code really does "patch" rather than replace the object to disk (which would write out the defaults, which then become user-provided values).
To support the insertion of the defaults internally, some of the APIs needed to be updated to pass in the active interpreters. The insertion has been isolated into one specific spot; the point at which the code builds the config object from the file.
Since so many locations in the codebase are now using the interpreters, I've also modified the method in which they are initialized. Rather than pass around the executable string, the particular interpreter is built from that executable string, and then passed around to be used where needed. This is important to be done at the API level, so that when a user changes their selection or settings for the active interpreters are picked up at the next API call.
User Impact
New feature: The scenario goes like this:
Automated Tests
Unit tests updated.
Directions for Reviewers
Best to review this PR via commits. The list of commits have been updated to describe the changes.
Checklist