From e659cfbf89cd835db5089793a57fa971014f4a80 Mon Sep 17 00:00:00 2001 From: MoeexT Date: Tue, 3 Mar 2026 10:02:22 +0800 Subject: [PATCH 1/3] :pushpin: resolve conflict --- .../app/module/shared/schedule/scheduler.py | 15 +++++++++++---- runtime/datamate-python/pyproject.toml | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/runtime/datamate-python/app/module/shared/schedule/scheduler.py b/runtime/datamate-python/app/module/shared/schedule/scheduler.py index 1bf161b37..a6bf00424 100644 --- a/runtime/datamate-python/app/module/shared/schedule/scheduler.py +++ b/runtime/datamate-python/app/module/shared/schedule/scheduler.py @@ -6,20 +6,26 @@ from apscheduler.triggers.cron import CronTrigger from app.core.logging import get_logger +import pytz logger = get_logger(__name__) class Scheduler: - def __init__(self, name: str = "scheduler") -> None: + def __init__(self, name: str = "scheduler", timezone: Optional[str] = None) -> None: self._name = name self._scheduler: Optional[AsyncIOScheduler] = None + # 使用指定的时区,如果没有指定则使用本地时区 + self._timezone = pytz.timezone(timezone) if timezone else None def start(self) -> AsyncIOScheduler: if self._scheduler is None: - self._scheduler = AsyncIOScheduler() + # 配置调度器使用本地时区 + from tzlocal import get_localzone + local_tz = get_localzone() + self._scheduler = AsyncIOScheduler(timezone=local_tz) self._scheduler.start() - logger.info(f"{self._name} started") + logger.info(f"{self._name} started with timezone: {local_tz}") return self._scheduler def shutdown(self) -> None: @@ -38,7 +44,8 @@ def add_cron_job( **job_kwargs: Any, ) -> None: scheduler = self._get_scheduler() - trigger = CronTrigger.from_crontab(cron_expression) + # 使用调度器的时区创建 CronTrigger + trigger = CronTrigger.from_crontab(cron_expression, timezone=scheduler.timezone) scheduler.add_job( func, trigger=trigger, diff --git a/runtime/datamate-python/pyproject.toml b/runtime/datamate-python/pyproject.toml index 0dcb086d4..9f3a9dd2b 100644 --- a/runtime/datamate-python/pyproject.toml +++ b/runtime/datamate-python/pyproject.toml @@ -47,6 +47,7 @@ dependencies = [ "pytest (>=9.0.2,<10.0.0)", "apscheduler (>=3.11.2,<4.0.0)", "msoffcrypto-tool (>=6.0.0,<7.0.0)", + "tzlocal (>=5.2,<6.0)", ] From f432846b736db7e9ca555187b1fb5418f10a1373 Mon Sep 17 00:00:00 2001 From: MoeexT Date: Thu, 26 Feb 2026 16:26:01 +0800 Subject: [PATCH 2/3] :pushpin: update poetry.lock --- runtime/datamate-python/poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/datamate-python/poetry.lock b/runtime/datamate-python/poetry.lock index 30b468394..21a5a17cb 100644 --- a/runtime/datamate-python/poetry.lock +++ b/runtime/datamate-python/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.3.2 and should not be changed by hand. [[package]] name = "aiofiles" @@ -1705,7 +1705,7 @@ files = [ [package.dependencies] attrs = ">=22.2.0" -jsonschema-specifications = ">=2023.03.6" +jsonschema-specifications = ">=2023.3.6" referencing = ">=0.28.4" rpds-py = ">=0.25.0" @@ -5808,9 +5808,9 @@ files = [ ] [package.extras] -cffi = ["cffi (>=1.17,<2.0) ; platform_python_implementation != \"PyPy\" and python_version < \"3.14\"", "cffi (>=2.0.0b) ; platform_python_implementation != \"PyPy\" and python_version >= \"3.14\""] +cffi = ["cffi (>=1.17,<2.0) ; platform_python_implementation != \"PyPy\" and python_version < \"3.14\"", "cffi (>=2.0.0b0) ; platform_python_implementation != \"PyPy\" and python_version >= \"3.14\""] [metadata] lock-version = "2.1" python-versions = ">=3.12,<4.0.0" -content-hash = "5818bbf701080e9eda4c920a96404616130ca997ce7999a5c74a4da0d7c8cc7c" +content-hash = "6c9fb82271c16a05eda4edf9bae73eeecf9044f6a0421370eefa09d31c1b1875" From 934ebce9edcd0308a63eb9f8bcaa4aa4cb6dd177 Mon Sep 17 00:00:00 2001 From: MoeexT Date: Tue, 3 Mar 2026 10:06:23 +0800 Subject: [PATCH 3/3] :pushpin: refresh poetry.lock --- runtime/datamate-python/poetry.lock | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/datamate-python/poetry.lock b/runtime/datamate-python/poetry.lock index 21a5a17cb..53f6ec426 100644 --- a/runtime/datamate-python/poetry.lock +++ b/runtime/datamate-python/poetry.lock @@ -4448,12 +4448,14 @@ optional = false python-versions = ">=3.7" groups = ["main"] files = [ + {file = "sqlalchemy-2.0.45-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c64772786d9eee72d4d3784c28f0a636af5b0a29f3fe26ff11f55efe90c0bd85"}, {file = "sqlalchemy-2.0.45-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7ae64ebf7657395824a19bca98ab10eb9a3ecb026bf09524014f1bb81cb598d4"}, {file = "sqlalchemy-2.0.45-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0f02325709d1b1a1489f23a39b318e175a171497374149eae74d612634b234c0"}, {file = "sqlalchemy-2.0.45-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d2c3684fca8a05f0ac1d9a21c1f4a266983a7ea9180efb80ffeb03861ecd01a0"}, {file = "sqlalchemy-2.0.45-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:040f6f0545b3b7da6b9317fc3e922c9a98fc7243b2a1b39f78390fc0942f7826"}, {file = "sqlalchemy-2.0.45-cp310-cp310-win32.whl", hash = "sha256:830d434d609fe7bfa47c425c445a8b37929f140a7a44cdaf77f6d34df3a7296a"}, {file = "sqlalchemy-2.0.45-cp310-cp310-win_amd64.whl", hash = "sha256:0209d9753671b0da74da2cfbb9ecf9c02f72a759e4b018b3ab35f244c91842c7"}, + {file = "sqlalchemy-2.0.45-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2e90a344c644a4fa871eb01809c32096487928bd2038bf10f3e4515cb688cc56"}, {file = "sqlalchemy-2.0.45-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b8c8b41b97fba5f62349aa285654230296829672fc9939cd7f35aab246d1c08b"}, {file = "sqlalchemy-2.0.45-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:12c694ed6468333a090d2f60950e4250b928f457e4962389553d6ba5fe9951ac"}, {file = "sqlalchemy-2.0.45-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:f7d27a1d977a1cfef38a0e2e1ca86f09c4212666ce34e6ae542f3ed0a33bc606"}, @@ -4482,12 +4484,14 @@ files = [ {file = "sqlalchemy-2.0.45-cp314-cp314-win_amd64.whl", hash = "sha256:4748601c8ea959e37e03d13dcda4a44837afcd1b21338e637f7c935b8da06177"}, {file = "sqlalchemy-2.0.45-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cd337d3526ec5298f67d6a30bbbe4ed7e5e68862f0bf6dd21d289f8d37b7d60b"}, {file = "sqlalchemy-2.0.45-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:9a62b446b7d86a3909abbcd1cd3cc550a832f99c2bc37c5b22e1925438b9367b"}, + {file = "sqlalchemy-2.0.45-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:5964f832431b7cdfaaa22a660b4c7eb1dfcd6ed41375f67fd3e3440fd95cb3cc"}, {file = "sqlalchemy-2.0.45-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ee580ab50e748208754ae8980cec79ec205983d8cf8b3f7c39067f3d9f2c8e22"}, {file = "sqlalchemy-2.0.45-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:13e27397a7810163440c6bfed6b3fe46f1bfb2486eb540315a819abd2c004128"}, {file = "sqlalchemy-2.0.45-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:ed3635353e55d28e7f4a95c8eda98a5cdc0a0b40b528433fbd41a9ae88f55b3d"}, {file = "sqlalchemy-2.0.45-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:db6834900338fb13a9123307f0c2cbb1f890a8656fcd5e5448ae3ad5bbe8d312"}, {file = "sqlalchemy-2.0.45-cp38-cp38-win32.whl", hash = "sha256:1d8b4a7a8c9b537509d56d5cd10ecdcfbb95912d72480c8861524efecc6a3fff"}, {file = "sqlalchemy-2.0.45-cp38-cp38-win_amd64.whl", hash = "sha256:ebd300afd2b62679203435f596b2601adafe546cb7282d5a0cd3ed99e423720f"}, + {file = "sqlalchemy-2.0.45-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d29b2b99d527dbc66dd87c3c3248a5dd789d974a507f4653c969999fc7c1191b"}, {file = "sqlalchemy-2.0.45-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:59a8b8bd9c6bedf81ad07c8bd5543eedca55fe9b8780b2b628d495ba55f8db1e"}, {file = "sqlalchemy-2.0.45-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fd93c6f5d65f254ceabe97548c709e073d6da9883343adaa51bf1a913ce93f8e"}, {file = "sqlalchemy-2.0.45-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:6d0beadc2535157070c9c17ecf25ecec31e13c229a8f69196d7590bde8082bf1"}, @@ -5813,4 +5817,4 @@ cffi = ["cffi (>=1.17,<2.0) ; platform_python_implementation != \"PyPy\" and pyt [metadata] lock-version = "2.1" python-versions = ">=3.12,<4.0.0" -content-hash = "6c9fb82271c16a05eda4edf9bae73eeecf9044f6a0421370eefa09d31c1b1875" +content-hash = "86863125b2840c00e606272d09232ab87eb2ad6f5aa87bed911e2a74458f8859"