Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 0 additions & 168 deletions internal_use/CourseraSubmission.py

This file was deleted.

4 changes: 0 additions & 4 deletions internal_use/__init__.py

This file was deleted.

53 changes: 0 additions & 53 deletions internal_use/submit.py

This file was deleted.

45 changes: 0 additions & 45 deletions pom.xml

This file was deleted.

23 changes: 23 additions & 0 deletions python/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"serializer": "json",
"topology_specs": "topologies/",
"virtualenv_specs": "virtualenvs/",
"envs": {
"prod": {
"user": "",
"ssh_password": "",
"nimbus": "sandbox.hortonworks.com",
"use_ssh_for_nimbus": false,
"workers": [
"sandbox.hortonworks.com"
],
"log": {
"path": "/var/log/storm/streamparse",
"max_bytes": 1000000,
"backup_count": 10,
"level": "info"
},
"virtualenv_root": "/data/virtualenvs/"
}
}
}
11 changes: 11 additions & 0 deletions python/fabfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def pre_submit(topology_name, env_name, env_config):
"""Override this function to perform custom actions prior to topology
submission. No SSH tunnels will be active when this function is called."""
pass


def post_submit(topo_name, env_name, env_config):
"""Override this function to perform custom actions after topology
submission. Note that the SSH tunnel to Nimbus will still be active
when this function is called."""
pass
28 changes: 28 additions & 0 deletions python/postsetup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pip install --upgrade pip
pip install --upgrade virtualenv

mkdir -p $HOME/bin

if [[ ":$PATH:" != *":$HOME/bin:"* ]]; then
PATH=$PATH:$HOME/bin
export PATH
echo "Added $HOME/bin to PATH"
fi

wget -O $HOME/bin/lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod a+x $HOME/bin/lein
echo "#!/bin/bash
export LEIN_ROOT=true" > /etc/profile.d/leinroot.sh
export LEIN_ROOT=true
lein

mkdir -p /data/virtualenvs
touch /root/.ssh/config

echo "/opt/rh/python27/root/usr/lib64/" >> /etc/ld.so.conf.d/x86_64-linux-gnu.conf
ldconfig

mkdir -p /var/log/storm/streamparse
chown -R storm:hadoop /var/log/storm/streamparse

pip install git+https://github.com/srujun/streamparse.git
11 changes: 11 additions & 0 deletions python/project.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(defproject wordcount "0.0.1-SNAPSHOT"
:resource-paths ["_resources"]
:target-path "_build"
:min-lein-version "2.0.0"
:jvm-opts ["-client"]
:repositories { "HDP Releases" "http://repo.hortonworks.com/content/repositories/releases" }
:dependencies [[org.apache.storm/storm-core "0.10.0.2.3.2.0-2950"]
[org.apache.storm/flux-core "0.10.0.2.3.2.0-2950"]]
:jar-exclusions [#"log4j\.properties" #"org\.apache\.storm\.(?!flux)" #"trident" #"META-INF" #"meta-inf" #"\.yaml"]
:uberjar-exclusions [#"log4j\.properties" #"org\.apache\.storm\.(?!flux)" #"trident" #"META-INF" #"meta-inf" #"\.yaml"]
)
14 changes: 14 additions & 0 deletions python/pysetup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

yum install -y nano centos-release-SCL zlib-devel \
bzip2-devel openssl-devel ncurses-devel \
sqlite-devel readline-devel tk-devel \
gdbm-devel db4-devel libpcap-devel xz-devel \
libpng-devel libjpg-devel atlas-devel

yum groupinstall "Development tools" -y

yum install -y python27

echo "#!/bin/bash
source /opt/rh/python27/enable" > /etc/profile.d/enablepython27.sh
21 changes: 21 additions & 0 deletions python/src/bolts/NormalizerBolt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from streamparse import Bolt

class NormalizerBolt(Bolt):
outputs = ['word']

def initialize(self, storm_conf, context):
self.common_words = [
"the", "be", "a", "an", "and", "of", "to", "in", "am",
"is", "are", "at", "not", "that", "have", "i", "it",
"for", "on", "with", "he", "she", "as", "you", "do",
"this", "but", "his", "by", "from", "they", "we", "her",
"or", "will", "my", "one", "all", "s", "if", "any", "our",
"may", "your", "these", "d" , " ", "me" , "so" , "what" , "him"
]

def process(self, tup):
# TODO:
# Task 1: make the words all lower case
# Task 2: remove the common words

pass
9 changes: 9 additions & 0 deletions python/src/bolts/SplitSentenceBolt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from streamparse import Bolt

class SplitSentenceBolt(Bolt):
outputs = ['word']

def process(self, tup):
sentence = tup.values[0]
for word in sentence.split():
self.emit([word])
Loading