Abyaya Lamsal
03/06/2025, 12:26 AMv2.20.16
. How do I resolve them?
/usr/local/lib/python3.10/site-packages/prefect/utilities/dispatch.py:162: UserWarning: Type 'KubernetesClusterConfig' at /usr/local/lib/python3.10/site-packages/prefect_kubernetes/credentials.py:40 has key 'kubernetes-cluster-config' that matches existing registered type 'KubernetesClusterConfig' from /usr/local/lib/python3.10/site-packages/prefect/blocks/kubernetes.py:28. The existing type will be overridden.
warnings.warn(
/usr/local/lib/python3.10/site-packages/pydantic/v1/schema.py:631: UserWarning: Callable print_func was excluded from schema since JSON schema has no equivalent type.
warnings.warn(skip.message, UserWarning)
/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py:775: UserWarning: Mixing V1 models and V2 models (or constructs, like `TypeAdapter`) is not supported. Please upgrade `KubernetesJob` to V2.
warn(
Worker 'KubernetesWorker 3360fcf9-1016-4cf0-a375-0ba83cc13aa2' started!
Marvin
03/06/2025, 12:27 AMKubernetesClusterConfig
types between the Prefect core and the Prefect Kubernetes integration. This is a known issue, and it might not affect functionality but can clutter logs.
- GitHub Issue on KubernetesClusterConfig Warning: This issue suggests that the warning arises when importing prefect_kubernetes
.
2. Pydantic V1 and V2 Mixing:
- Mixing Pydantic V1 and V2 models is not supported and can lead to validation issues. The warning suggests upgrading models to Pydantic V2.
- GitHub Pull Request on Pydantic Validation: This PR addresses issues with Pydantic V1 and V2 model validation, providing insights into how Prefect is handling these changes.
### Recommendations:
- For KubernetesClusterConfig: If the warning does not affect your workflow, you might choose to ignore it until a fix is implemented. Otherwise, consider contributing to or following the GitHub issue for updates.
- For Pydantic Mixing: Ensure all your models are upgraded to Pydantic V2 if possible. Check your dependencies to ensure they are compatible with Pydantic V2.
If you need further assistance or specific code examples, feel free to ask.Abyaya Lamsal
03/06/2025, 12:59 AM│ 00:56:19.115 | DEBUG | prefect.utilities.services.critical_service_loop - Run of functools.partial(<bound method Runner._check_for_cancelled_flow_runs of Runner(name='runner-6361b379-bcd0-466b-815b-795db51c3d31')>, should_stop=<function Ru │
│ Traceback (most recent call last): │
│ File "/usr/local/lib/python3.10/site-packages/prefect/utilities/services.py", line 61, in critical_service_loop │
│ await workload() │
│ File "/usr/local/lib/python3.10/site-packages/prefect/runner/runner.py", line 740, in _check_for_cancelled_flow_runs │
│ named_cancelling_flow_runs = await self._client.read_flow_runs( │
│ File "/usr/local/lib/python3.10/site-packages/prefect/client/orchestration.py", line 2145, in read_flow_runs │
│ response = await <http://self._client.post|self._client.post>("/flow_runs/filter", json=body) │
│ File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1861, in post │
│ return await self.request( │
│ File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1542, in request │
│ return await self.send(request, auth=auth, follow_redirects=follow_redirects) │
│ File "/usr/local/lib/python3.10/site-packages/prefect/client/base.py", line 327, in send │
│ response = await self._send_with_retry( │
│ File "/usr/local/lib/python3.10/site-packages/prefect/client/base.py", line 251, in _send_with_retry │
│ response = await send(request, *send_args, **send_kwargs) │
│ File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1631, in send │
│ response = await self._send_handling_auth( │
│ File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1659, in _send_handling_auth │
│ response = await self._send_handling_redirects( │
│ File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1696, in _send_handling_redirects │
│ response = await self._send_single_request(request) │
│ File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1732, in _send_single_request │
│ response = await transport.handle_async_request(request) │
│ File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 394, in handle_async_request │
│ resp = await self._pool.handle_async_request(req) │
│ File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 256, in handle_async_request │
│ raise exc from None │
│ File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 236, in handle_async_request │
│ response = await connection.handle_async_request( │
│ File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request │
│ raise exc │
│ File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request │
│ async with self._request_lock: │
│ File "/usr/local/lib/python3.10/site-packages/httpcore/_synchronization.py", line 77, in __aenter__ │
│ await self._anyio_lock.acquire() │
│ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 1735, in acquire │
│ await AsyncIOBackend.checkpoint_if_cancelled() │
│ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2279, in checkpoint_if_cancelled │
│ await sleep(0) │
│ File "/usr/local/lib/python3.10/asyncio/tasks.py", line 596, in sleep │
│ await __sleep0() │
│ File "/usr/local/lib/python3.10/asyncio/tasks.py", line 590, in __sleep0 │
│ yield │
│ asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f0e4e3d1180 │
│ 00:56:19.118 | DEBUG | prefect.runner - Stopping runner...
Marvin
03/06/2025, 12:59 AMAbyaya Lamsal
03/06/2025, 1:00 AMv2.20.16
asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f0e4e3d1180
Marvin
03/06/2025, 1:00 AMasyncio.exceptions.CancelledError: Cancelled by cancel scope
, typically arises when an asyncio task is cancelled. In the context of Prefect, this can occur if the flow or task is being cancelled, possibly due to a timeout or an explicit cancellation request.
### Possible Causes and Solutions:
1. Flow Cancellation:
- The flow might be getting cancelled due to a timeout or an explicit cancellation request. Ensure that your flow's timeout settings are configured correctly and that no other system is sending a cancellation signal.
2. Known Issues:
- There is a GitHub issue where users reported similar errors after migrating to Prefect Workers. The error might be related to how Prefect handles cancellation checks in the background.
- Another related issue is about Docker containers not closing properly, leading to unexpected cancellations. See this issue for more details.
3. Enhanced Cancellation:
- Prefect offers an experimental feature for enhanced cancellation. You can enable it by setting the environment variable:
bash
prefect config set PREFECT_EXPERIMENTAL_ENABLE_ENHANCED_CANCELLATION=True
- This might help in handling cancellations more gracefully.
4. Debugging:
- Review the flow logs for any explicit cancellation messages or errors that might have triggered the cancellation.
- Check for any network or infrastructure issues that might be causing the flow to be cancelled unexpectedly.
If these suggestions do not resolve the issue, consider reaching out to the Prefect community or filing a detailed issue on their GitHub repository.Abyaya Lamsal
03/07/2025, 12:08 AMFlow could not be retrieved from deployment.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/prefect/deployments/steps/core.py", line 154, in run_steps
step_output = await run_step(step, upstream_outputs)
File "/usr/local/lib/python3.10/site-packages/prefect/deployments/steps/core.py", line 125, in run_step
result = await from_async.call_soon_in_new_thread(
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 293, in aresult
return await asyncio.wrap_future(self.future)
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 318, in _run_sync
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/site-packages/prefect_aws/deployments/steps.py", line 181, in pull_from_s3
session = boto3.Session(**credentials)
TypeError: Session.__init__() got an unexpected keyword argument 'bucket_path'
Marvin
03/07/2025, 12:09 AMTypeError: Session.__init__() got an unexpected keyword argument 'bucket_path'
, is due to an incorrect argument being passed to the boto3.Session
initialization. Here's what you need to know:
1. Cause: The boto3.Session
class does not accept a bucket_path
argument. This suggests a misconfiguration or an error in the code where the AWS credentials or configuration are being set up.
2. Solution:
- Check Configuration: Ensure that the AWS credentials and configuration are correctly set up in your code. The boto3.Session
should be initialized with valid arguments like aws_access_key_id
, aws_secret_access_key
, region_name
, etc., but not bucket_path
.
- Code Review: Inspect the pull_from_s3
function in your Prefect AWS integration to ensure it is correctly using boto3
for session creation. Remove or correct the bucket_path
argument.
3. Documentation:
- Review the Prefect AWS S3 integration documentation for guidance on setting up and using S3 with Prefect.
If you need further assistance or a specific code example, feel free to ask.Abyaya Lamsal
03/07/2025, 12:11 AMpull:
- prefect_aws.deployments.steps.pull_from_s3:
bucket: sample-bucket
credentials: '{{ prefect.blocks.s3.aws_creds }}'
folder: sample
requires: prefect-aws
Marvin
03/07/2025, 12:11 AMpull_from_s3
step in your prefect.yaml
file. Here's what you need to know:
### Key Points:
1. Deprecation Notice: The pull_project_from_s3
and push_project_to_s3
methods are deprecated. Ensure you are using the correct pull_from_s3
method as specified in the Prefect AWS integration.
2. Configuration of pull_from_s3
:
- The credentials
key should contain valid AWS credentials. It seems that the bucket_path
is incorrectly being passed as part of the credentials.
- Ensure that the credentials block reference ({{ prefect.blocks.s3.aws_creds }}
) is correctly set up to provide AWS credentials without including any invalid keys like bucket_path
.
3. Example Configuration:
- Ensure your prefect.yaml
is configured correctly. Here's an example configuration for pulling from S3:
yaml
pull:
- prefect_aws.deployments.steps.pull_from_s3:
bucket: sample-bucket
credentials: '{{ prefect.blocks.s3.aws_creds }}'
folder: sample
requires: prefect-aws
4. Documentation:
- Review the Prefect AWS deployments steps documentation for more details on setting up the pull steps.
### Recommendations:
- Double-check the credentials
block in Prefect to ensure it is set up correctly without any erroneous keys.
- If the issue persists, consider reviewing the Prefect AWS integration code or reaching out to the Prefect community for further assistance.Abyaya Lamsal
03/07/2025, 12:18 AMBucket Path
fieldMarvin
03/07/2025, 12:18 AMBucket Path
field in the Prefect block configuration is part of the S3 block setup. Here's how it fits into the broader configuration:
### Key Points:
1. Bucket Path Field:
- The Bucket Path
field is part of the S3 block configuration and is used to specify a default path within the bucket where objects are stored or retrieved from.
- This field is not directly used in the boto3.Session
initialization, which is why passing it there causes an error.
2. Correct Block Configuration:
- When setting up your S3 block in Prefect, ensure that the Bucket Path
is configured within the block itself, not passed as a credential to boto3.Session
.
- You can configure the Bucket Path
when creating or updating the S3 block in Prefect, as shown in this example:
python
from prefect_aws.s3 import S3Bucket
# Load an existing S3 block
my_s3_bucket_block = S3Bucket.load("my-s3-bucket")
# Set the bucket path
my_s3_bucket_block.bucket_path = "my-default-bucket-path"
# Save the updated block
my_s3_bucket_block.save("my-s3-bucket", overwrite=True)
3. Documentation:
- Review the Prefect Blocks Documentation for more details on setting up and managing blocks.
### Recommendations:
- Ensure that your Prefect block for S3 is correctly set up with the Bucket Path
field within the block itself.
- Avoid passing the Bucket Path
as part of the credentials to AWS sessions, as this is not supported by boto3
.
- If you continue to encounter issues, verify that your Prefect block configurations align with the expected setup in the Prefect documentation.Abyaya Lamsal
03/12/2025, 12:16 AMMarvin
03/12/2025, 12:16 AM