Thread
#prefect-community
    John O'Farrell

    John O'Farrell

    4 months ago
    Hello, I was trying to test getting a local flow up and running. Was able to successfully register and run it using the prefect cloud ui, but I tried switching to using the
    prefect.Client
    api to run the task and it threw an error
    Failed to load and execute flow run: TypeError("'ABCMeta' object is not subscriptable")
    . Now any subsequent attempt to run the flow using the prefect ui throws the same error, even though the code hasn't changed.
    Kevin Kho

    Kevin Kho

    4 months ago
    Are you on Cloud or Server? How did you use the
    prefect.Client
    ?
    John O'Farrell

    John O'Farrell

    4 months ago
    Prefect cloud. I ran
    client = prefect.Client(api_key='{key}')
    client.create_flow_run(flow_id='{flow_id}')
    Kevin Kho

    Kevin Kho

    4 months ago
    Does the flow actually get picked up by an agent and start? I think something is off with the flow definition here. Would you be able to share it?
    John O'Farrell

    John O'Farrell

    4 months ago
    This is the log of the agent
    [2022-05-18 18:32:36,501] INFO - agent | Deploying flow run {flow} to execution environment...
    INFO:agent:Deploying flow run {flow} to execution environment...
    [2022-05-18 18:32:36,717] INFO - agent | Completed deployment of flow run {flow}
    INFO:agent:Completed deployment of flow run {flow}
    [2022-05-18 18:33:07,669] INFO - agent | Process PID 15752 returned non-zero exit code 1!
    INFO:agent:Process PID 15752 returned non-zero exit code 1!
    But what I think might be the problem is that I'm realizing now that it doesn
    doesn't seem like it's actually storing anything in
    \.prefect\flows
    when I register it now
    Kevin Kho

    Kevin Kho

    4 months ago
    Are you using the CLI? Maybe because there was no change. You can use the
    --force
    flag to force the registration
    John O'Farrell

    John O'Farrell

    4 months ago
    I'm registering and launching the agent in python
    Kevin Kho

    Kevin Kho

    4 months ago
    Did you define a storage?
    John O'Farrell

    John O'Farrell

    4 months ago
    This is the code that I've been using to register
    flow.storage = Local(path='<http://src.app|src.app>', stored_as_script=True) flow.register(project_name="ingestion-pipeline")
    Kevin Kho

    Kevin Kho

    4 months ago
    This is pointing already to an existing file, which is why it wont serialize and write in the
    .prefect
    folder anymore. You path should be the Python file though
    Oh is
    <http://src.app|src.app>
    a module or folder?
    John O'Farrell

    John O'Farrell

    4 months ago
    It's a module, app.py is where the flow is defined
    Kevin Kho

    Kevin Kho

    4 months ago
    Ah that looks right then I think. You could try the default pickle storage though to see if storage is the problem here
    John O'Farrell

    John O'Farrell

    4 months ago
    When I try using the pickle storage is throws an error
    cannot pickle '_thread.lock' object
    . That's why I had been using local stoage and making sure it knows it's stored as a script
    Kevin Kho

    Kevin Kho

    4 months ago
    Ah ok. I assume you know why that happens. To the original error, nothing really rings a bell but you can try absolute path over module to see if that helps
    John O'Farrell

    John O'Farrell

    4 months ago
    Wait is
    \.prefect\flows
    only supposed to be used if
    stored_as_script=False
    Kevin Kho

    Kevin Kho

    4 months ago
    Yes that is the default location. But if you provide path=… and stored_as_script=False, it will save it there