Skip to content

Commit

Permalink
TE new version and keys refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed Jan 31, 2024
1 parent f3d5fe0 commit b0de5cf
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
4 changes: 3 additions & 1 deletion doc/changes/changes_0.2.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ This release adds the extension wrappers, the ITDE manager and makes full use of
* Add a new function - `start_itde` that re-starts an existing docker container.
* #63: [Integration tests for cloud-storage-extension code](https://github.com/exasol/notebook-connector/issues/63)
* #75: Connect the current docker container with the ITDE docker network in bring_itde_up
* #78: Added removal of the current container from docker network of the ITDE
* #78: Added removal of the current container from docker network of the ITDE
* #80: Pointed the Transformers Extension wrapper to the version 0.9.0 of the Transformers Extension.
* #81: Renamed the secret store keys "aws_bucket" and "aws_role" to respectively "sme_aws_bucket" and "sme_aws_role".
4 changes: 2 additions & 2 deletions exasol/ai_lab_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ class AILabConfig(Enum):
mem_size = auto()
disk_size = auto()
huggingface_token = auto()
aws_bucket = auto()
aws_region = auto()
aws_access_key_id = auto()
aws_secret_access_key = auto()
aws_role = auto()
itde_container = auto()
itde_volume = auto()
itde_network = auto()
te_bfs_connection = auto()
te_models_bfs_dir = auto()
te_hf_connection = auto()
te_models_cache_dir = auto()
sme_aws_bucket = auto()
sme_aws_role = auto()
sme_aws_connection = auto()
7 changes: 5 additions & 2 deletions exasol/extension_wrapper_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def encapsulate_huggingface_token(conf: Secrets, connection_name: str) -> None:
conn.execute(query=sql, query_params=query_params)


def encapsulate_aws_credentials(conf: Secrets, connection_name: str) -> None:
def encapsulate_aws_credentials(conf: Secrets, connection_name: str,
s3_bucket_key: CKey) -> None:
"""
Creates a connection object in the database encapsulating the address of
an AWS S3 bucket and AWS access credentials.
Expand All @@ -102,11 +103,13 @@ def encapsulate_aws_credentials(conf: Secrets, connection_name: str) -> None:
aws_secret_access_key), as well as the DB connection parameters.
connection_name:
Name for the connection object to be created.
s3_bucket_key:
The secret store key of the AWS S3 bucket name.
"""

sql = f"""
CREATE OR REPLACE CONNECTION [{connection_name}]
TO 'https://{conf.get(CKey.aws_bucket)}.s3.{conf.get(CKey.aws_region)}.amazonaws.com/'
TO 'https://{conf.get(s3_bucket_key)}.s3.{conf.get(CKey.aws_region)}.amazonaws.com/'
USER {{ACCESS_ID!s}}
IDENTIFIED BY {{SECRET_KEY!s}}
"""
Expand Down
2 changes: 1 addition & 1 deletion exasol/sagemaker_extension_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def initialize_sme_extension(conf: Secrets,
if run_deploy_scripts:
deploy_scripts(conf)
if run_encapsulate_aws_credentials:
encapsulate_aws_credentials(conf, aws_conn_name)
encapsulate_aws_credentials(conf, aws_conn_name, CKey.sme_aws_bucket)

# Save the connection object name in the secret store.
conf.save(CKey.sme_aws_connection, aws_conn_name)
2 changes: 1 addition & 1 deletion exasol/transformers_extension_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

LANGUAGE_ALIAS = "PYTHON3_TE"

LATEST_KNOWN_VERSION = "0.7.0"
LATEST_KNOWN_VERSION = "0.9.0"

# Activation SQL for the Transformers Extension will be saved in the secret
# store with this key.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_sagemaker_extension_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_initialize_sme_extension(
):
# Here are fake AWS credentials. Should be fine since we are only testing
# the deployment.
secrets.save(CKey.aws_bucket, "NoneExistent")
secrets.save(CKey.sme_aws_bucket, "NoneExistent")
secrets.save(CKey.aws_region, "neverland")
secrets.save(CKey.aws_access_key_id, "FAKEKEYIDDONTUSEIT")
secrets.save(CKey.aws_secret_access_key, "FakeSecretAccessKeyDontTryToUseIt")
Expand Down

0 comments on commit b0de5cf

Please sign in to comment.