Skip to content

Commit

Permalink
Only starting measure worker in new process
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavogaldinoo committed Aug 22, 2024
1 parent 05d3668 commit a365f7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 7 additions & 3 deletions experiment/measurer/measure_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,13 @@ def start_workers(self, request_queue, response_queue, pool):
worker_subscription_path, worker_request_queue_topic_path)

for _ in range(self.measurers_cpus):
google_cloud_worker = measure_worker.GoogleCloudMeasureWorker(
config)
pool.apply_async(google_cloud_worker.measure_worker_loop)

def start_measure_workers_and_start_loop():
google_cloud_worker = measure_worker.GoogleCloudMeasureWorker(
config)
google_cloud_worker.measure_worker_loop()

pool.apply_async(start_measure_workers_and_start_loop)

def get_result_from_response_queue(self, response_queue: str):

Expand Down
2 changes: 0 additions & 2 deletions experiment/measurer/test_measure_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,5 +672,3 @@ def test_gcloud_measure_manager_start_workers(_mock_subscriber, _mock_publisher,
gcloud_measure_manager.start_workers('request-queue-topic',
'response-queue-topic', pool)
assert pool.apply_async.call_count == cpus_available
pool.apply_async.assert_called_with(
mock_gcloud_measure_worker().measure_worker_loop)

0 comments on commit a365f7e

Please sign in to comment.