Skip to content

Commit 7f55b54

Browse files
committed
add some more comments
1 parent aaa44df commit 7f55b54

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

mapswipe_workers/locust_files/load_testing.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# run with locust -f locust_files/load_testing.py
1+
# run with "locust -f locust_files/load_testing.py"
22
# then set number of users and spawn rate in web interface
33
# e.g. test with 100 users, and 15 users/sec
44
# web interface: http://0.0.0.0:8089/
@@ -36,6 +36,10 @@ def set_up_user(self):
3636
pass
3737

3838
def create_mock_result(self, group):
39+
"""Create a result object for a build area project.
40+
41+
The result values are generated randomly.
42+
"""
3943
start_time = datetime.datetime.utcnow().isoformat()[0:-3] + "Z"
4044
end_time = datetime.datetime.utcnow().isoformat()[0:-3] + "Z"
4145

@@ -59,6 +63,7 @@ def create_mock_result(self, group):
5963
return data
6064

6165
def set_firebase_db(self, path, data, token=None):
66+
"""Upload results to Firebase using REST api."""
6267
request_ref = f"{path}.json?auth={token}"
6368
headers = {"content-type": "application/json; charset=UTF-8"}
6469
self.client.patch(
@@ -68,9 +73,11 @@ def set_firebase_db(self, path, data, token=None):
6873

6974
@task
7075
def map_a_group(self):
71-
"""Get a group from Firebase for this user.
76+
"""Get a group from Firebase for this user and "map" it.
7277
7378
Make sure that this user has not worked on this group before.
79+
Get the group and create mock results.
80+
Upload results to Firebse.
7481
"""
7582

7683
# get the groups that need to be mapped
@@ -114,6 +121,7 @@ def map_a_group(self):
114121
self.set_firebase_db(path, result, self.signed_in_user["idToken"])
115122

116123
def on_start(self):
124+
"""Set up user and define project when user starts running."""
117125
self.project_id = "-MYg8CEf2k1-RitN62X0"
118126
random_string = uuid4()
119127
self.email = f"test_{random_string}@mapswipe.org"

mapswipe_workers/mapswipe_workers/firebase_to_postgres/transfer_results.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ def save_results_to_postgres(results_file):
291291
"""
292292
p_con.query(query_insert_results)
293293
del p_con
294+
logger.info("copied results into postgres.")
294295

295296

296297
def truncate_temp_results():

0 commit comments

Comments
 (0)