Repository: evidentlyai/evidently
Issue: problem with the scheduler.py
Root cause: External Dependency Breakage

when executing the scheduler.py I get the following error:

C:\Users\User\AppData\Roaming\Python\Python39\site-packages\umap\distances.py:1063: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details.
  @numba.jit()
C:\Users\User\AppData\Roaming\Python\Python39\site-packages\umap\distances.py:1071: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details.
  @numba.jit()
C:\Users\User\AppData\Roaming\Python\Python39\site-packages\umap\distances.py:1086: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details.
  @numba.jit()
C:\Users\User\AppData\Roaming\Python\Python39\site-packages\umap\umap_.py:660: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details.
  @numba.jit()
C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\tasks.py:279: UserWarning: A task named 'generate_reports' and defined at 'C:\Users\User\Documents\Integracion Evidently\examples\integrations\postgres_grafana_batch_monitoring\src\pipelines\monitor_model.py:24' conflicts with another task. Consider specifying a unique `name` parameter in the task definition:

 `@task(name='my_unique_name', ...)`
  warnings.warn(
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1905, in _execute_context
    self.dialect.do_execute(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\engine\default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 108, in execute
    self._adapt_connection._handle_exception(error)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 236, in _handle_exception
    raise error
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 90, in execute
    self.await_(_cursor.execute(operation, parameters))
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 68, in await_only
    return current.driver.switch(awaitable)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 121, in greenlet_spawn
    value = await result
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\cursor.py", line 48, in execute
    await self._execute(self._cursor.execute, sql, parameters)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\cursor.py", line 40, in _execute
    return await self._conn._execute(fn, *args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\core.py", line 133, in _execute
    return await future
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\core.py", line 106, in run
    result = function()
sqlite3.OperationalError: table block_type already exists

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\api\server.py", line 480, in lifespan
    await run_migrations()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\api\server.py", line 403, in run_migrations
    await db.create_db()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\database\interface.py", line 55, in create_db
    await self.run_migrations_upgrade()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\database\interface.py", line 63, in run_migrations_upgrade
    await run_sync_in_worker_thread(alembic_upgrade)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\utilities\asyncutils.py", line 91, in run_sync_in_worker_thread
    return await anyio.to_thread.run_sync(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\database\alembic_commands.py", line 24, in wrapper
    return fn(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\database\alembic_commands.py", line 53, in alembic_upgrade
    alembic.command.upgrade(alembic_config(), revision, sql=dry_run)
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\command.py", line 378, in upgrade
    script.run_env()
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\script\base.py", line 569, in run_env
    util.load_python_file(self.dir, "env.py")
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\util\pyfiles.py", line 94, in load_python_file
    module = load_module_py(module_id, path)
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\util\pyfiles.py", line 110, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\database\migrations\env.py", line 147, in <module>
    apply_migrations()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\utilities\asyncutils.py", line 248, in coroutine_wrapper
    return run_async_from_worker_thread(async_fn, *args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\utilities\asyncutils.py", line 177, in run_async_from_worker_thread
    return anyio.from_thread.run(call)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio\from_thread.py", line 47, in run
    return asynclib.run_async_from_thread(func, *args)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio\_backends\_asyncio.py", line 906, in run_async_from_thread
    return f.result()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\_base.py", line 440, in result
    return self.__get_result()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\_base.py", line 389, in __get_result
    raise self._exception
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\database\migrations\env.py", line 141, in apply_migrations
    await connection.run_sync(do_run_migrations)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\ext\asyncio\engine.py", line 548, in run_sync
    return await greenlet_spawn(fn, conn, *arg, **kw)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 128, in greenlet_spawn
    result = context.switch(value)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\database\migrations\env.py", line 129, in do_run_migrations
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\runtime\environment.py", line 865, in run_migrations
    self.get_context().run_migrations(**kw)
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\runtime\migration.py", line 624, in run_migrations
    step.migration_fn(**kw)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\database\migrations\versions\sqlite\2022_04_25_135207_b75d279ba985_replace_version_with_checksum.py", line 24, in upgrade
    op.create_table(
  File "<string>", line 8, in create_table
  File "<string>", line 3, in create_table
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\operations\ops.py", line 1260, in create_table
    return operations.invoke(op)
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\operations\base.py", line 401, in invoke
    return fn(self, operation)
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\operations\toimpl.py", line 114, in create_table
    operations.impl.create_table(table)
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\ddl\impl.py", line 354, in create_table
    self._exec(schema.CreateTable(table))
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\alembic\ddl\impl.py", line 193, in _exec
    return conn.execute(  # type: ignore[call-overload]
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\future\engine.py", line 280, in execute
    return self._execute_20(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1710, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\sql\ddl.py", line 80, in _execute_on_connection
    return connection._execute_ddl(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1477, in _execute_ddl
    ret = self._execute_context(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1948, in _execute_context
    self._handle_dbapi_exception(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 2129, in _handle_dbapi_exception
    util.raise_(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\util\compat.py", line 211, in raise_
    raise exception
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1905, in _execute_context
    self.dialect.do_execute(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\engine\default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 108, in execute
    self._adapt_connection._handle_exception(error)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 236, in _handle_exception
    raise error
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 90, in execute
    self.await_(_cursor.execute(operation, parameters))
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 68, in await_only
    return current.driver.switch(awaitable)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 121, in greenlet_spawn
    value = await result
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\cursor.py", line 48, in execute
    await self._execute(self._cursor.execute, sql, parameters)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\cursor.py", line 40, in _execute
    return await self._conn._execute(fn, *args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\core.py", line 133, in _execute
    return await future
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\aiosqlite\core.py", line 106, in run
    result = function()
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table block_type already exists
[SQL:
CREATE TABLE block_type (
        id CHAR(36) DEFAULT (
    (
        lower(hex(randomblob(4)))
        || '-'
        || lower(hex(randomblob(2)))
        || '-4'
        || substr(lower(hex(randomblob(2))),2)
        || '-'
        || substr('89ab',abs(random()) % 4 + 1, 1)
        || substr(lower(hex(randomblob(2))),2)
        || '-'
        || lower(hex(randomblob(6)))
    )
    ) NOT NULL,
        created DATETIME DEFAULT (strftime('%Y-%m-%d %H:%M:%f000', 'now')) NOT NULL,
        updated DATETIME DEFAULT (strftime('%Y-%m-%d %H:%M:%f000', 'now')) NOT NULL,
        name VARCHAR NOT NULL,
        logo_url VARCHAR,
        documentation_url VARCHAR,
        CONSTRAINT pk_block_type PRIMARY KEY (id)
)

]
(Background on this error at: https://sqlalche.me/e/14/e3q8)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\starlette\datastructures.py", line 702, in __getattr__
    return self._state[key]
KeyError: 'services'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User\Documents\Integracion Evidently\examples\integrations\postgres_grafana_batch_monitoring\src\pipelines\scheduler.py", line 69, in <module>
    scheduled_flow(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\flows.py", line 468, in __call__
    return enter_flow_run_engine_from_flow_call(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\engine.py", line 182, in enter_flow_run_engine_from_flow_call
    retval = from_sync.wait_for_call_in_loop_thread(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\_internal\concurrency\api.py", line 137, in wait_for_call_in_loop_thread
    return call.result()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\_internal\concurrency\calls.py", line 173, in result
    return self.future.result(timeout=timeout)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\_base.py", line 433, in result
    return self.__get_result()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\_base.py", line 389, in __get_result
    raise self._exception
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\_internal\concurrency\calls.py", line 218, in _run_async
    result = await coro
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\client\utilities.py", line 38, in with_injected_client
    async with client_context as new_client:
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\client\orchestration.py", line 2377, in __aenter__
    self._ephemeral_lifespan = await self._exit_stack.enter_async_context(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 556, in enter_async_context
    result = await _cm_type.__aenter__(cm)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 175, in __aenter__
    return await self.gen.__anext__()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\client\base.py", line 92, in app_lifespan_context
    await context.__aenter__()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\asgi_lifespan\_manager.py", line 102, in __aenter__
    await self._exit_stack.aclose()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 593, in aclose
    await self.__aexit__(None, None, None)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 651, in __aexit__
    raise exc_details[1]
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 634, in __aexit__
    cb_suppress = await cb(*exc_details)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\asgi_lifespan\_concurrency\asyncio.py", line 80, in __aexit__
    await self.task
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\asgi_lifespan\_manager.py", line 99, in __aenter__
    await self.startup()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\asgi_lifespan\_manager.py", line 45, in startup
    raise self._app_exception
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\asgi_lifespan\_concurrency\asyncio.py", line 63, in run_and_silence_cancelled
    await self.coroutine()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\asgi_lifespan\_manager.py", line 73, in run_app
    await self.app(scope, self.receive, self.send)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\asgi_lifespan\_manager.py", line 13, in app_with_state
    await app(scope, receive, send)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\fastapi\applications.py", line 284, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\starlette\applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\starlette\middleware\errors.py", line 149, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\api\server.py", line 116, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\starlette\middleware\cors.py", line 75, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\starlette\middleware\exceptions.py", line 55, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 20, in __call__
    raise e
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\starlette\routing.py", line 707, in __call__
    await self.lifespan(scope, receive, send)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\starlette\routing.py", line 677, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 175, in __aenter__
    return await self.gen.__anext__()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\api\server.py", line 485, in lifespan
    await stop_services()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\prefect\server\api\server.py", line 467, in stop_services
    if app.state.services:
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\starlette\datastructures.py", line 705, in __getattr__
    raise AttributeError(message.format(self.__class__.__name__, key))
AttributeError: 'State' object has no attribute 'services'