Skip to content

Commit de46286

Browse files
committed
task_id -> task_key @giancarloromeo
1 parent 0c9695e commit de46286

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/celery-library/tests/unit/test_tasks.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,24 @@ class MyOwnerMetadata(OwnerMetadata):
4444

4545

4646
async def _fake_file_processor(
47-
celery_app: Celery, task_name: str, task_id: str, files: list[str]
47+
celery_app: Celery, task_name: str, task_key: str, files: list[str]
4848
) -> str:
4949
def sleep_for(seconds: float) -> None:
5050
time.sleep(seconds)
5151

5252
for n, file in enumerate(files, start=1):
5353
with log_context(_logger, logging.INFO, msg=f"Processing file {file}"):
5454
await get_app_server(celery_app).task_manager.set_task_progress(
55-
task_key=task_id,
55+
task_key=task_key,
5656
report=ProgressReport(actual_value=n / len(files)),
5757
)
5858
await asyncio.get_event_loop().run_in_executor(None, sleep_for, 1)
5959

6060
return "archive.zip"
6161

6262

63-
def fake_file_processor(task: Task, task_id: TaskKey, files: list[str]) -> str:
64-
assert task_id
63+
def fake_file_processor(task: Task, task_key: TaskKey, files: list[str]) -> str:
64+
assert task_key
6565
assert task.name
6666
_logger.info("Calling _fake_file_processor")
6767
return asyncio.run_coroutine_threadsafe(
@@ -74,14 +74,14 @@ class MyError(OsparcErrorMixin, Exception):
7474
msg_template = "Something strange happened: {msg}"
7575

7676

77-
def failure_task(task: Task, task_id: TaskKey) -> None:
78-
assert task_id
77+
def failure_task(task: Task, task_key: TaskKey) -> None:
78+
assert task_key
7979
assert task
8080
msg = "BOOM!"
8181
raise MyError(msg=msg)
8282

8383

84-
async def dreamer_task(task: Task, task_id: TaskKey) -> list[int]:
84+
async def dreamer_task(task: Task, task_key: TaskKey) -> list[int]:
8585
numbers = []
8686
for _ in range(30):
8787
numbers.append(randint(1, 90)) # noqa: S311

0 commit comments

Comments
 (0)