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
version: '2' | |
services: | |
zookeeper: | |
image: wurstmeister/zookeeper | |
ports: | |
- "2181:2181" | |
kafka: | |
image: wurstmeister/kafka:2.11-1.1.1 | |
ports: | |
- "9092:9092" |
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
spark-worker-n: | |
image: bitnami/spark:3.0.1 | |
networks: | |
- default_net | |
environment: | |
- SPARK_MODE=worker | |
- SPARK_MASTER_URL=spark://spark:7077 | |
- SPARK_WORKER_MEMORY=1G | |
- SPARK_WORKER_CORES=1 | |
- SPARK_RPC_AUTHENTICATION_ENABLED=no |
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 sys | |
from pyspark import SparkConf, SparkContext | |
from pyspark.sql import SparkSession | |
########################## | |
# You can configure master here if you do not pass the spark.master paramenter in conf | |
########################## | |
#master = "spark://spark:7077" | |
#conf = SparkConf().setAppName("Spark Hello World").setMaster(master) | |
#sc = SparkContext(conf=conf) |
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 airflow import DAG | |
from airflow.operators.dummy_operator import DummyOperator | |
from airflow.contrib.operators.spark_submit_operator import SparkSubmitOperator | |
from datetime import datetime, timedelta | |
############################################### | |
# Parameters | |
############################################### | |
spark_master = "spark://spark:7077" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def oversampleSMOTE(X, y): | |
''' | |
Resample a dataset using SMOTE oversample | |
Input: | |
X = dataframe with x variables (explanatory variables) | |
y = dataframe with y variable (variable to predict) | |
Output: | |
df[0] = X dataframe resampled |
NewerOlder