From c2769c58a6e1b8130305e91b1e0afa22877ea4a7 Mon Sep 17 00:00:00 2001 From: Giorgi Merebashvili Date: Sat, 28 Feb 2026 15:00:02 +0400 Subject: [PATCH 1/2] chore: Some fixes and updates --- crates/fluxqueue-worker/scripts/get_registry.py | 4 +++- crates/fluxqueue-worker/src/task.rs | 6 +++++- pyproject.toml | 15 ++++++++++----- python/fluxqueue/client.py | 7 +++---- python/fluxqueue/models.py | 10 ++++++++-- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/crates/fluxqueue-worker/scripts/get_registry.py b/crates/fluxqueue-worker/scripts/get_registry.py index 0f4da39..51c7b3c 100644 --- a/crates/fluxqueue-worker/scripts/get_registry.py +++ b/crates/fluxqueue-worker/scripts/get_registry.py @@ -7,7 +7,9 @@ from fluxqueue import Context -def get_registry(module_path: str, queue: str, module_dir: str | None = None): +def get_registry( # noqa: C901 + module_path: str, queue: str, module_dir: str | None = None +): if module_dir: module_dir_path = Path(module_dir).resolve() if str(module_dir_path) not in sys.path: diff --git a/crates/fluxqueue-worker/src/task.rs b/crates/fluxqueue-worker/src/task.rs index 9ad458a..0cfde7f 100644 --- a/crates/fluxqueue-worker/src/task.rs +++ b/crates/fluxqueue-worker/src/task.rs @@ -50,7 +50,11 @@ impl TaskRegistry { pub fn get_registered_contexts(&self) -> Result> { let contexts = self.contexts.read().map_err(|e| anyhow!(e.to_string()))?; - let context_names: Vec<_> = contexts.iter().map(|t| t.0.to_string()).collect(); + let context_names: Vec<_> = contexts + .iter() + .filter(|(name, _)| name.as_str() != "_Context") + .map(|(name, _)| name.to_string()) + .collect(); Ok(context_names) } diff --git a/pyproject.toml b/pyproject.toml index 802f7d5..eac776f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ manifest-path = "crates/fluxqueue-core/Cargo.toml" [tool.ruff] line-length = 88 +target-version = "py310" [tool.ruff.lint] select = [ @@ -73,9 +74,13 @@ select = [ "RUF", # ruff-specific rules ] ignore = [ - "E501", # line too long, handled by black - "B008", # do not perform function calls in argument defaults - "C901", # complexity - "N806", # variable in function should be lowercase (allows CamelCase for pydantic models) + "E501", # line too long ] -exclude = [".git", ".ruff_cache", ".venv"] + +exclude = [ + ".git", + ".ruff_cache", + ".venv", + "dist", + "build", +] \ No newline at end of file diff --git a/python/fluxqueue/client.py b/python/fluxqueue/client.py index c8436b5..9c561d0 100644 --- a/python/fluxqueue/client.py +++ b/python/fluxqueue/client.py @@ -148,15 +148,14 @@ async def session_context(self): await session.rollback() raise + @fluxqueue.task_with_context() async def create_user_task(ctx: DbContext, email: str, username: str): async with ctx.session_context() as db_session: - user = User( - email=email, - username=username - ) + user = User(email=email, username=username) db_session.add(user) + await create_user_task ``` """ diff --git a/python/fluxqueue/models.py b/python/fluxqueue/models.py index a6812cc..78f7d55 100644 --- a/python/fluxqueue/models.py +++ b/python/fluxqueue/models.py @@ -1,4 +1,5 @@ from dataclasses import dataclass +from datetime import datetime @dataclass(slots=True) @@ -13,5 +14,10 @@ class TaskMetadata: """Number of times this task has been retried.""" max_retries: int """Maximum number of retry attempts allowed before failure.""" - enqueued_at: int - """ISO 8601 timestamp of when the task was originally enqueued.""" + _enqueued_at: int + """Unix timestamp in seconds.""" + + @property + def enqueued_at(self): + """ISO 8601 timestamp of when the task was originally enqueued.""" + return datetime.fromtimestamp(self._enqueued_at) From 87c4f0bc8193a1b3961b03ab9ba7b92e12bf82c3 Mon Sep 17 00:00:00 2001 From: Giorgi Merebashvili Date: Sat, 28 Feb 2026 15:02:14 +0400 Subject: [PATCH 2/2] Fix minimum py version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index eac776f..b084c21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ manifest-path = "crates/fluxqueue-core/Cargo.toml" [tool.ruff] line-length = 88 -target-version = "py310" +target-version = "py311" [tool.ruff.lint] select = [