Skip to content

Commit

Permalink
Merge branch 'release/0.11.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rius committed Apr 27, 2024
2 parents 52b1670 + 9840a39 commit d350042
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions docs/guide/scheduling-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,12 @@ Or it can be done manually, by calling `delete_schedule` on schedule source prov
```python
await redis_source.delete_schedule(schedule.schedule_id)
```

Also, you can get schedule_id from the tasks's labels.

```python
@broker.task
async def my_task(context: Context = TaskiqDepends()) -> None:
schedule_id = context.message.labels.get("schedule_id")
print("Schedule ID:", schedule_id)
```
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "taskiq"
version = "0.11.2"
version = "0.11.3"
description = "Distributed task queue with full async support"
authors = ["Pavel Kirilin <[email protected]>"]
maintainers = ["Pavel Kirilin <[email protected]>"]
Expand Down
3 changes: 2 additions & 1 deletion taskiq/cli/scheduler/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ async def run_scheduler_loop(scheduler: TaskiqScheduler) -> None:
task_delay = get_task_delay(task)
except ValueError:
logger.warning(
"Cannot parse cron: %s for task: %s",
"Cannot parse cron: %s for task: %s, schedule_id: %s",
task.cron,
task.task_name,
task.schedule_id,
)
continue
if task_delay is not None:
Expand Down
4 changes: 3 additions & 1 deletion taskiq/scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ async def on_ready(self, source: "ScheduleSource", task: ScheduledTask) -> None:
except ScheduledTaskCancelledError:
logger.info("Scheduled task %s has been cancelled.", task.task_name)
else:
await AsyncKicker(task.task_name, self.broker, task.labels).kiq(
await AsyncKicker(task.task_name, self.broker, task.labels).with_labels(
schedule_id=task.schedule_id,
).kiq(
*task.args,
**task.kwargs,
)
Expand Down

0 comments on commit d350042

Please sign in to comment.