This repository has been archived by the owner on Sep 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from istresearch/P4-2412
P4 2412 - Tweet Sampling
- Loading branch information
Showing
15 changed files
with
729 additions
and
383 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,12 @@ | ||
{ | ||
"template" : "logs-*", | ||
"template" : "traptor-*", | ||
"order" : 0, | ||
"settings" : { | ||
"index.refresh_interval" : "5s", | ||
"number_of_shards" : "5", | ||
"number_of_shards" : "1", | ||
"number_of_replicas": "0" | ||
}, | ||
"mappings" : { | ||
"_default_" : { | ||
"dynamic_templates" : [ { | ||
"message_field" : { | ||
"mapping" : { | ||
"index" : "not_analyzed", | ||
"omit_norms" : true, | ||
"include_in_parent": true, | ||
"type" : "string" | ||
}, | ||
"match_mapping_type" : "string", | ||
"match" : "message" | ||
} | ||
}, { | ||
"string_fields" : { | ||
"mapping" : { | ||
"index" : "not_analyzed", | ||
"omit_norms" : true, | ||
"include_in_parent": true, | ||
"type" : "string" | ||
}, | ||
"match_mapping_type" : "string", | ||
"match" : "*" | ||
} | ||
} ], | ||
"properties" : { | ||
"@version" : { | ||
"index" : "not_analyzed", | ||
"type" : "string" | ||
} | ||
}, | ||
"_all" : { | ||
"enabled" : true | ||
} | ||
} | ||
}, | ||
"aliases" : { } | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ uwsgi==2.0.15 | |
pykafka==2.6.0 | ||
gevent==1.2.2 | ||
Werkzeug==0.16.1 | ||
token-bucket==0.2.0 |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
import redis | ||
|
||
location_rules = [{ | ||
"status":"active", | ||
"rule_type":"locations", | ||
"orig_type":"geo", | ||
"description":"Tweets from CONUS", | ||
"project_version_id":"None", | ||
"campaign_id":"default", | ||
"value":"-125.551758,24.726875,-66.401367,49.439557", | ||
"tag":"Pulse.united_states", | ||
"appid":"ist-dev", | ||
"date_added":"2021-01-19 18:37:28", | ||
"project_id":"default", | ||
"rule_id":"1", | ||
"node_id":"None" | ||
}] | ||
|
||
track_rules = [ | ||
{ | ||
"status":"active", | ||
"rule_type":"track", | ||
"orig_type":"keyword", | ||
"description":"test", | ||
"project_version_id":"None", | ||
"campaign_id":"default", | ||
"value":"usa", | ||
"tag":"Pulse.united_states", | ||
"appid":"ist-dev", | ||
"date_added":"2021-01-19 18:37:28", | ||
"project_id":"default", | ||
"rule_id":"10", | ||
"node_id":"None" | ||
}, | ||
{ | ||
"status":"active", | ||
"rule_type":"track", | ||
"orig_type":"keyword", | ||
"description":"news", | ||
"project_version_id":"None", | ||
"campaign_id":"default", | ||
"value":"news", | ||
"tag":"noise", | ||
"appid":"ist-dev", | ||
"date_added":"2021-01-19 18:37:28", | ||
"project_id":"default", | ||
"rule_id":"11", | ||
"node_id":"None" | ||
} | ||
] | ||
|
||
follow_rules = [{ | ||
"status":"active", | ||
"rule_type":"follow", | ||
"orig_type":"username", | ||
"description":"news", | ||
"project_version_id":"None", | ||
"campaign_id":"default", | ||
"value":"cnn", | ||
"tag":"news", | ||
"appid":"ist-dev", | ||
"date_added":"2021-01-19 18:37:28", | ||
"project_id":"default", | ||
"rule_id":"20", | ||
"node_id":"None" | ||
}] | ||
|
||
r = redis.Redis('localhost', db=1) | ||
r.info() | ||
|
||
traptor_id = 0 | ||
|
||
for item in location_rules: | ||
r.hmset('traptor-locations:{}:{}'.format(traptor_id, item['rule_id']), item) | ||
|
||
for item in track_rules: | ||
r.hmset('traptor-track:{}:{}'.format(traptor_id, item['rule_id']), item) | ||
|
||
for item in follow_rules: | ||
r.hmset('traptor-follow:{}:{}'.format(traptor_id, item['rule_id']), item) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"tag": "test", "value": "735369652956766200", "status": "active", "description": "Tweets from some user", "appid": "test-appid", "date_added": "2016-05-10 16:58:34", "rule_type": "follow", "rule_id": 12345} | ||
{"tag": "test", "value": "735369652956766200", "status": "active", "description": "Tweets from some user", "appid": "test-appid", "date_added": "2016-05-10 16:58:34", "orig_type": "userid", "rule_type": "follow", "rule_id": 12345} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"tag": "test", "value": "tweet", "status": "active", "description": "Tweets for a hashtag", "appid": "test-appid", "date_added": "2016-05-10 16:58:34", "rule_type": "track", "rule_id": 12347} | ||
{"tag": "test", "value": "tweet", "status": "active", "description": "Tweets for a hashtag", "appid": "test-appid", "date_added": "2016-05-10 16:58:34", "orig_type": "keyword", "rule_type": "track", "rule_id": 12347} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"tag": "test", "value": "17919972", "status": "active", "description": "Tweets from some user", "appid": "test-appid", "date_added": "2016-05-10 16:58:34", "rule_type": "follow", "rule_id": 12345} | ||
{"tag": "test", "value": "17919972", "status": "active", "description": "Tweets from some user", "appid": "test-appid", "date_added": "2016-05-10 16:58:34", "orig_type": "userid", "rule_type": "follow", "rule_id": 12345} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"tag": "test", "value": "-122.75,36.8,-121.75,37.8", "status": "active", "description": "Tweets from some continent", "appid": "test-appid", "date_added": "2016-05-10 16:58:34", "rule_type": "locations", "rule_id": 12346} | ||
{"tag": "test", "value": "-122.75,36.8,-121.75,37.8", "status": "active", "description": "Tweets from some continent", "appid": "test-appid", "date_added": "2016-05-10 16:58:34", "orig_type": "geo", "rule_type": "locations", "rule_id": 12346} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"tag": "test", "value": "happy", "status": "active", "description": "Tweets for a hashtag", "appid": "test-appid", "date_added": "2016-05-10 16:58:34", "rule_type": "track", "rule_id": 12347} | ||
{"tag": "test", "value": "happy", "status": "active", "description": "Tweets for a hashtag", "appid": "test-appid", "date_added": "2016-05-10 16:58:34", "orig_type": "keyword", "rule_type": "track", "rule_id": 12347} |
Oops, something went wrong.