https://prefect.io logo
m

Malavika S Menon

07/13/2023, 8:30 AM
I created a deployment this way
Copy code
from prefect.deployments import Deployment
deployment = Deployment.build_from_flow(
        flow=flow,
        name="test",
        version=1,
        work_queue_name="default-queue",
        work_pool_name="default-agent-pool",
   )
deployment.apply()
But when I run
prefect deployment inspect
on it, its failing with this error
Copy code
Traceback (most recent call last):
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
    return fn(*args, **kwargs)
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/utilities/asyncutils.py", line 255, in coroutine_wrapper
    return call()
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/_internal/concurrency/calls.py", line 383, in __call__
    return self.result()
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/_internal/concurrency/calls.py", line 283, in result
    return self.future.result(timeout=timeout)
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/_internal/concurrency/calls.py", line 169, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/_internal/concurrency/calls.py", line 346, in _run_async
    result = await coro
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/cli/deployment.py", line 283, in inspect
    deployment_json["infrastructure"] = Block._from_block_document(
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/blocks/core.py", line 618, in _from_block_document
    else cls.get_block_class_from_schema(block_document.block_schema)
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/blocks/core.py", line 672, in get_block_class_from_schema
    return cls.get_block_class_from_key(block_schema_to_key(schema))
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/blocks/core.py", line 683, in get_block_class_from_key
    return lookup_type(cls, key)
  File "/root/.Envs/healthgraph/lib/python3.8/site-packages/prefect/utilities/dispatch.py", line 185, in lookup_type
    raise KeyError(
KeyError: "No class found for dispatch key 'process' in registry for type 'Block'."
An exception occurred.
@Marvin what am I doing wrong here?
m

Marvin

07/13/2023, 8:31 AM
Well, it seems we've found some relevant information. From the Prefect discourse thread, it appears that this error can occur when a necessary package is not installed in your container. The suggested solution is to include the necessary package in your Dockerfile using
RUN pip install <package>
. In your case, it seems like the 'process' dispatch key is missing. This might be due to a missing or improperly installed package related to the 'process' block. From the GitHub issue, it seems that there was a similar issue with a custom block not being found after an update to Prefect. The user was able to resolve the issue by downgrading to a previous version of Prefect. Based on these findings, I would suggest the following: 1. Check if all necessary packages related to the 'process' block are installed in your container. If not, install them using
RUN pip install <package>
in your Dockerfile. 2. If the issue persists, consider downgrading to a previous version of Prefect to see if that resolves the issue. Remember, it's always important to keep track of your dependencies. It's like keeping track of your keys, you never know when you'll need them.
m

Malavika S Menon

07/13/2023, 8:33 AM
It is after a prefect upgrade the error is occurring, but downgrading is not an option. What are the relevant dependencies for process and their corresponding versions I can check? So far all libraries are satisfied as per the prefect requirements.txt file
what are the packages related to 'process' block @Marvin?
m

Marvin

07/18/2023, 11:27 AM
Oh, the joys of programming. Here are a couple of related packages for the 'process' block: 1. process.py from the
prefect/workers
directory. It's a module containing the Process worker used for executing flow runs as subprocesses. 2. process.py from the
prefect/infrastructure
directory. This one contains methods for handling infrastructure processes. Of course, these are just basic Python files in the Prefect library. Don't get your hopes up. The universe is mostly filled with hydrogen and ignorance.
2 Views