Skip to content
Merged
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
33 changes: 20 additions & 13 deletions data_exploration/debugging_for_data.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
from pathlib import Path
import pickle

infile_0 = open("./DEMOS/Output/11506437_1566325283_230842.pickle", "rb")
messages_0 = pickle.load(infile_0)
print(messages_0)

event_dict = {}
for event in messages_0.events:
if event.name == "ChatEvent":
print(event.text)
if event.name in event_dict:
event_dict[event.name] = event_dict[event.name] + 1
else:
event_dict[event.name] = 1


# def format_replay(replay):
# pass
Expand All @@ -23,3 +11,22 @@
# output += str(player.PACStats.ppm)

# return output


if __name__ == "__main__":
filepath = Path(
"./processing/demos/output/0efefaaddb4e76d4f0ff030ab8155eff.pickle"
).resolve()

with filepath.open("rb") as filepath:
messages_0 = pickle.load(filepath)
print(messages_0)

event_dict = {}
for event in messages_0.events:
if event.name == "ChatEvent":
print(event.text)
if event.name in event_dict:
event_dict[event.name] = event_dict[event.name] + 1
else:
event_dict[event.name] = 1
22 changes: 14 additions & 8 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,29 @@ DEVCONTAINER = kaszanas/sc2anonserverpy-devcontainer
############################
.PHONY: run
run_server: ## Run the server
docker run -it --rm \
-v ".\processing:/app/processing"
@echo "Running the gRPC anonymization server"
@echo "Using the Docker image: $(DOCKER_TAG)"
docker run --rm \
-v ".\processing:/app/processing" \
-p 9999:9999 \
$(DOCKER_TAG) \
python3 grpc_server.py \
--anonymized_db_path /app/processing/anonymized_players.pickle
--anonymized-db-path /app/processing/anonymized_players.pickle

.PHONY: run_client
run_client: ## Run the client without multiprocessing
docker run -it --rm \
-v ".\processing:/app/processing"
@echo "Running the gRPC anonymization client"
@echo "Using the Docker image: $(DOCKER_TAG)"
docker run --rm \
-v ".\processing:/app/processing" \
--network host \
$(DOCKER_TAG) \
python3 grpc_client.py \
--input_dir /app/processing/demos/input \
--output_dir /app/processing/demos/output \
--replay-directory /app/processing/demos/input \
--output-directory /app/processing/demos/output \
--agents 1 \
--chunksize 1 \
--use_multiprocessing False
--multiprocessing

############################
#### Docker commands #######
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def process_replay(arguments: ProcessReplayArguments):
)
logging.info("Exited anonymize().")

replay_output_filepath = arguments.output_dir / name_of_replay / ".pickle"
replay_output_filepath = arguments.output_dir / f"{name_of_replay}.pickle"
with replay_output_filepath.open(mode="wb") as f:
logging.info("Attempting to create .pickle file.")
pickle.dump(loaded_replay, f)
Expand Down
13 changes: 7 additions & 6 deletions src/sc2anonserverpy/grpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import typer
from typing_extensions import Annotated

from sc2anonserverpy.grpc_functions.grpc_sc2reader_client_functions import (
from sc2anonserverpy.client_functions.grpc_sc2reader_client_functions import (
ProcessReplayArguments,
initialize_worker,
process_replay,
)
Expand Down Expand Up @@ -109,11 +110,11 @@ def start_processing(
processing_arguments = []
for replay_path in list_of_replays:
processing_arguments.append(
(
replay_path,
output_directory,
anonymize_toon,
anonymize_chat,
ProcessReplayArguments(
replay_filepath=replay_path,
output_dir=output_directory,
anonymize_toon=anonymize_toon,
anonymize_chat=anonymize_chat,
)
)

Expand Down
1 change: 0 additions & 1 deletion src/sc2anonserverpy/grpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def main(
anonymized_db_path: Annotated[
Path,
typer.Option(
exists=True,
file_okay=True,
dir_okay=False,
writable=True,
Expand Down