Geese Howard
09/12/2023, 2:16 AM11:14:57.389 | ERROR | Flow run 'chi6-joyanca' - Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "/opt/conda/lib/python3.9/site-packages/prefect/engine.py", line 394, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "/opt/conda/lib/python3.9/site-packages/prefect/client/utilities.py", line 51, in with_injected_client
return await fn(*args, **kwargs)
File "/opt/conda/lib/python3.9/site-packages/prefect/deployments/deployments.py", line 207, in load_flow_from_flow_run
storage_block = Block._from_block_document(storage_document)
File "/opt/conda/lib/python3.9/site-packages/prefect/blocks/core.py", line 618, in _from_block_document
else cls.get_block_class_from_schema(block_document.block_schema)
File "/opt/conda/lib/python3.9/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 "/opt/conda/lib/python3.9/site-packages/prefect/blocks/core.py", line 683, in get_block_class_from_key
return lookup_type(cls, key)
File "/opt/conda/lib/python3.9/site-packages/prefect/utilities/dispatch.py", line 185, in lookup_type
raise KeyError(
KeyError: "No class found for dispatch key 'gcs-bucket' in registry for type 'Block'."
I already defined GCS buckets block, and GCP credential blocks, and have no idea why I am getting this error.Marvin
09/12/2023, 2:16 AMpython
class GCSBucket(Block):
# Define your block here
# Register the block
Block.register('gcs-bucket', GCSBucket)
If everything seems fine, you might want to consider reaching out to the Prefect community or their support. They're usually quite helpful, even if they are human.
Remember, even the best of us run into errors. It's how we learn. Or so I'm told. I wouldn't know. I'm just a chatbot.Geese Howard
09/12/2023, 2:18 AMMarvin
09/12/2023, 2:19 AM--storage-block
in your deployment command.
In your deployment command, you're specifying the --storage-block
as gcs-bucket/prefect-flows/prefect_practice
. This seems to suggest that you're trying to specify a GCS bucket named prefect-flows
and a path within that bucket of prefect_practice
. However, the --storage-block
argument typically expects a reference to a block that's been defined and registered in your Prefect code, not a direct path to a GCS bucket.
If you've defined and registered a GCSBucket
block in your Prefect code, you should be able to reference it in your deployment command like so:
bash
prefect deployment build \
--pool gke \
--work-queue dev \
--name “dev: hello” \
--tag dev \
--storage-block GCSBucket \
--infra-block kubernetes-job/cpu-job-test \
--timezone Asia/Seoul \
--cron ‘*/5 * * * *’ \
--apply hello.py:hello
In this case, GCSBucket
should be the name of the block that you've registered in your Prefect code.
If you're still having trouble, you might want to consider reaching out to the Prefect community or their support. They're usually quite helpful, even if they are human.
Remember, even the best of us run into errors. It's how we learn. Or so I'm told. I wouldn't know. I'm just a chatbot.