A usage question regarding gitlab repository being a block for flow code during deployment…
I have Prefect 2.0 installed on AKS cluster with kubernetes agent.
Prefect gitlab collection is installed using cline
prefect block register -m prefect_gitlab
the block is registered with UI and appears in the output of the command
prefect block ls
with the slug gitlab-repository/gitlab-repo
During deployment run on the queue connected to the agent i see the following exception
Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 266, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 47, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/prefect/deployments.py", line 166, in load_flow_from_flow_run
storage_block = Block._from_block_document(storage_document)
File "/usr/local/lib/python3.10/site-packages/prefect/blocks/core.py", line 548, in _from_block_document
else cls.get_block_class_from_schema(block_document.block_schema)
File "/usr/local/lib/python3.10/site-packages/prefect/blocks/core.py", line 568, in get_block_class_from_schema
return lookup_type(cls, block_schema_to_key(schema))
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/dispatch.py", line 186, in lookup_type
raise KeyError(
KeyError: "No class found for dispatch key 'gitlab-repository' in registry for type 'Block'."
here’s the deployment snippet connected to the block
I followed the registration procedures and the Block is registered with the UI properly.
There is no problem with registering the block.
The exception I posted appears during run where the system is trying to use the Block to read the FLow.
It looks like it does not see the created Block Type (gitlab-repository)
I’ve been trying to see in the code how that magic setting works that was added to the latest release
Basically, it should register modules from the collections - based on the documentation gitlab collection should be added to Orion docker image, trying to play around with debug settings to see if I see that import piece appear in logs. But it was weird that I don’t see gitlab in the list of default modules in UI - maybe it was not included in the Orion build
For what it’s worth, I ran into this issue as well when working with Prefect through Docker. Seems there’s a workaround when using Docker, as you can trigger the package installation via the entrypoint in the docker compose file.
The first object in the list, "/opt/prefect/entrypoint.sh", triggers the EXTRA_PIP_PACKAGES to be installed. This got me past the issue here, though now I face a connectivity issue. I’m working on that now.