From 93377a9c0f2a41b5f044adbd92cb8e4caef288ea Mon Sep 17 00:00:00 2001 From: sankalp Date: Mon, 6 Nov 2023 02:47:44 -0500 Subject: [PATCH 1/4] Infra related fixes for release --- covalent_braket_plugin/assets/infra/main.tf | 4 ++-- covalent_braket_plugin/assets/infra/variables.tf | 5 +++-- covalent_braket_plugin/braket.py | 6 +++--- requirements.txt | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/covalent_braket_plugin/assets/infra/main.tf b/covalent_braket_plugin/assets/infra/main.tf index 650c461..adb81a8 100644 --- a/covalent_braket_plugin/assets/infra/main.tf +++ b/covalent_braket_plugin/assets/infra/main.tf @@ -27,7 +27,7 @@ resource "aws_s3_bucket" "braket_bucket" { } resource "aws_ecr_repository" "braket_ecr_repo" { - name = "${var.name}-base-executor-repo" + name = "amazon-braket-${var.name}-base-executor-repo" image_tag_mutability = "MUTABLE" force_delete = true @@ -41,7 +41,7 @@ resource "aws_ecr_repository" "braket_ecr_repo" { } resource "aws_iam_role" "braket_iam_role" { - name = "${var.name}-role" + name = "amazon-braket-${var.name}-role" assume_role_policy = jsonencode({ Version = "2012-10-17" Statement = [ diff --git a/covalent_braket_plugin/assets/infra/variables.tf b/covalent_braket_plugin/assets/infra/variables.tf index d837335..4d517cd 100644 --- a/covalent_braket_plugin/assets/infra/variables.tf +++ b/covalent_braket_plugin/assets/infra/variables.tf @@ -14,9 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Prefix this "name" with something unique for your deployment +# Prefix this "name" with something unique for your deployment. +# This is used in addition to the `amazon-braket` prefix to ensure uniqueness, for e.g. the full name will be `amazon-braket--bucket` for S3 bucket name. variable "name" { - default = "covalent-braket" + default = "covalent" description = "Name to be used in the new provisioned resources" } diff --git a/covalent_braket_plugin/braket.py b/covalent_braket_plugin/braket.py index e94470f..889ba88 100644 --- a/covalent_braket_plugin/braket.py +++ b/covalent_braket_plugin/braket.py @@ -34,9 +34,9 @@ from covalent_aws_plugins import AWSExecutor _EXECUTOR_PLUGIN_DEFAULTS = { - "credentials": "", - "profile": "", - "region": "", + "credentials": "~/.aws/credentials", + "profile": "default", + "region": "us-east-1", "s3_bucket_name": os.environ.get("BRAKET_COVALENT_S3") or "amazon-braket-covalent-job-resources", "ecr_image_uri": "", diff --git a/requirements.txt b/requirements.txt index 348a558..3c13d0d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -amazon-braket-pennylane-plugin==1.6.9 -boto3==1.24.35 +amazon-braket-pennylane-plugin>=1.6.9 +boto3>=1.24.35 covalent-aws-plugins>=0.12.0,<1 From 18bbb570b0882d944f1e089e69fda13653bb133f Mon Sep 17 00:00:00 2001 From: sankalp Date: Tue, 7 Nov 2023 09:38:17 -0500 Subject: [PATCH 2/4] version upgrades to resolve issues on braket jobs --- Dockerfile | 6 +++--- covalent_braket_plugin/braket.py | 7 ++----- requirements.txt | 6 +++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index ba24f44..d977c6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,9 +10,9 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* RUN pip install --no-cache-dir --upgrade \ - amazon-braket-pennylane-plugin==1.6.9 \ - boto3==1.20.48 \ - pennylane==0.24.0 \ + amazon-braket-pennylane-plugin>=1.17.4 \ + boto3>=1.28.5 \ + pennylane>=0.31.1 \ sagemaker-training RUN if [ -z "$PRE_RELEASE" ]; then \ diff --git a/covalent_braket_plugin/braket.py b/covalent_braket_plugin/braket.py index 889ba88..f5f39f8 100644 --- a/covalent_braket_plugin/braket.py +++ b/covalent_braket_plugin/braket.py @@ -22,7 +22,7 @@ import tempfile from functools import partial from pathlib import Path -from typing import Any, Callable, Dict, List, Tuple +from typing import Any, Callable, Dict, List import boto3 import botocore @@ -30,7 +30,6 @@ from covalent._shared_files.config import get_config from covalent._shared_files.exceptions import TaskCancelledError from covalent._shared_files.logger import app_log -from covalent._workflow.transport import TransportableObject from covalent_aws_plugins import AWSExecutor _EXECUTOR_PLUGIN_DEFAULTS = { @@ -280,9 +279,7 @@ async def query_result(self, query_metadata: Dict) -> Any: ) events = all_log_events["events"] - log_events = "" - for event in events: - log_events += event["message"] + "\n" + log_events = "".join(event["message"] + "\n" for event in events) # output, stdout, stderr return result, log_events, "" diff --git a/requirements.txt b/requirements.txt index 3c13d0d..8fdb178 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -amazon-braket-pennylane-plugin>=1.6.9 -boto3>=1.24.35 -covalent-aws-plugins>=0.12.0,<1 +amazon-braket-pennylane-plugin>=1.17.4 +boto3>=1.28.5 +covalent-aws-plugins>=0.19.0,<1 From 62ce89fcef1fb5b507ec903a05fb572b3f696751 Mon Sep 17 00:00:00 2001 From: sankalp Date: Tue, 7 Nov 2023 09:45:48 -0500 Subject: [PATCH 3/4] updated docker workflow to push a branch-wise image to ECR --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cbf6d6c..965f517 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -74,6 +74,7 @@ jobs: with: persist-credentials: false fetch-depth: 0 + ref: further-fixes-for-release - name: Setup QEMU uses: docker/setup-qemu-action@v2 From 49a79ac3487832c179d4e9e32d8e59d45cb151de Mon Sep 17 00:00:00 2001 From: sankalp Date: Tue, 7 Nov 2023 11:44:21 -0500 Subject: [PATCH 4/4] using a stricter pin on install modules --- Dockerfile | 8 ++++---- covalent_braket_plugin/assets/infra/variables.tf | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index d977c6e..e217d4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,10 +9,10 @@ RUN apt-get update && apt-get install -y \ gcc \ && rm -rf /var/lib/apt/lists/* -RUN pip install --no-cache-dir --upgrade \ - amazon-braket-pennylane-plugin>=1.17.4 \ - boto3>=1.28.5 \ - pennylane>=0.31.1 \ +RUN pip install --no-cache-dir \ + boto3==1.28.5 \ + pennylane==0.31.1 \ + amazon-braket-pennylane-plugin==1.17.4 \ sagemaker-training RUN if [ -z "$PRE_RELEASE" ]; then \ diff --git a/covalent_braket_plugin/assets/infra/variables.tf b/covalent_braket_plugin/assets/infra/variables.tf index 4d517cd..e054714 100644 --- a/covalent_braket_plugin/assets/infra/variables.tf +++ b/covalent_braket_plugin/assets/infra/variables.tf @@ -17,7 +17,7 @@ # Prefix this "name" with something unique for your deployment. # This is used in addition to the `amazon-braket` prefix to ensure uniqueness, for e.g. the full name will be `amazon-braket--bucket` for S3 bucket name. variable "name" { - default = "covalent" + default = "sankalp-covalent" description = "Name to be used in the new provisioned resources" }