Skip to content

Commit

Permalink
Updating test to run test function in serial to avoid race-condition …
Browse files Browse the repository at this point in the history
…in changing CWD
  • Loading branch information
yadudoc committed Nov 11, 2024
1 parent 5754b10 commit cec12b8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions compute_endpoint/tests/unit/test_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import random
import time
import typing as t
import uuid
from queue import Queue
from unittest import mock

Expand Down Expand Up @@ -78,7 +77,11 @@ def test_engine_submit(engine_type: GlobusComputeEngineBase, engine_runner):
"engine_type", (ProcessPoolEngine, ThreadPoolEngine, GlobusComputeEngine)
)
def test_engine_working_dir(
engine_type: GlobusComputeEngineBase, engine_runner, ez_pack_task, serde
engine_type: GlobusComputeEngineBase,
engine_runner,
ez_pack_task,
serde,
task_uuid,
):
"""working dir remains constant across multiple fn invocations
This test requires submitting the task payload so that the execute_task
Expand All @@ -87,19 +90,16 @@ def test_engine_working_dir(
"""
engine = engine_runner(engine_type)

task_id = uuid.uuid4()
task_bytes = ez_pack_task(get_cwd)
future1 = engine.submit(str(task_id), task_bytes, resource_specification={})
future1 = engine.submit(str(task_uuid), task_bytes, resource_specification={})
unpacked1 = messagepack.unpack(future1.result())
result1 = serde.deserialize(unpacked1.data)

task_id = uuid.uuid4()
task_bytes = ez_pack_task(get_cwd)
future2 = engine.submit(str(task_id), task_bytes, resource_specification={})

unpacked1 = messagepack.unpack(future1.result())
future2 = engine.submit(str(task_uuid), task_bytes, resource_specification={})
unpacked2 = messagepack.unpack(future2.result())

result1 = serde.deserialize(unpacked1.data)
result2 = serde.deserialize(unpacked2.data)

assert result1 == result2


Expand Down

0 comments on commit cec12b8

Please sign in to comment.