Hello all, <@ULVA73B9P> I am using prefect 2.13.8 ...
# ask-community
k
Hello all, @Marvin I am using prefect 2.13.8 and migrate from S3 block to S3Bucket block and the deployment function is like this:
Copy code
storage = S3Bucket.load("flow-code")  # This is a Prefect S3 storage object

infrastructure = ECSTask.load("ecs-task-insights")  # This is a Prefect ECS task object

deployment = Deployment.build_from_flow(
    flow=suggest_tags.perform,
    name="on-demand",
    version=VERSION,
    work_queue_name="default",
    storage=storage,
    path=f"suggest_tags/{VERSION}",
    infrastructure=infrastructure,
)
but I am getting an error:
load_script_as_module
raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'insights_orchestration/suggested_tags/flows/suggest_tags.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
. Can you give me any idea how to resolve this?
m
The error you're experiencing seems to be related to the Prefect setup with
S3Bucket
as storage for deployments. When transitioning to the
S3Bucket
block, it's important to ensure that everything is set up correctly. Here's a breakdown: 1. Ensure Correct Path and Storage Location: It appears the script is not found at the specified location. Please check if the path provided (
insights_orchestration/suggested_tags/flows/suggest_tags.py
) is correct and that the file indeed exists in your S3 bucket. 2. S3Bucket Configuration: Double-check that your
S3Bucket
block is configured properly, including verifying that the credentials and bucket name are correctly set. In Prefect 2.x, blocks must be properly set up as follows:
Copy code
python
   from prefect_aws import S3Bucket, AWSCredentials

   my_s3_bucket = S3Bucket(
       bucket_name="your_bucket_name",
       credentials=AWSCredentials.load("your_credentials_name")
   )
   storage.save("flow-code")
3. Register Block Changes: If you've recently made changes to the
S3Bucket
block, ensure these changes are registered with Prefect Cloud or your self-hosted Prefect server. For further insights, I found some resources that can be useful: - Blocks Documentation discussing how S3 buckets are linked with AWS credentials. - Deployment Guide for typical deployment issues, which might give more context to your error. Additionally, as no relevant GitHub issues were found, if you've ensured all the above configurations are correct and the problem persists, consider checking if there are more recent issues or asking the community for any changes or updates specific to version 2.13.8. If you need further assistance on configuring blocks or handling specific deployment paths, let me know!