Skip to content

Commit

Permalink
Disable segment logger and format/lint file
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan37 committed Feb 14, 2024
1 parent 4766b7f commit d37cda0
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mlstacks/analytics/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"""Analytics module for MLStacks."""

import datetime
import logging
import os
from logging import getLogger
from types import TracebackType
from typing import Any, Dict, List, Optional, Type, cast
from uuid import uuid4
Expand All @@ -31,7 +31,8 @@
from mlstacks.utils.environment_utils import handle_bool_env_var
from mlstacks.utils.yaml_utils import load_yaml_as_dict

logger = getLogger(__name__)
logger = logging.getLogger(__name__)
logging.getLogger("segment").disabled = True

analytics.write_key = "tU9BJvF05TgC29xgiXuKF7CuYP0zhgnx"
analytics.max_retries = 1
Expand Down
Empty file added tests/integration/__init__.py
Empty file.
12 changes: 12 additions & 0 deletions tests/integration/aws-remote-state/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) ZenML GmbH 2023. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing
# permissions and limitations under the License.
16 changes: 16 additions & 0 deletions tests/integration/aws-remote-state/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3.8"

services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
image: localstack/localstack
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
environment:
- DEBUG=${DEBUG:-0}
- SERVICES=ecr,s3,dynamodb,iam

volumes:
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
41 changes: 41 additions & 0 deletions tests/integration/aws-remote-state/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: MLStacks LocalStack Integration Tests
on: [push, pull_request]

jobs:
localstack-integration-test:
name: 'Run Integration Tests with LocalStack'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Start LocalStack
uses: localstack/setup-localstack@main
with:
image-tag: 'latest'
install-awslocal: 'true'
configuration: DEBUG=1

- name: Configure AWS CLI and Terraform
run: |
echo "Configuring AWS CLI to use LocalStack endpoints"
aws configure set default.region us-east-1
aws configure set aws_access_key_id test
aws configure set aws_secret_access_key test
echo "Changing to Terraform configuration directory"
cd tests/integration
echo "Initializing Terraform with LocalStack provider"
terraform init
terraform apply -auto-approve
- name: Run Tests against LocalStack
run: |
awslocal s3 mb s3://mlstacks-artifact-store
awslocal s3 ls
# Add more awslocal or Terraform commands as needed for testing
echo "Integration test execution complete!"
- name: Cleanup Resources
run: |
echo "Destroying Terraform-managed resources"
cd tests/integration
terraform destroy -auto-approve
26 changes: 26 additions & 0 deletions tests/integration/aws-remote-state/test_main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) ZenML GmbH 2023. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing
# permissions and limitations under the License.
resource "aws_s3_bucket" "artifact_store" {
bucket = "mlstacks-artifact-store"
}

resource "aws_dynamodb_table" "terraform_state_lock" {
name = "terraform-state-lock"
billing_mode = "PAY_PER_REQUEST"
hash_key = "LockID"

attribute {
name = "LockID"
type = "S"
}
}
Empty file.
Empty file.

0 comments on commit d37cda0

Please sign in to comment.