-
Notifications
You must be signed in to change notification settings - Fork 47
[DRCC][AQUA] Completely Removing OSS bucket config dependency #1147
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
[DRCC][AQUA] Completely Removing OSS bucket config dependency #1147
Conversation
ads/aqua/__init__.py
Outdated
@@ -41,5 +40,5 @@ def set_log_level(log_level: str): | |||
set_auth("resource_principal") | |||
|
|||
ODSC_MODEL_COMPARTMENT_OCID = ( | |||
os.environ.get("ODSC_MODEL_COMPARTMENT_OCID") or fetch_service_compartment() | |||
os.environ.get("ODSC_MODEL_COMPARTMENT_OCID") or "ODSC_MODEL_COMPARTMENT_OCID" |
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'm not sure that I understand this logic. In one case we return the value of the ODSC_MODEL_COMPARTMENT_OCID env var, but if it is not defined we just return the name of the env var?
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.
Currently , service model compartment ocid is used as a key to cache service model list response. Now since we won't be fetching this compartment id in ADS from container_index.json , just replaced it with constant string.
If we explicitly set this compartment ocid via NB environment variables , then corresponding ocid will be used as key.
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.
Should we just remove ODSC_MODEL_COMPARTMENT_OCID
?
I need to check if we can still use non prod backend for fetching service models list incase we do that since this is only place i feel this env variable is being used.
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.
Here i'm not sure. My vote would be for removing this variable, but @VipulMascarenhas might have a different opinion. We might use this env variable to identify if the model is service or a custom 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.
Tested the flow after removing ODSC_MODEL_COMPARTMENT_OCID
. Seems like we don't need this env variable for fetching service models even for non prod backend. The new List models API would take care of it.
We can rename the key for storing service models list response in cache.
So , everything seems fine except there is only once place this is being used where i am not sure it is safe to remove.
CC: @VipulMascarenhas
if service_model.compartment_id != ODSC_MODEL_COMPARTMENT_OCID:
logger.info(
f"Aqua Model {model_id} already exists in the user's compartment."
"Skipped copying."
)
return service_model
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.
Is it safe to remove this condition?
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.
Replaced it with
# Skip model copying if it is registered model
if service_model.freeform_tags.get(Tags.BASE_MODEL_CUSTOM) is not None:
logger.info(
f"Aqua Model {model_id} already exists in the user's compartment."
"Skipped copying."
)
return service_model
ads/aqua/extension/utils.py
Outdated
@@ -41,14 +40,14 @@ def ui_compatability_check(): | |||
"""This method caches the service compartment OCID details that is set by either the environment variable or if | |||
fetched from the configuration. The cached result is returned when multiple calls are made in quick succession | |||
from the UI to avoid multiple config file loads.""" | |||
return ODSC_MODEL_COMPARTMENT_OCID or fetch_service_compartment() | |||
return ODSC_MODEL_COMPARTMENT_OCID |
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.
Do we really need this compatibility check method now?
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.
Yes , can be removed.
Will remove
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.
Updated. Thanks
@@ -39,19 +36,8 @@ def process(self) -> Union[AdsVersionResponse, CompatibilityCheckResponse]: | |||
) | |||
return response | |||
if request.get("kind") == "CompatibilityCheck": | |||
if ui_compatability_check(): |
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.
if this always returns ok, does UI need to call this? This won't be needed, right?
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.
This is compatibility check handler implemented in websockets. We call the one implemented via HTTP. Both the methods should return ok always as we decide to enable AQUA everywhere.
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.
Yes , we can remove calling this API in UI. I kept it since may be in future we can add some sort of AQUA enabling logic based on CP config. Are you suggesting we removing this api alltogether from ADS?
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.
Updated. Thanks
ads/aqua/model/model.py
Outdated
if service_model.compartment_id != ODSC_MODEL_COMPARTMENT_OCID: | ||
|
||
# Skip model copying if it is registered model | ||
if service_model.freeform_tags.get(Tags.BASE_MODEL_CUSTOM) is not None: |
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.
can freeform_tags be None? I don't think it's going happen for aqua models, but can we add a check here to return appropriate error instead if for some reason these tags are empty.
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.
Will update.
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.
Updated. Thanks
ads/aqua/model/model.py
Outdated
logger.info( | ||
f"Returning service models list in {ODSC_MODEL_COMPARTMENT_OCID} from cache." | ||
f"Returning service models list in {AQUA_SERVICE_MODELS} from cache." |
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.
nit: might be good to just log this as Returning service models list from cache.
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.
Updated. Thanks
ads/aqua/model/model.py
Outdated
logger.info("Fetching service models.") | ||
lifecycle_state = kwargs.pop( | ||
"lifecycle_state", Model.LIFECYCLE_STATE_ACTIVE | ||
) | ||
|
||
models = self.list_resource( | ||
self.ds_client.list_models, | ||
compartment_id=ODSC_MODEL_COMPARTMENT_OCID, | ||
compartment_id=compartment_id or COMPARTMENT_OCID, |
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.
wondering if we need to filter the model list here based on service model tags. If we list from users compartment, this would only return service models and not other registered models from users compartment?
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.
Not sure if i fully understand your question
but this would return either service models or user models based on category. If category is user (default) , it would return all registered models from user's compartment
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.
Updated. Thanks
ads/aqua/model/model.py
Outdated
**kwargs, | ||
) | ||
|
||
logger.info( | ||
f"Fetched {len(models)} model in compartment_id={ODSC_MODEL_COMPARTMENT_OCID if category==SERVICE else compartment_id}." | ||
f"Fetched {len(models)} models from {AQUA_SERVICE_MODELS if category==SERVICE else compartment_id}." |
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 message might not be clear with the new service model key, let's just log:
Fetched x service models.
or
Fetched x models from compartment <compartment_id>
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.
Sure , will update
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.
Updated. Thanks
….com/oracle/accelerated-data-science into feature/oss-bucket-config-dependency
Description
This PR is intended to completely remove the dependency of AQUA on config stored in Object storage bucket. Also , this change would ensure Aqua will be available for all realms even when no
ODSC_MODEL_COMPARTMENT_OCID
env variable is set.Unit Tests