https://prefect.io logo
Docs
Join the conversationJoin Slack
Channels
announcements
ask-marvin
best-practices-coordination-plane
data-ecosystem
data-tricks-and-tips
events
find-a-prefect-job
geo-australia
geo-bay-area
geo-berlin
geo-boston
geo-chicago
geo-colorado
geo-dc
geo-israel
geo-japan
geo-london
geo-nyc
geo-seattle
geo-texas
gratitude
introductions
marvin-in-the-wild
prefect-ai
prefect-aws
prefect-azure
prefect-cloud
prefect-community
prefect-contributors
prefect-dbt
prefect-docker
prefect-gcp
prefect-getting-started
prefect-integrations
prefect-kubernetes
prefect-recipes
prefect-server
prefect-ui
random
show-us-what-you-got
Powered by Linen
prefect-community
  • k

    Khuyen Tran

    12/07/2022, 4:30 PM
    Are you looking for a way to create an ML powered prediction service in minutes? In Prefect Live at 3PM Eastern today, Tim Liu, the head of product at BentoML, will talk about how to ship your models to production in minutesπŸš€ Come join us live on Twitch or YouTube.
    πŸŽ‰ 2
    🍱 1
    :party-parrot: 1
    :prefect-duck: 2
    • 1
    • 1
  • a

    Adam Roderick

    12/07/2022, 5:08 PM
    We are seeing some odd behavior when connecting to Snowflake from a task using the snowflake connector. This works:
    for doc in query:
    , but it appears to load the entire resultset into memory before enumerating the rows. The better practice is to use
    doc = query.fetchone()
    while doc: 
      doc = query.fetchone()
    However, this hangs immediately when run from within a task. Has anyone else seen this behavior? Any idea why it might be behaving this way?
    d
    • 2
    • 4
  • d

    David Anderson

    12/07/2022, 5:09 PM
    i recently upgraded our airbyte from 40.14 to 40.23, and im now encountering an error with prefect (1.2.4) triggering airbyte runs. the error message we're seeing in our logs is below. anyone else run into a similar issue with newer releases of airbyte recently? im wondering / guessing if this is related to a change in the airbyte API.
    Task 'AirbyteConnectionTask': Exception encountered during task execution!
    Traceback (most recent call last):
      File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/models.py", line 971, in json
        return complexjson.loads(self.text, **kwargs)
      File "/usr/lib64/python3.7/site-packages/simplejson/__init__.py", line 488, in loads
        return _default_decoder.decode(s)
      File "/usr/lib64/python3.7/site-packages/simplejson/decoder.py", line 374, in decode
        obj, end = self.raw_decode(s)
      File "/usr/lib64/python3.7/site-packages/simplejson/decoder.py", line 393, in raw_decode
        return self.scan_once(s, idx=_w(s, idx).end())
    simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/ec2-user/.local/lib/python3.7/site-packages/prefect/tasks/airbyte/airbyte.py", line 67, in _check_health_status
        self.logger.debug("Health check response: %s", response.json())
      File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/models.py", line 975, in json
        raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/ec2-user/.local/lib/python3.7/site-packages/prefect/engine/task_runner.py", line 884, in get_task_run_state
        logger=self.logger,
      File "/home/ec2-user/.local/lib/python3.7/site-packages/prefect/utilities/executors.py", line 468, in run_task_with_timeout
        return task.run(*args, **kwargs)  # type: ignore
      File "/home/ec2-user/.local/lib/python3.7/site-packages/prefect/utilities/tasks.py", line 456, in method
        return run_method(self, *args, **kwargs)
      File "/home/ec2-user/.local/lib/python3.7/site-packages/prefect/tasks/airbyte/airbyte.py", line 333, in run
        session = airbyte._establish_session()
      File "/home/ec2-user/.local/lib/python3.7/site-packages/prefect/tasks/airbyte/airbyte.py", line 60, in _establish_session
        if self._check_health_status(session):
      File "/home/ec2-user/.local/lib/python3.7/site-packages/prefect/tasks/airbyte/airbyte.py", line 76, in _check_health_status
        raise AirbyteServerNotHealthyException(e)
    prefect.tasks.airbyte.airbyte.AirbyteServerNotHealthyException: Expecting value: line 1 column 1 (char 0)
    n
    • 2
    • 4
  • Setting up an EC2 agent service
    j

    Jarvis Stubblefield

    12/07/2022, 6:01 PM
    So I noticed this last night as I was getting everything setup, but it would seem that my Work Queue is
    unhealthy
    … I went back and ensured that my starting of the agent in production was using the correct queue. It appears to be spelled correctly and everything. However, the
    unhealthy
    bit has never gone away and it doesn’t have a
    last polled date
    .
    βœ… 1
    k
    • 2
    • 53
  • y

    Yoanis Gil

    12/07/2022, 6:05 PM
    Hi there. Is there some documentation I can read on running prefect on on spot instances (GCP)? Kinda curious if that something that will work and if so, what setup is require.
    βœ… 1
    k
    • 2
    • 2
  • j

    Jared Robbins

    12/07/2022, 6:14 PM
    I feel like the coolest kid on the block after seeing my handle in the contributors section for 2.7.0 lol
    πŸ™Œ 8
    :blob-attention-gif: 3
    βœ… 3
    j
    • 2
    • 2
  • s

    Slackbot

    12/07/2022, 6:26 PM
    This message was deleted.
    s
    • 2
    • 5
  • KeyError with environment variable
    s

    Samuel Kohlleffel

    12/07/2022, 6:29 PM
    Hello, it appears that creating a flow deployment fails when I set an env var as the default value for a task input parameter. I assume that's because the environment that creates the flow deployment (GitHub Actions Runner) doesn't have that env var set. Is this a bug? I feel like I should be able to create and apply the deployment with no issues. Examples in thread.
    βœ… 1
    p
    • 2
    • 14
  • t

    Tomas Moreno

    12/07/2022, 6:34 PM
    hey all! I'd like to invite an outlook group to our prefect instance. I sent the first email and it was caught up in some email filters. I tweaked our filters but now when I resend the invite no email comes. is there any way to force send another email?
    βœ… 1
    b
    • 2
    • 2
  • b

    Braun Reyes

    12/07/2022, 7:04 PM
    hello! In regards to using ECSTask as infrastructure are folks doing a block per flow, blocks per flow(different task definitions available to different flow deployments for a single flow) or single block with infra overrides? I want to give people the option to pull in secrets and EFS volume stuff as needed.
  • b

    Bradley Hurley

    12/07/2022, 7:16 PM
    Hi Prefect Folks - I am running Prefect 1.x and using Kubernetes Agents with Dask pods to execute tasks. I’ve had the need to create my own
    StorageSchema
    . Is there a recommended approach to ensuring my custom StorageSchema is globally accessible in the
    StorageSchema.type_schemas
    ? As a workaround we are calling
    StorageSchema.type_schemas["MyCustomStorageSchema"] = MyCustomStorageSchema
    in our CLI wrapper before creating agents so that the custom schema is accessible, but when we create child flows via Dask workers the custom storage is not set and the flow fails.
    1️⃣ 1
    • 1
    • 1
  • Setup Prefect agent as background process
    s

    Scott Chamberlain

    12/07/2022, 7:27 PM
    I’m trying to sort out how to run prefect agents as background processes. Running an agent alone interactively works well (connects with work queue perfectly). But then I tried to run as a background process using supervisor via systemctl, and the agent is running, but it’s not connected to the work queue previously created - the work queue in the app.prefect.cloud UI is in an unhealthy state. Any troubleshooting tips?
    βœ… 1
    n
    • 2
    • 5
  • i

    Ilya Galperin

    12/07/2022, 8:19 PM
    Is there an easy to way to order or otherwise somehow identify tasks based on runtime i.e. if we want to further evaluate long-running tasks in a flow? The only sorting mechanism in the UI is by age it looks like.
    m
    • 2
    • 2
  • z

    Zachary Loertscher

    12/07/2022, 9:17 PM
    Hi all, I'm running into an issue where Prefect is not detecting new packages I add to the requirements.txt (specifically the prefect
    sql_server
    extra and
    pyodbc
    package). We are running Prefect 1.2.0. Deployment is successful, and the flow is successfully registered (the imports in my
    .py
    script run successfully), but Prefect Cloud can't find the package:
    Failed to load and execute flow run: ImportError('Using prefect.tasks.sql_server requires Prefect to be installed with the "sql_server" extra.')
    Is there a way to re-sync prefect-cloud with my docker container? Just seems like Prefect cloud isn't finding the packages I have installed on my container
    p
    • 2
    • 1
  • m

    Michael Cody

    12/07/2022, 10:02 PM
    I'm trying to update the logging formatter datefmt: I tried
    prefect config set PREFECT_LOGGING_FORMATTERS_SIMPLE_DATEFMT="%Y-%m-%d %H:%M:%S"
    which return
    "Unknown setting name 'PREFECT_LOGGING_FORMATTERS_SIMPLE_DATEFMT'"
    . If I try
    prefect config set PREFECT_LOGGING_HANDLERS_CONSOLE_FORMATTER=json
    from this this message from a month ago, I get the same error. This should be simple but I think I'm missing something. Editing the logging config works, but I'd rather have it in the profile instead of copying the logging.yml file. Thanks. https://prefect-community.slack.com/archives/CL09KU1K7/p1666798948425739?thread_ts=1666794116.134359&cid=CL09KU1K7
    m
    • 2
    • 2
  • Prefect 2.0 Architecture Overview
    p

    Paige Gulley

    12/07/2022, 10:39 PM
    Hi! I'm in the process of trying to make an argument for prefect to a team- I'm wondering it the prefect developers have published an 'architecture overview' or anything, to help assess the technical costs of the tool vs other similar products like airflow
    t
    a
    m
    • 4
    • 11
  • m

    Mike Grabbe

    12/07/2022, 11:31 PM
    I've noticed an odd logging behavior in Prefect 2 where sometimes strings that contain brackets
    [
    ]
    aren't being logged correctly. Has anyone else noticed this? Details in 🧡
    βœ… 1
    a
    • 2
    • 12
  • w

    wonsun

    12/08/2022, 4:51 AM
    Hi all~ I'm trying to migrate to prefect2.0. But i don't know how connect the local to cloud. Following the description for how to start the prefect 2.0 from mail sended by Prefect Developer Experience, they said Create the API Key for login after creating workspace. But i couldn't see the API Keys menu at my UI. Is it because I'm alone in the workspace? Actually, What I really need is "*Configure a local execution environment to use Prefect Cloud.*" When i tried to start the orion server without API keys, IP address and default port are already in use. (attached the capture at this thead.)
    o
    • 2
    • 5
  • m

    Mahesh

    12/08/2022, 6:22 AM
    Hi Team, How to get flow logs using command line in prefect2? In prefect1 we can use
    prefect get
    command to get logs.
    βœ… 1
    r
    p
    +2
    • 5
    • 14
  • o

    OlivΓ©r Atanaszov

    12/08/2022, 11:27 AM
    Hi, what is the recommended way of adding a handle for flow run interruption in Prefect 1.0 (similarly to
    on_handle
    argument of
    Flow
    )?
    βœ… 1
    1️⃣ 1
    a
    • 2
    • 10
  • s

    Sunjay

    12/08/2022, 2:17 PM
    Hi Team, I created a custom block with some functionality an registered the block on the UI. I made a few changes to the block and registered this block again but I am still seeing old functionality. So is there a way to delete an existing block from the workspace or to overwrite an existing block.(custom block)
    βœ… 2
    m
    j
    • 3
    • 10
  • k

    Kelvin DeCosta

    12/08/2022, 2:28 PM
    Hey everyone! Was wondering if there's a
    flake8
    (or any other linter) plugin to check for
    prefect
    specific code issues. The main issue I find myself making is calling a
    task
    from another one. I don't think a static type checker can detect this type of issue. There are probably more issues that are waiting to be discovered and I think it would benefit the community if there was a linting tool that accounted for
    prefect
    πŸ‘€ 2
    m
    j
    • 3
    • 2
  • n

    Nathan R

    12/08/2022, 2:37 PM
    Hi All, can you pass deployment parameters to the create flow run API when you transition it to scheduled? httpπŸ˜•/&lt;IP&gt;:4200/api/deployments/<deployment_id>create_flow_run body -> {"name":"curl","state":{"type":"SCHEDULED"}}
    m
    • 2
    • 1
  • b

    Babak

    12/08/2022, 5:20 PM
    Hi team, I had some deployment, Flow in my Prefect Cloud. I restart my laptop and they all gone. do you have any idea?
    m
    • 2
    • 1
  • a

    Ashley Felber

    12/08/2022, 5:25 PM
    Hello, I have created a deployment using an ECStask block. The ECStask block is configured to run an existing task definition. When I try to run the deployment I get the following error: Submission failed. KeyError: "No class found for dispatch key 'ecs-task' in registry for type 'Block'." This error shows up under details of the flow run but there are no other logs.
    j
    j
    • 3
    • 5
  • What is an ECS Task in Prefect
    c

    Chris Gunderson

    12/08/2022, 5:51 PM
    Hi Team - Is the ECS Task basically the agent listening to the work queue?
    m
    • 2
    • 1
  • k

    Kyle McChesney

    12/08/2022, 5:59 PM
    Is there any more in-depth documentation for the Lazarus retry in v1 besides: https://docs-v1.prefect.io/orchestration/concepts/services.html#lazarus. I am seeing some weird behavior where I have a flow run that got restarted, and according to the logs the entire thing re-ran, but according to the flow run visual display, it tried to pick up where it left off. It caused a number of downstream tasks to fail, instead of receiving their inputs from upstream tasks which ran before the restart, they seemingly got passed
    None
    .
    j
    • 2
    • 1
  • s

    Slackbot

    12/08/2022, 6:22 PM
    This message was deleted.
  • m

    merlin

    12/08/2022, 6:22 PM
    Prefect profile: changing profile in one virtual environment is reflected in other virtual environments on the same machine. I'm confused about using profiles. Details in thread.
    j
    m
    • 3
    • 11
  • s

    Sean Conroy

    12/08/2022, 7:44 PM
    Seeing the following
    run_migrations
    error using Prefect 2.7.0...full traceback in the reply. Anyone familiar with this?
    m
    j
    • 3
    • 10
