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
| package pl.wiadrodanych.demo.base | |
| import org.apache.spark.sql.SparkSession | |
| trait SparkJob { | |
| val spark: SparkSession = SparkSession | |
| .builder | |
| .appName("SomeApp") | |
| .master("local[*]") | |
| .getOrCreate() |
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
| private def sumByNormalizedName(normalizedFruits: DataFrame, spark: SparkSession) = { | |
| import spark.implicits._ | |
| val sumOfFruits = normalizedFruits | |
| .groupBy("normalized_name") | |
| .agg( | |
| sum(($"quantity")).as("sum") | |
| ) | |
| sumOfFruits | |
| } |
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 main(args: Array[String]) { | |
| val spark = SparkSession | |
| .builder | |
| .appName("MyAwesomeApp") | |
| .master("local[*]") | |
| .getOrCreate() | |
| import spark.implicits._ | |
| val groceries: DataFrame = getGroceries |
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
| val spark = SparkSession | |
| .builder | |
| .appName("MyAwesomeApp") | |
| .master("local[*]") | |
| .getOrCreate() | |
| import spark.implicits._ | |
| val groceries = spark.read | |
| .option("inferSchema", "true") |
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
| global_defs { | |
| enable_script_security | |
| } | |
| vrrp_script chk_logstash { | |
| script "/etc/keepalived/lol.sh" # path of the script to execute | |
| interval 1 # seconds between script invocations | |
| timeout 1 # seconds after which script is considered to have failed |
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
| #!/bin/bash | |
| logstash_response="$(curl --silent localhost:9600)" | |
| if echo $logstash_response | grep -q '"status":"green"' | |
| then | |
| echo "Logstash is green. It's ok :-)" | |
| exit 0 | |
| else | |
| echo "Logstash is not green :-( plz help" | |
| exit 1 | |
| fi |