Skip to content

Commit

Permalink
pr feedback fixes
Browse files Browse the repository at this point in the history
Signed-off-by: kalyanr <[email protected]>
  • Loading branch information
rawwar committed Nov 13, 2023
1 parent 99a3660 commit ba60da7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .ci/opensearch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ ARG opensearch_yml=$opensearch_path/config/opensearch.yml
ARG SECURE_INTEGRATION
RUN echo "plugins.ml_commons.only_run_on_ml_node: false" >> $opensearch_yml;
RUN echo "plugins.ml_commons.native_memory_threshold: 100" >> $opensearch_yml;
RUN if [ "$OPENSEARCH_VERSION" == "2.11.0" ] ; then \
RUN if [[ "$(printf '%s\n' "2.8.0" "$OPENSEARCH_VERSION" | sort -V | head -n 1)" == "$OPENSEARCH_VERSION" ]]; then \
echo "Enabling model access control"; \
echo "plugins.ml_commons.model_access_control_enabled: true" >> $opensearch_yml; \
echo "plugins.ml_commons.allow_registering_model_via_local_file: true" >> $opensearch_yml; \
echo "plugins.ml_commons.allow_registering_model_via_url: true" >> $opensearch_yml; \
fi
fi
RUN if [ "$SECURE_INTEGRATION" != "true" ] ; then echo "plugins.security.disabled: true" >> $opensearch_yml; fi
3 changes: 2 additions & 1 deletion opensearch_py_ml/ml_commons/model_access_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ def get_model_group_id_by_name(self, model_group_name: str):
if res["hits"]["hits"]:
return res["hits"]["hits"][0]["_id"]
else:
return None
raise NotFoundError
except NotFoundError:
print(f"No model group found with name:{model_group_name}")
return None
except Exception as ex:
print(f"Error in get_model_group_id_by_name: {ex}")
Expand Down
4 changes: 3 additions & 1 deletion tests/ml_commons/test_model_access_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
from opensearch_py_ml.ml_commons.model_access_control import ModelAccessControl
from tests import OPENSEARCH_TEST_CLIENT

OPENSEARCH_VERSION = parse_version(os.environ.get("OPENSEARCH_VERSION", "2.7.0"))
OPENSEARCH_VERSION = parse_version(os.environ.get("OPENSEARCH_VERSION", "2.11.0"))

# MAC = Model Access Control
# Minimum opensearch version that supports Model Access Control.
MAC_MIN_VERSION = parse_version("2.8.0")

# Minimum Opensearch version that supports Model group updates
MAC_UPDATE_MIN_VERSION = parse_version("2.11.0")

Expand Down

0 comments on commit ba60da7

Please sign in to comment.