Powered by Linen
Title
s

Sean Conroy

12/08/2022, 7:44 PM
Seeing the following
run_migrations
error using Prefect 2.7.0...full traceback in the reply. Anyone familiar with this?
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions)(**req.view_args)
  File "/main.py", line 99, in default_route_main
    location_state = location_flow(atcore_event, ou_event, 'location', version_dict, account_id, return_state=True)
  File "/usr/local/lib/python3.8/dist-packages/prefect/flows.py", line 442, in __call__
    return enter_flow_run_engine_from_flow_call(
  File "/usr/local/lib/python3.8/dist-packages/prefect/engine.py", line 157, in enter_flow_run_engine_from_flow_call
    return anyio.run(begin_run)
  File "/usr/local/lib/python3.8/dist-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/usr/local/lib/python3.8/dist-packages/prefect/client/utilities.py", line 45, in with_injected_client
    async with client_context as new_client:
  File "/usr/local/lib/python3.8/dist-packages/prefect/client/orion.py", line 1868, in __aenter__
    self._ephemeral_lifespan = await self._exit_stack.enter_async_context(
  File "/usr/lib/python3.8/contextlib.py", line 568, in enter_async_context
    result = await _cm_type.__aenter__(cm)
  File "/usr/lib/python3.8/contextlib.py", line 171, in __aenter__
    return await self.gen.__anext__()
  File "/usr/local/lib/python3.8/dist-packages/prefect/client/base.py", line 85, in app_lifespan_context
    await context.__aenter__()
  File "/usr/local/lib/python3.8/dist-packages/asgi_lifespan/_manager.py", line 92, in __aenter__
    await self._exit_stack.aclose()
  File "/usr/lib/python3.8/contextlib.py", line 621, in aclose
    await self.__aexit__(None, None, None)
  File "/usr/lib/python3.8/contextlib.py", line 679, in __aexit__
    raise exc_details[1]
  File "/usr/lib/python3.8/contextlib.py", line 662, in __aexit__
    cb_suppress = await cb(*exc_details)
  File "/usr/local/lib/python3.8/dist-packages/asgi_lifespan/_concurrency/asyncio.py", line 80, in __aexit__
    await self.task
  File "/usr/local/lib/python3.8/dist-packages/asgi_lifespan/_manager.py", line 90, in __aenter__
    await self.startup()
  File "/usr/local/lib/python3.8/dist-packages/asgi_lifespan/_manager.py", line 36, in startup
    raise self._app_exception
  File "/usr/local/lib/python3.8/dist-packages/asgi_lifespan/_concurrency/asyncio.py", line 63, in run_and_silence_cancelled
    await self.coroutine()
  File "/usr/local/lib/python3.8/dist-packages/asgi_lifespan/_manager.py", line 64, in run_app
    await <http://self.app|self.app>(scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 149, in __call__
    await <http://self.app|self.app>(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/cors.py", line 76, in __call__
    await <http://self.app|self.app>(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/exceptions.py", line 55, in __call__
    await <http://self.app|self.app>(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/usr/local/lib/python3.8/dist-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await <http://self.app|self.app>(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 695, in __call__
    await self.lifespan(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 671, in lifespan
    async with self.lifespan_context(app):
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 566, in __aenter__
    await self._router.startup()
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 648, in startup
    await handler()
  File "/usr/local/lib/python3.8/dist-packages/prefect/orion/api/server.py", line 345, in run_migrations
    await db.create_db()
  File "/usr/local/lib/python3.8/dist-packages/prefect/orion/database/interface.py", line 55, in create_db
    await self.run_migrations_upgrade()
  File "/usr/local/lib/python3.8/dist-packages/prefect/orion/database/interface.py", line 63, in run_migrations_upgrade
    await run_sync_in_worker_thread(alembic_upgrade)
  File "/usr/local/lib/python3.8/dist-packages/prefect/utilities/asyncutils.py", line 68, in run_sync_in_worker_thread
    return await anyio.to_thread.run_sync(call, cancellable=True)
  File "/usr/local/lib/python3.8/dist-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.8/dist-packages/prefect/orion/database/alembic_commands.py", line 29, in alembic_upgrade
    alembic.command.upgrade(alembic_config(), revision, sql=dry_run)
  File "/usr/local/lib/python3.8/dist-packages/alembic/command.py", line 322, in upgrade
    script.run_env()
  File "/usr/local/lib/python3.8/dist-packages/alembic/script/base.py", line 569, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/usr/local/lib/python3.8/dist-packages/alembic/util/pyfiles.py", line 94, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/local/lib/python3.8/dist-packages/alembic/util/pyfiles.py", line 110, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.8/dist-packages/prefect/orion/database/migrations/env.py", line 147, in <module>
    apply_migrations()
  File "/usr/local/lib/python3.8/dist-packages/prefect/utilities/asyncutils.py", line 197, in coroutine_wrapper
    return run_async_from_worker_thread(async_fn, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/prefect/utilities/asyncutils.py", line 148, in run_async_from_worker_thread
    return anyio.from_thread.run(call)
  File "/usr/local/lib/python3.8/dist-packages/anyio/from_thread.py", line 49, in run
    return asynclib.run_async_from_thread(func, *args)
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 970, in run_async_from_thread
    return f.result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 444, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.8/dist-packages/prefect/orion/database/migrations/env.py", line 141, in apply_migrations
    await connection.run_sync(do_run_migrations)
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/ext/asyncio/engine.py", line 548, in run_sync
    return await greenlet_spawn(fn, conn, *arg, **kw)
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 128, in greenlet_spawn
    result = context.switch(value)
  File "/usr/local/lib/python3.8/dist-packages/prefect/orion/database/migrations/env.py", line 129, in do_run_migrations
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/usr/local/lib/python3.8/dist-packages/alembic/runtime/environment.py", line 853, in run_migrations
m

Michael Adkins

12/08/2022, 7:49 PM
Hmm where’s the actual error? I think we need more still πŸ™‚
s

Sean Conroy

12/08/2022, 8:12 PM
I know! Unfortunately, that's where it cuts off...not sure if GCP maxxed out on the traceback or something. However, there is this error right above it:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 108, in execute
    self._adapt_connection._handle_exception(error)
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 236, in _handle_exception
    raise error
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 90, in execute
    self.await_(_cursor.execute(operation, parameters))
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 68, in await_only
    return current.driver.switch(awaitable)
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 121, in greenlet_spawn
    value = await result
  File "/usr/local/lib/python3.8/dist-packages/aiosqlite/cursor.py", line 37, in execute
    await self._execute(self._cursor.execute, sql, parameters)
  File "/usr/local/lib/python3.8/dist-packages/aiosqlite/cursor.py", line 31, in _execute
    return await self._conn._execute(fn, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/aiosqlite/core.py", line 129, in _execute
    return await future
  File "/usr/local/lib/python3.8/dist-packages/aiosqlite/core.py", line 102, in run
    result = function()
sqlite3.OperationalError: table block_type already exists
m

Michael Adkins

12/08/2022, 8:17 PM
This might be related to https://github.com/PrefectHQ/prefect/pull/7789
s

Sean Conroy

12/08/2022, 8:19 PM
Yes - I was hoping this would be resolved by the latest release! Unfortunately I'm using
git+<https://github.com/PrefectHQ/prefect@main>
to install Prefect, and I built the docker image this morning, so it looks like it's still an issue....
m

Michael Adkins

12/08/2022, 8:33 PM
😒
If you can get ahold of a full traceback and open an issue we’ll investigate
πŸ‘ 1
j

John-Craig Borman

12/09/2022, 6:31 PM
I am also encountering the same issue when trying to standup the orion webserver to run some tests against the orion client - I can't get the FastAPI app to start because
block_type
already exists
------------------------------------------------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------------------------------------------------
ERROR:    Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 108, in execute
    self._adapt_connection._handle_exception(error)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 236, in _handle_exception
    raise error
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 90, in execute
    self.await_(_cursor.execute(operation, parameters))
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 68, in await_only
    return current.driver.switch(awaitable)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 121, in greenlet_spawn
    value = await result
  File "/usr/local/lib/python3.10/dist-packages/aiosqlite/cursor.py", line 37, in execute
    await self._execute(self._cursor.execute, sql, parameters)
  File "/usr/local/lib/python3.10/dist-packages/aiosqlite/cursor.py", line 31, in _execute
    return await self._conn._execute(fn, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/aiosqlite/core.py", line 129, in _execute
    return await future
  File "/usr/local/lib/python3.10/dist-packages/aiosqlite/core.py", line 102, 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 "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 671, in lifespan
    async with self.lifespan_context(app):
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 566, in __aenter__
    await self._router.startup()
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 648, in startup
    await handler()
  File "/usr/local/lib/python3.10/dist-packages/prefect/orion/api/server.py", line 345, in run_migrations
    await db.create_db()
  File "/usr/local/lib/python3.10/dist-packages/prefect/orion/database/interface.py", line 55, in create_db
    await self.run_migrations_upgrade()
  File "/usr/local/lib/python3.10/dist-packages/prefect/orion/database/interface.py", line 63, in run_migrations_upgrade
    await run_sync_in_worker_thread(alembic_upgrade)
  File "/usr/local/lib/python3.10/dist-packages/prefect/utilities/asyncutils.py", line 69, in run_sync_in_worker_thread
    return await anyio.to_thread.run_sync(call, cancellable=True)
  File "/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/dist-packages/prefect/orion/database/alembic_commands.py", line 24, in wrapper
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/prefect/orion/database/alembic_commands.py", line 53, in alembic_upgrade
    alembic.command.upgrade(alembic_config(), revision, sql=dry_run)
  File "/usr/local/lib/python3.10/dist-packages/alembic/command.py", line 322, in upgrade
    script.run_env()
  File "/usr/local/lib/python3.10/dist-packages/alembic/script/base.py", line 569, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/usr/local/lib/python3.10/dist-packages/alembic/util/pyfiles.py", line 94, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/local/lib/python3.10/dist-packages/alembic/util/pyfiles.py", line 110, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.10/dist-packages/prefect/orion/database/migrations/env.py", line 147, in <module>
    apply_migrations()
  File "/usr/local/lib/python3.10/dist-packages/prefect/utilities/asyncutils.py", line 201, in coroutine_wrapper
    return run_async_from_worker_thread(async_fn, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/prefect/utilities/asyncutils.py", line 152, in run_async_from_worker_thread
    return anyio.from_thread.run(call)
  File "/usr/local/lib/python3.10/dist-packages/anyio/from_thread.py", line 49, in run
    return asynclib.run_async_from_thread(func, *args)
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 970, in run_async_from_thread
    return f.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.10/dist-packages/prefect/orion/database/migrations/env.py", line 141, in apply_migrations
    await connection.run_sync(do_run_migrations)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/ext/asyncio/engine.py", line 548, in run_sync
    return await greenlet_spawn(fn, conn, *arg, **kw)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 128, in greenlet_spawn
    result = context.switch(value)
  File "/usr/local/lib/python3.10/dist-packages/prefect/orion/database/migrations/env.py", line 129, in do_run_migrations
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/usr/local/lib/python3.10/dist-packages/alembic/runtime/environment.py", line 853, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/local/lib/python3.10/dist-packages/alembic/runtime/migration.py", line 623, in run_migrations
    step.migration_fn(**kw)
  File "/usr/local/lib/python3.10/dist-packages/prefect/orion/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 "/usr/local/lib/python3.10/dist-packages/alembic/operations/ops.py", line 1254, in create_table
    return operations.invoke(op)
  File "/usr/local/lib/python3.10/dist-packages/alembic/operations/base.py", line 399, in invoke
    return fn(self, operation)
  File "/usr/local/lib/python3.10/dist-packages/alembic/operations/toimpl.py", line 114, in create_table
    operations.impl.create_table(table)
  File "/usr/local/lib/python3.10/dist-packages/alembic/ddl/impl.py", line 354, in create_table
    self._exec(schema.CreateTable(table))
  File "/usr/local/lib/python3.10/dist-packages/alembic/ddl/impl.py", line 195, in _exec
    return conn.execute(construct, multiparams)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/future/engine.py", line 280, in execute
    return self._execute_20(
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1705, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/sql/ddl.py", line 80, in _execute_on_connection
    return connection._execute_ddl(
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1472, in _execute_ddl
    ret = self._execute_context(
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context
    self._handle_dbapi_exception(
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapi_exception
    util.raise_(
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/compat.py", line 210, in raise_
    raise exception
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 108, in execute
    self._adapt_connection._handle_exception(error)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 236, in _handle_exception
    raise error
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/dialects/sqlite/aiosqlite.py", line 90, in execute
    self.await_(_cursor.execute(operation, parameters))
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 68, in await_only
    return current.driver.switch(awaitable)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 121, in greenlet_spawn
    value = await result
  File "/usr/local/lib/python3.10/dist-packages/aiosqlite/cursor.py", line 37, in execute
    await self._execute(self._cursor.execute, sql, parameters)
  File "/usr/local/lib/python3.10/dist-packages/aiosqlite/cursor.py", line 31, in _execute
    return await self._conn._execute(fn, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/aiosqlite/core.py", line 129, in _execute
    return await future
  File "/usr/local/lib/python3.10/dist-packages/aiosqlite/core.py", line 102, 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>)

ERROR:    Application startup failed. Exiting.
m

Michael Adkins

12/09/2022, 6:43 PM
Thanks for the report! Would you mind opening an issue?
View count: 4