INFO: Will watch for changes in these directories: ['C:\\Users\\Chenwu\\OneDrive - AZCollaboration\\Desktop\\tmp\\ai_news_v1\\backend'] INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) INFO: Started reloader process [45476] using WatchFiles INFO: Started server process [55920] INFO: Waiting for application startup. INFO: Application startup complete. INFO: 127.0.0.1:62512 - "GET /api/news?page_size=1&date=2026-05-26 HTTP/1.1" 200 OK INFO: 127.0.0.1:51410 - "GET /api/news?page_size=20&date=2026-05-26 HTTP/1.1" 200 OK INFO: 127.0.0.1:57871 - "GET /api/news?page_size=20&date=2026-05-26 HTTP/1.1" 200 OK INFO: 127.0.0.1:50345 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 127.0.0.1:62949 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 127.0.0.1:50346 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 127.0.0.1:63742 - "GET /api/news?page_size=20&date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK Daily pipeline failed: (sqlalchemy.dialects.postgresql.asyncpg.InterfaceError) : connection is closed [SQL: INSERT INTO system_logs (event_type, message, level, created_at) VALUES ($1::VARCHAR, $2::VARCHAR, $3::VARCHAR, $4::TIMESTAMP WITHOUT TIME ZONE) RETURNING system_logs.id] [parameters: ('pipeline_start', '\u6bcf\u65e5\u6d41\u6c34\u7ebf\u542f\u52a8', 'INFO', datetime.datetime(2026, 5, 26, 22, 0, 0, 12142))] (Background on this error at: https://sqlalche.me/e/20/rvf5) Traceback (most recent call last): File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 843, in _start_transaction self._transaction = self._connection.transaction( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ isolation=self.isolation_level, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ readonly=self.readonly, ^^^^^^^^^^^^^^^^^^^^^^^ deferrable=self.deferrable, ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\asyncpg\connection.py", line 302, in transaction self._check_open() ~~~~~~~~~~~~~~~~^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\asyncpg\connection.py", line 1605, in _check_open raise exceptions.InterfaceError('connection is closed') asyncpg.exceptions._base.InterfaceError: connection is closed The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\engine\base.py", line 1969, in _exec_single_context self.dialect.do_execute( ~~~~~~~~~~~~~~~~~~~~~~~^ cursor, str_statement, effective_parameters, context ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\engine\default.py", line 952, in do_execute cursor.execute(statement, parameters) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 585, in execute self._adapt_connection.await_( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ self._prepare_and_execute(operation, parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn value = await result ^^^^^^^^^^^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 520, in _prepare_and_execute await adapt_connection._start_transaction() File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 850, in _start_transaction self._handle_exception(error) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 797, in _handle_exception raise translated_error from error sqlalchemy.dialects.postgresql.asyncpg.AsyncAdapt_asyncpg_dbapi.InterfaceError: : connection is closed The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\Chenwu\OneDrive - AZCollaboration\Desktop\tmp\ai_news_v1\backend\app\scheduler.py", line 14, in daily_pipeline_job await run_daily_pipeline(db) File "C:\Users\Chenwu\OneDrive - AZCollaboration\Desktop\tmp\ai_news_v1\backend\app\ai\processor.py", line 120, in run_daily_pipeline await _log(db, "INFO", "pipeline_start", "\u6bcf\u65e5\u6d41\u6c34\u7ebf\u542f\u52a8") File "C:\Users\Chenwu\OneDrive - AZCollaboration\Desktop\tmp\ai_news_v1\backend\app\ai\processor.py", line 47, in _log await db.commit() File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\ext\asyncio\session.py", line 999, in commit await greenlet_spawn(self.sync_session.commit) File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 203, in greenlet_spawn result = context.switch(value) File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\session.py", line 2034, in commit trans.commit(_to_root=True) ~~~~~~~~~~~~^^^^^^^^^^^^^^^ File "", line 2, in commit File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go ret_value = fn(self, *arg, **kw) File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\session.py", line 1315, in commit self._prepare_impl() ~~~~~~~~~~~~~~~~~~^^ File "", line 2, in _prepare_impl File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go ret_value = fn(self, *arg, **kw) File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\session.py", line 1290, in _prepare_impl self.session.flush() ~~~~~~~~~~~~~~~~~~^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\session.py", line 4352, in flush self._flush(objects) ~~~~~~~~~~~^^^^^^^^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\session.py", line 4487, in _flush with util.safe_reraise(): ~~~~~~~~~~~~~~~~~^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ raise exc_value.with_traceback(exc_tb) File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\session.py", line 4448, in _flush flush_context.execute() ~~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\unitofwork.py", line 465, in execute rec.execute(self) ~~~~~~~~~~~^^^^^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\unitofwork.py", line 641, in execute util.preloaded.orm_persistence.save_obj( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ self.mapper, ^^^^^^^^^^^^ uow.states_for_mapper_hierarchy(self.mapper, False, False), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ uow, ^^^^ ) ^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\persistence.py", line 94, in save_obj _emit_insert_statements( ~~~~~~~~~~~~~~~~~~~~~~~^ base_mapper, ^^^^^^^^^^^^ ...<3 lines>... insert, ^^^^^^^ ) ^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\orm\persistence.py", line 1234, in _emit_insert_statements result = connection.execute( statement, params, execution_options=execution_options, ) File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\engine\base.py", line 1421, in execute return meth( self, distilled_parameters, execution_options or NO_OPTIONS, ) File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\sql\elements.py", line 526, in _execute_on_connection return connection._execute_clauseelement( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ self, distilled_params, execution_options ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\engine\base.py", line 1643, in _execute_clauseelement ret = self._execute_context( dialect, ...<8 lines>... cache_hit=cache_hit, ) File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\engine\base.py", line 1848, in _execute_context return self._exec_single_context( ~~~~~~~~~~~~~~~~~~~~~~~~~^ dialect, context, statement, parameters ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\engine\base.py", line 1988, in _exec_single_context self._handle_dbapi_exception( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ e, str_statement, effective_parameters, cursor, context ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\engine\base.py", line 2365, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\engine\base.py", line 1969, in _exec_single_context self.dialect.do_execute( ~~~~~~~~~~~~~~~~~~~~~~~^ cursor, str_statement, effective_parameters, context ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\engine\default.py", line 952, in do_execute cursor.execute(statement, parameters) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 585, in execute self._adapt_connection.await_( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ self._prepare_and_execute(operation, parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn value = await result ^^^^^^^^^^^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 520, in _prepare_and_execute await adapt_connection._start_transaction() File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 850, in _start_transaction self._handle_exception(error) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^ File "C:\Users\Chenwu\AppData\Roaming\Python\Python314\site-packages\sqlalchemy\dialects\postgresql\asyncpg.py", line 797, in _handle_exception raise translated_error from error sqlalchemy.exc.InterfaceError: (sqlalchemy.dialects.postgresql.asyncpg.InterfaceError) : connection is closed [SQL: INSERT INTO system_logs (event_type, message, level, created_at) VALUES ($1::VARCHAR, $2::VARCHAR, $3::VARCHAR, $4::TIMESTAMP WITHOUT TIME ZONE) RETURNING system_logs.id] [parameters: ('pipeline_start', '\u6bcf\u65e5\u6d41\u6c34\u7ebf\u542f\u52a8', 'INFO', datetime.datetime(2026, 5, 26, 22, 0, 0, 12142))] (Background on this error at: https://sqlalche.me/e/20/rvf5) INFO: 58.37.56.82:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK INFO: 127.0.0.1:61914 - "GET /api/news?page_size=1&date=2026-05-26 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 58.37.56.82:0 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-26 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-26&page=1 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 149.112.116.74:0 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK INFO: 127.0.0.1:61458 - "GET /api/news/featured?date=2026-05-27 HTTP/1.1" 200 OK INFO: 127.0.0.1:65226 - "GET /api/news/dates HTTP/1.1" 200 OK INFO: 127.0.0.1:61459 - "GET /api/news?date=2026-05-27&page=1 HTTP/1.1" 200 OK