-
Notifications
You must be signed in to change notification settings - Fork 58
added feature for default networking and flexible shapes on create_no… #1277
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
base: main
Are you sure you want to change the base?
Conversation
…tebook_session. Related to FR:1276
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
ads/catalog/notebook.py
Outdated
compartment_id=self.compartment_id, | ||
notebook_session_configuration_details=notebook_session_configuration_details, | ||
) | ||
|
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.
thanks @HarrySnart for the PR. I was checking the difference between NotebookSessionConfigurationDetails and NotebookSessionConfigDetails, and it looks it their implementation is exactly the same - not sure why it is replicated. We can just use 1 of them to avoid any confusion. Also, we can simplify the notebook config creation with something like this:
...
...
# build configuration kwargs
config_kwargs = dict(
shape=shape,
block_storage_size_in_gbs=block_storage_size_in_gbs,
)
if subnet_id:
config_kwargs["subnet_id"] = subnet_id
if private_endpoint_id:
config_kwargs["private_endpoint_id"] = private_endpoint_id
if ocpus is not None and memory_in_gbs is not None:
config_kwargs["notebook_session_shape_config_details"] = NotebookSessionShapeConfigDetails(ocpus=ocpus, memory_in_gbs=memory_in_gbs)
# single config object
notebook_cfg = NotebookSessionConfigurationDetails(**config_kwargs)
# create request details
create_notebook_details = CreateNotebookSessionDetails(
display_name=display_name,
project_id=project_id,
compartment_id=self.compartment_id,
notebook_session_configuration_details=notebook_cfg,
)
try:
create_notebook_response = self.ds_client.create_notebook_session(...
...
...
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.
Thanks @VipulMascarenhas , sorry for the delayed response. I think one NotebookSessionConfigurationDetails was added before NotebookSessionConfigDetails when subnet id was still mandatory. Looking at the API doc subnet id is still listed as a mandatory param under NotebookSessionConfigurationDetails. Thanks for your suggestions, they look good, the only difference is to use NotebookSessionConfigDetails instead of NotebookSessionConfigurationDetails and also to make block storage size an optional param as per the API doc. I've pushed the changes back to the branch on my fork
Enhancement to create_notebook_session. Related to FR:1276
This enhancement adds the ability for users to use a flexible shape, by specifying ocpus and memory_in_gbs and also makes subnet_id optional. If no subnet_id is specified the notebook is provisioned with default networking. This has been unit tested locally with my own tenancy with the below tests:
from ads.catalog import notebook
notebook_catalog = NotebookCatalog(compartment_id = "ocid1...")
standard shape, specified subnet
test1 = notebook_catalog.create_notebook_session(display_name='dev-1',project_id='ocid1...',shape="VM.Standard2.1",block_storage_size_in_gbs=50,subnet_id='ocid1...')
standard shape, default netorking
test2 = notebook_catalog.create_notebook_session(display_name='dev-2',project_id='ocid1...',shape="VM.Standard2.1",block_storage_size_in_gbs=50)
flexible shape, specified subnet
test3 = notebook_catalog.create_notebook_session(display_name='dev-3',project_id='ocid1...',shape="VM.Standard.E4.Flex",ocpus = 2,memory_in_gbs = 16,block_storage_size_in_gbs=50,subnet_id='ocid1...')
flexible shape, default networking
test4 = notebook_catalog.create_notebook_session(display_name='dev-4',project_id='ocid1...',shape="VM.Standard.E4.Flex",ocpus = 2,memory_in_gbs = 16,block_storage_size_in_gbs=50)
All four notebook sessions have then been created successfully in my tenancy