This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import logging | |
import os | |
from datetime import timedelta | |
import boto3 | |
from dateutil.parser import parse | |
environment = os.environ.get("ENV") | |
logger = logging.getLogger(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import datetime | |
import pytz | |
import os | |
import logging | |
import json | |
cloudwatch_client = boto3.client('cloudwatch') | |
sns_client = boto3.client('sns') | |
#Use this to identify alarms for our specific env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import os | |
from flask import Flask, | |
from flask_injector import FlaskInjector | |
from injector import singleton, Injector, Module | |
from common_dal import DataAccessLayer, initialize_db_connection | |
from apis.api_queries import api_before_request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask_restx import Api | |
from .health_check.health import health_api as health_namespace | |
api = Api( | |
title='Title', | |
version='1.0', | |
description='description', | |
doc='/api-docs', | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from injector import inject | |
from flask import request, g | |
@inject | |
def api_before_request(db_connection: MyDbConnectionClass): | |
if not request.path.startswith("/health_check"): | |
logger.info(f"Request received to: {request.url}, headers: {request.headers}, body: {request.json}”) | |
g.user_info = db_connection.query_user_info(request.headers.get('Username’)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import jsonify | |
from flask_restx import Resource, Namespace | |
health_api = Namespace('health', 'health check api') | |
@health_api.route('health_check', doc=False) | |
class HealthCheck(Resource): | |
def get(self): | |
response = {"Status": "OK"} | |
return jsonify(response) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark.sql import SparkSession | |
spark = SparkSession.builder.appName("SimpleApp").enableHiveSupport().getOrCreate() | |
spark.sql("use dev") | |
spark.sql("show tables").show() | |
spark.sql("SELECT * FROM myTable").show(10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--configurations '[{"Classification":"hive-site","Properties":{"hive.metastore.client.factory.class":"com.amazonaws.glue.catalog.metastore.AWSGlueDataCatalogHiveClientFactory"}},{"Classification":"spark-hive-site","Properties":{"hive.metastore.client.factory.class":"com.amazonaws.glue.catalog.metastore.AWSGlueDataCatalogHiveClientFactory"}}]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.amazonaws.ClientConfiguration; | |
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.env.EnvironmentPostProcessor; | |
import org.springframework.core.env.ConfigurableEnvironment; | |
import org.springframework.core.env.MapPropertySource; | |
import java.util.HashMap; | |
import java.util.Map; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
AWSTemplateFormatVersion: '2010-09-09' | |
Description: "Monitoring - Dashboard - Http Errors" | |
Parameters: | |
EnvironmentName: | |
Type: String |
NewerOlder