Thread
#prefect-community
    E Li

    E Li

    6 months ago
    Hi, I am running on prefect UI and getting this attribute error: can't get attribute 'get_target_name" on <module prefect_scripts.tasks.trade_cache_tasks'. the trade_cache_task is like below, similar structure works fine on other scripts, anyone has any ideas?
    def get_target_name(x, **kwargs):
    	…
    	return target_name
    
    def get_task_name(x, **kwargs):
    	…
    	return task_name
    
    @task(task_run_name=get_task_name,target=get_target_name,checkpoint=True,result=LocalResult())
    def task_a(x, y, z):
    	…
    	return
    Kevin Kho

    Kevin Kho

    6 months ago
    Looking into this
    how do you import these in your flow file?
    E Li

    E Li

    6 months ago
    they are on the same script
    and it works well with flow.run() on my local win machine
    Kevin Kho

    Kevin Kho

    6 months ago
    What storage are you using?
    E Li

    E Li

    6 months ago
    local
    Kevin Kho

    Kevin Kho

    6 months ago
    Do you other scripts use mapping too? Are you using the LocalDaskExecutor here?
    E Li

    E Li

    6 months ago
    yes, other scripts use mapping too and daskExecutor
    Kevin Kho

    Kevin Kho

    6 months ago
    I am pretty confused by this. I think i’d need a reproducible example to see because the same setup works for your other scripts right?
    E Li

    E Li

    6 months ago
    correct. so if i have a dask scheduler and a few dask workers, and prefect server is running on the scheduler, do i need to have the same python scripts saved on each worker?
    Kevin Kho

    Kevin Kho

    6 months ago
    No because the work gets sent to the Dask scheduler and sent to a worker but all the dependencies of the work are serialized together and sent together with cloudpickle so you just need them in memory
    E Li

    E Li

    6 months ago
    so i ended up with redeploy my code, and it just works, not sure exactly what went wrong before
    Kevin Kho

    Kevin Kho

    6 months ago
    Oh ok that’s good to know. I guess this may happen when the code is out of sync with the registered version
    E Li

    E Li

    6 months ago
    on a different topic, is graphql-engine v1.3.3 compatible with other images at version of 0.15.5?
    Kevin Kho

    Kevin Kho

    6 months ago
    I think so
    E Li

    E Li

    6 months ago
    i got this error when register flow with v1.3.3
    File "/home/monjuu-g/dev/conda-pyFullReval/totoro_fv_env/lib/python3.6/site-packages/prefect/client/client.py", line 569, in graphql raise ClientError(result["errors"]) prefect.exceptions.ClientError: [{'message': '[{'extensions': {'path': '$.selectionSet.flow_group.args.where._and[0].tenant_id._eq', 'code': 'validation-failed'}, 'message': 'unexpected null value for type "uuid"'}]', 'locations': [{'line': 2, 'column': 5}], 'path': ['create_flow_from_compressed_string'], 'extensions': {'code': 'INTERNAL_SERVER_ERROR', 'exception': {'message': '[{'extensions': {'path': '$.selectionSet.flow_group.args.where._and[0].tenant_id._eq', 'code': 'validation-failed'}, 'message': 'unexpected null value for type "uuid"'}]'}}}]
    i have a tenant, do i also need to assign an uuid to it?
    Kevin Kho

    Kevin Kho

    6 months ago
    I think this is something like the migrations did not run. Did you upgrade and then this happened?
    E Li

    E Li

    6 months ago
    yeah, i took down the containers, updated docker-compose.yml and ran sudo dock-compose -f ... --env-file ... up -d
    Kevin Kho

    Kevin Kho

    6 months ago
    Can you try running the migrations manually like mentioned here ?
    E Li

    E Li

    6 months ago
    database updated successfully with docker exec graphqlContainerName prefect-server database upgrade -y, but still got the error
    Kevin Kho

    Kevin Kho

    6 months ago
    Will have to ask the team aviyt tgus
    E Li

    E Li

    6 months ago
    figured it out, so the tenant for that flow is null
    that project*
    Kevin Kho

    Kevin Kho

    6 months ago
    You have more than one tenant?
    E Li

    E Li

    6 months ago
    i think the UI is not connected to hasura, i can register the flow but can only see it in hasura with queries not on UI, likewise, the project i created on UI has tenant as null
    so as you said, it's like the db is not connected?
    Kevin Kho

    Kevin Kho

    6 months ago
    UI might not be connected to the database? The interactive API is a good way to test
    E Li

    E Li

    6 months ago
    ok i am confused, interactive api can query the flows and everything, but flows are not shown up on ui
    Kevin Kho

    Kevin Kho

    6 months ago
    Maybe you can open the console of your browser to check for errors? How many tenants do you have?
    E Li

    E Li

    6 months ago
    just 1 tenant
    Kevin Kho

    Kevin Kho

    6 months ago
    Are there any errors when you open the browser console?
    E Li

    E Li

    6 months ago
    exception: 'unexpected null value for type "uuid", code: "validation-failed"
    Kevin Kho

    Kevin Kho

    6 months ago
    Asking the team
    E Li

    E Li

    6 months ago
    thank you
    Anna Geller

    Anna Geller

    6 months ago
    Some questions for troubleshooting:1. Did your agent and flow registration environment get upgraded too? 2. Doing DB migration was the right thing to do, but did you restart your Apollo container after the migration? You need to do it so that Apollo picks up the changes
    docker exec graphqlContainerName prefect-server database upgrade -y
    
    docker restart apolloContainerName
    E Li

    E Li

    6 months ago
    1. i only updated graphql-engine, the other images and environment are all in 0.15.5. I can see my agent, but just cannot see my flows
    2. I just executed the 2 cmd, still not able to see flows
    Anna Geller

    Anna Geller

    6 months ago
    ideally, when running Prefect with docker-compose (the default setup), you should normally have all images running the same "Prefect Core" version. This is what it typically looks like:
    any reason why you want to run mixed versions or why you can't start all services from scratch? can you explain your full setup - e.g. what is the full command you used to start your Server services? Did you attach a volume to your Postgres docker DB?
    E Li

    E Li

    6 months ago
    I just the changed image version for graphql-engine as the old one is no longer available on our internal site. i brought down the containers by
    docker-compose -f docker-compose.yml --env-file env down
    , modified the version in docker-compose.yml and start the containers by
    docker-compose -f docker-compose.yml --env-file env up -d
    Anna Geller

    Anna Geller

    6 months ago
    can you share that docker compose file?
    E Li

    E Li

    6 months ago
    Anna Geller

    Anna Geller

    6 months ago
    sorry, it's huge 🙈 can you perhaps say what did you change as compared to the default configuration? still don't entirely understand why you can't use the default command:
    prefect server start
    It would be easier if you shared the config command you used to generate this file to understand the changes you made
    prefect server config --help
    also - any reasons why you can't upgrade to the latest Prefect Core 1.1? I saw you are still using Python 3.6 - with that the highest version of Prefect you can get is the one you have right now. But if you upgrade Python to 3.7 or higher, you can get Prefect 1.1 which has many improvements
    /home/monjuu-g/dev/conda-pyFullReval/totoro_fv_env/lib/python3.6
    so the best solution would probably be just start from scratch in a fresh environment with Python >= 3.7, reinstall Prefect and start all server components again and you can still mount the same Postgres volume so that you don't lose your data. Then run DB migrations and restart Apollo and it should work in theory:
    docker exec graphqlContainerName prefect-server database upgrade -y
    
    docker restart apolloContainerName
    E Li

    E Li

    6 months ago
    this yml has been working fine in the past, the only thing i changed today is from
    image: "${DOCKER-REGISTRY}/hasura/graphql-engine:v1.3.1
    to
    mage: "${DOCKER-REGISTRY}/hasura/graphql-engine:latest
    , basically just a different version of graphql image. it's probably then just a compatible issue with python?
    Anna Geller

    Anna Geller

    6 months ago
    what was the reason for that change?
    E Li

    E Li

    6 months ago
    it's an internal update which removed the old version, i have asked to revert that back, the new one seems not working well
    Anna Geller

    Anna Geller

    6 months ago
    Gotcha. there must be some version incompatibility then. In general, we test the components so that the default versions picked up based on your Python and Prefect versions should work out of the box. And then it should work after running DB migrations. Keep us posted
    E Li

    E Li

    6 months ago
    sure, is there a reference table to look up the default version based on my python version?
    Kevin Kho

    Kevin Kho

    6 months ago
    Prefect 1.0 dropped support for Python 3.6 but is tested across 3.7-3.9. 0.15.0 and above should be compatible with 3.6-3.9 i think
    Anna Geller

    Anna Geller

    6 months ago
    is correct for Prefect core. If you're asking about Server components, each release has a docker-compose file as in here. E.g. the latest Server release uses GraphQL 2.1.1
    Kevin Kho

    Kevin Kho

    6 months ago
    It looks like graphql engine 2.1.1 is tied to 0.15.13 based on this PR.