Skip to content

Instantly share code, notes, and snippets.

View adam-phillipps's full-sized avatar

Adam adam-phillipps

  • NGage
  • Salt Lake City, UT.
View GitHub Profile
cat << WPR >> wrapper.py
import boto3
import os
# create clients
s3 = boto3.resource('s3')
sqs = boto3.client('sqs', 'us-west-2')
# count the backlog messages
def msg_count():
[root@ip-172-31-24-37 /]# /var/lib/cloud/instance/scripts/part-001
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00:00
amzn-updates | 2.5 kB 00:00:00
No packages marked for update
Loaded plugins: priorities, update-motd, upgrade-helper
Package 1:java-1.8.0-openjdk-1.8.0.181-8.b13.39.39.amzn1.x86_64 already installed and latest version
Nothing to do
Loaded plugins: priorities, update-motd, upgrade-helper
No Match for argument: java-1.7.0-openjdk
Running jar with 'java -jar SmashEndurance.jar 1120000000000 http://www.rabo.org.ro/'...
Sending 'GET' request to URL : https://www.googleapis.com/pagespeedonline/v4/runPagespeed?key=AIzaSyCasztV2Q743eTjhm_RrR4Io6KCAZ_pOB0&url=http://www.rabo.org.ro/
Response Code : 200
Aug 30, 2018 4:59:02 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: executable: /root/phantomjs
Aug 30, 2018 4:59:02 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: port: 7316
Aug 30, 2018 4:59:02 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: arguments: [--webdriver=7316, --webdriver-logfile=/root/phantomjsdriver.log]
@adam-phillipps
adam-phillipps / userdata
Created August 28, 2018 23:50
gets run when an instance is provisioned (one time)
#!/bin/bash
export $QUEUE=https://sqs.us-west-2.amazonaws.com/088617881078/backlog_crawlBot
export $WIP_Q=https://sqs.us-west-2.amazonaws.com/088617881078/wip_crawlBot
export $ART_NAME=SmashEndurance.jar
export $ART_BKT=endurance-crawl-artifacts
export $OUT_BKT=endurance-crawl-output
# get docker and start the daemon
sudo yum update -y
sudo yum install docker -y
sudo usermod -a -G docker ec2-user
---
Description: Instances for the cluster via LaunchConfig through Autoscaling
Outputs:
LearningLockerLaunchConfig:
Value:
Ref: LearningLockerLaunchConfig
LearningLockerLaunchConfigName:
Value: LearningLockerLaunchConfig
Resources:
LearningLockerLaunchConfig:
@adam-phillipps
adam-phillipps / mongo_launch_config.yaml
Created August 7, 2018 17:11
single cfn-init config set
---
Description: Instances for the cluster via LaunchConfig through Autoscaling
Outputs:
MongoLaunchConfig:
Value:
Ref: MongoLaunchConfig
MongoLaunchConfigName:
Value: MongoLaunchConfig
Resources:
MongoLaunchConfig:
Getting self-IP
No metadata, found 'hostname -i': 172.17.0.2
Using ip: 172.17.0.2
Modifying configuration
Creating the /usr/spark-2.3.0/conf/spark-env.sh file...
Adding to spark-env.sh:
export SPARK_LOCAL_IP=172.17.0.2
export PYSPARK_PYTHON=python
Creating the /spark/conf/spark-defaults.conf file...
@adam-phillipps
adam-phillipps / same_error
Created June 14, 2018 06:37
spark example fail
root@cdee95838ee0:/usr/spark-2.3.0# spark-submit examples/src/main/python/kmeans.py data/mllib/kmeans_data.txt 10 5
Spark Command: /usr/jdk1.8.0_131/bin/java -cp /usr/spark-2.3.0/conf/:/usr/spark-2.3.0/jars/*:/usr/hadoop-2.8.3/etc/hadoop/:/usr/hadoop-2.8.3/etc/hadoop/*:/usr/hadoop-2.8.3/share/hadoop/common/lib/*:/usr/hadoop-2.8.3/share/hadoop/common/*:/usr/hadoop-2.8.3/share/hadoop/hdfs/*:/usr/hadoop-2.8.3/share/hadoop/hdfs/lib/*:/usr/hadoop-2.8.3/share/hadoop/yarn/lib/*:/usr/hadoop-2.8.3/share/hadoop/yarn/*:/usr/hadoop-2.8.3/share/hadoop/mapreduce/lib/*:/usr/hadoop-2.8.3/share/hadoop/mapreduce/*:/usr/hadoop-2.8.3/share/hadoop/tools/lib/* -Xmx1g org.apache.spark.deploy.SparkSubmit examples/src/main/python/kmeans.py data/mllib/kmeans_data.txt 10 5
========================================
2018-06-14 06:35:29 WARN NativeCodeLoader:62 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
WARN: This is a naive implementation of KMeans Clustering and is given
$ python bin/smash_planner.py
Getting self-IP
No metadata, found 'hostname -i': 172.17.0.2
Using ip: 172.17.0.2
Modifying configuration
Creating the /usr/spark-2.3.0/conf/spark-env.sh file...
Adding to spark-env.sh:
export SPARK_LOCAL_IP=172.17.0.2
export PYSPARK_PYTHON=python
Getting self-IP
No metadata, using 'hostname -i': 172.17.0.2
Created Spark command: su ubuntu -c '/usr/spark-2.3.0/bin/spark-submit --master spark://spark-master:7077 /usr/local/smash_planner/build_phase.py'
Modifying configuration
Creating the /usr/spark-2.3.0/conf/spark-env.sh file...
Adding to spark-env.sh:
export SPARK_LOCAL_IP=172.17.0.2