-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZS-86 Game Analtyics Gathering & Sending (#39)
* Added necessary files for Docker to work. * Updated git ignore. * test.py now uses ipv4 of aws. Added pem file needed to connect. * Changed url in Game Anayltics python file * Attempting fix for mongo side. * Further changing files to attempt to get python code to work on server. * Changed what GameState stores. Further changed server code. * Changed Analytics Manager to use the right IP address. * Analytics Manager handles GameState on it's own. * Analytics Manager now has a static data type. * Added Singleton to Scene. * Singleton being referenced breaks the scene. * New Singleton implemented, bullets are now counted properly. * Singleton now counts deaths, and persists through scenes. * Game Data is now successfully gathered during runtime. * ZS-87 Game Data is now successfully gathered during runtime. * ZS-88 Data can now be sent to server. Co-authored-by: Mantas Zalnierius <[email protected]>
- Loading branch information
1 parent
619d4cc
commit e575489
Showing
43 changed files
with
246 additions
and
9 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEowIBAAKCAQEAjiv6TR75vN9WH6KuOF7iwoMj3Kqo0Rc02Rz9fDVODQ/RGF9X | ||
sQPCalUUk2HZAb0e00r9kfGf9s4XDCwKVnv9SZNNacA4pUMKAhSzvWITZtL/I8zM | ||
iIp54agpl2b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YMo9pcQP0 | ||
PWpn7HYNOT3Vl/JfSMmYaP4Ydhf2a0t+1T9pFFSTuefAUtb0XVUR9VIu6Q5lNzAq | ||
nTazVQFpV2e5FSy4nRMWtwKBgCmUEwUxJIt2Sq9vCzKpidX2cnU66yu/QaJJyNPN | ||
7Fx2RKJ9ATXPtWJXQMf20AyW3ntGS9UabLIpS9MgUOdG45QfwU9TsEBmsICATa7V | ||
Icnp+ndsPk4aEucDgXPbcmztQSRnNh601sd3VZWDUdGSWjhiZfg6W4CDN7vps/ob | ||
EvP9AoGBAJpyrN11VrCgsMJGvHeu6pm9ugUFebYrBEF4T4awsG9hujI8AV/fdDPF | ||
hdvKNOShHxZU7IGetA9KKIpm64ct73TrTBSTzuMd3XErItcF45nTDSt3eAug2VLJ | ||
KPB7pSVV4bO3rsdZlZP3udjg2QyFcl7vFhYvrW1aV6hprg8x5Zgg | ||
-----END RSA PRIVATE KEY----- |
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,17 @@ | ||
# Use an official Python runtime as a parent image | ||
FROM python:3.8 | ||
|
||
RUN mkdir /app | ||
|
||
# Set the working directory to /app | ||
WORKDIR /app | ||
|
||
# Copy the current directory contents into the container at /app | ||
ADD /requirements.txt . | ||
|
||
# Install any needed packages specified in requirements.txt | ||
RUN pip install -r requirements.txt | ||
|
||
# Run app.py when the container launches | ||
# Note -u means unbuffered, otherwise there is no output to the logs | ||
CMD ["python", "-u", "./basic_api.py"] |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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,31 @@ | ||
version: "3.3" | ||
|
||
services: | ||
|
||
game_analytics: | ||
build: | ||
context: . | ||
dockerfile: PythonDockerfile | ||
ports: | ||
- "80:5000" | ||
tty: true | ||
volumes: | ||
- ./:/app | ||
networks: | ||
- net | ||
|
||
mongo: | ||
image: mongo:4.2.2 | ||
ports: | ||
- "27017:27017" | ||
environment: | ||
- MONGO_INITDB_ROOT_USERNAME=test | ||
- MONGO_INITDB_ROOT_PASSWORD=test | ||
networks: | ||
- net | ||
volumes: | ||
- ./mongo_db_data_container:/data/db | ||
|
||
networks: | ||
net: | ||
driver: bridge |
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,49 @@ | ||
import pandas as pd | ||
from pymongo import MongoClient | ||
|
||
db = {} | ||
|
||
def connect_to_database(): | ||
print("Creating client in connect_to_database") | ||
client = MongoClient('mongo', 27017, username="test", password="test") | ||
|
||
|
||
global db | ||
|
||
print("Grabbing test_database in connect_to_database") | ||
db = client.test_database | ||
|
||
print("Returning test_database in connect_to_database") | ||
return db | ||
|
||
def connect_to_database_outside_docker(): | ||
client = MongoClient('34.242.150.74', 80, username="test", password="test") | ||
|
||
global db | ||
db = client.test_database | ||
return db | ||
|
||
|
||
def add_data(data): | ||
print("Getting posts in database in add_data") | ||
posts = db.posts | ||
|
||
print("Grabbing post_id using data in add_data") | ||
post_id = posts.insert_one(data).inserted_id | ||
|
||
print("Post ID: " + str(post_id)) | ||
|
||
def get_dataframe(): | ||
print("Initializing cursor in get_dataframe") | ||
cursor = db.posts.find() # Expand the cursor and construct the DataFrame | ||
|
||
print(cursor) | ||
|
||
print("Creating pandas Dataframe in get_dataframe") | ||
df = pd.DataFrame(list(cursor)) | ||
|
||
return df | ||
|
||
|
||
|
||
|
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,34 @@ | ||
import pandas as pd | ||
from pymongo import MongoClient | ||
|
||
db = {} | ||
|
||
def connect_to_database(): | ||
client = MongoClient('mongo', 80, username="test", password="test") | ||
|
||
global db | ||
db = client.test_database | ||
return db | ||
|
||
def connect_to_database_outside_docker(): | ||
client = MongoClient('http://34.242.150.74/upload_data', 80, username="test", password="test") | ||
|
||
global db | ||
db = client.test_database | ||
return db | ||
|
||
|
||
def add_data(data): | ||
posts = db.posts | ||
|
||
post_id = posts.insert_one(data).inserted_id | ||
|
||
def get_dataframe(): | ||
cursor = db.posts.find() | ||
# Expand the cursor and construct the DataFrame | ||
df = pd.DataFrame(list(cursor)) | ||
return df | ||
|
||
|
||
|
||
|
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,2 @@ | ||
WiredTiger | ||
WiredTiger 3.2.2: (August 28, 2019) |
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 @@ | ||
WiredTiger lock file |
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,6 @@ | ||
WiredTiger version string | ||
WiredTiger 3.2.2: (August 28, 2019) | ||
WiredTiger version | ||
major=3,minor=2,patch=2 | ||
file:WiredTiger.wt | ||
access_pattern_hint=none,allocation_size=4KB,app_metadata=,assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none),block_allocation=best,block_compressor=,cache_resident=false,checksum=uncompressed,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,ignore_in_memory_cache_size=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),memory_page_image_max=0,memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,value_format=S,version=(major=1,minor=1),checkpoint=(WiredTigerCheckpoint.14=(addr="018d81e47ca5c6b18e81e4c57ebada8f81e422b771c6808080e2efc0e22fc0",order=14,time=1646493484,size=24576,newest_durable_ts=0,oldest_start_ts=0,oldest_start_txn=0,newest_stop_ts=-1,newest_stop_txn=-11,write_gen=36)),checkpoint_lsn=(3,6144) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+33.4 KB
server/mongo_db_data_container/diagnostic.data/metrics.2022-03-05T15-08-54Z-00000
Binary file not shown.
Binary file added
BIN
+49.6 KB
server/mongo_db_data_container/diagnostic.data/metrics.2022-03-05T15-09-29Z-00000
Binary file not shown.
Binary file added
BIN
+34.6 KB
server/mongo_db_data_container/diagnostic.data/metrics.2022-03-05T15-16-32Z-00000
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
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,11 @@ | ||
Flask_Cors==3.0.7 | ||
Werkzeug==0.14.1 | ||
passlib==1.7.1 | ||
requests==2.24.0 | ||
httplib2==0.12.1 | ||
Flask==1.0.2 | ||
python_dateutil==2.8.0 | ||
pymongo==3.11.0 | ||
pandas==1.1.3 | ||
notebook==6.1.5 | ||
itsdangerous==2.0.1 |
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,10 +1,21 @@ | ||
import game_analytics | ||
import requests | ||
|
||
def test_post_data(): | ||
url = 'http://localhost:5000/upload_data' | ||
url = 'http://34.242.150.74/upload_data' | ||
payload = {"completion_time": 2000, | ||
"level": 7 | ||
} | ||
} | ||
r = requests.post(url, json=payload) | ||
print(r) | ||
test_post_data() | ||
|
||
def test_get_data(): | ||
#game_analytics.connect_to_database_outside_docker() | ||
print("Connecting to database in test_get_data") | ||
game_analytics.connect_to_database() | ||
|
||
df = game_analytics.get_dataframe() | ||
print(df) | ||
|
||
test_post_data() | ||
test_get_data() |