hi everyone! i was trying to create deployment whi...
# ask-community
d
hi everyone! i was trying to create deployment which is supposed to run on workpools using worker i want the code to be pulled from aws s3 .. created a deployment yaml for the same but getting Attribute error (nonetype has no attribute name) this is what the yaml looks like
Copy code
# configuration for deploying your flows. We recommend committing this file to source
# control along with your flow code.

# Generic metadata about this project
name: activities-split-sync
prefect-version: 2.13.3

# build section allows you to manage and build docker images
build: null

# push section allows you to manage if and how this project is uploaded to remote locations
push:
- prefect_aws.deployments.steps.push_to_s3:
    id: push_code
    requires: prefect-aws>=0.3.4
    bucket: prod-prefect-s3-block
    folder: prefect
    credentials: "{{ prefect.blocks.aws-credentials.s3cred }}"

# pull section allows you to provide instructions for cloning this project in remote locations
pull:
- prefect_aws.deployments.steps.pull_from_s3:
    id: pull_code
    requires: prefect-aws>=0.3.4
    bucket: '{{ push_code.bucket }}'
    folder: '{{ push_code.folder }}'
    credentials: "{{ prefect.blocks.aws-credentials.s3cred }}"

# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: activities-mode-split-sync-flow
  version: '1.0'
  tags: [
    activities_mode_split_sync_flow
  ]
  description: null
  schedule: {}
  flow_name: activities-mode-split-sync-flow
  entrypoint: flows/process_sso_integrations_flows/activities_mode_split_sync_flow.py:activities_mode_split_sync_flow
  parameters: {}
  work_pool:
    name: sso
    work_queue_name: activities-sso-queue
    job_variables: {}
1
b
Hi Deepanshu, thanks for sharing your yaml. FWIW, everything looks fine to me so far. I've compared it to a yaml I used to pull/push code to s3 as well. The only difference I'm noticing is the double quotes around the reference to your credentials block
Here's mine:
Copy code
push:
- prefect_aws.deployments.steps.push_to_s3:
    id: push_code
    requires: prefect-aws>=0.3.4
    bucket: bianca-bucket
    folder: bucket-folder
    credentials: '{{ prefect.blocks.aws-credentials.bianca-eks-creds }}'
can you try single quotes instead?
d
tried with single quotes.. still the same error
Copy code
'prefect.yaml' did not conform to deployment spec: AttributeError("'NoneType' object has no attribute 'name'")
b
hmm..just to confirm, what CLI commands are you using to build the prefect.yaml and deploy?
d
prefect deployment apply prefect.yaml
i used prefect init --recipe s3 for getting the prefect yaml . then i added the deployment information and updated push pull
b
prefect deployment apply prefect.yaml
Ah, I think that may be the problem
Can you try
prefect deploy --name activities-mode-split-sync-flow
d
but how will this use the prefect.yaml
b
if you run this CLI command when you're inside the working directory where your prefect.yaml is stored, it will identify the deployment declaration in the prefect.yaml which matches the name you provide in the command, and then deploy the flow
prefect deploy
is covered a bit more in depth here
d
thanks ! was able to deploy with this but getting an error
Copy code
Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/prefect/engine.py", line 260, in retrieve_flow_then_begin_flow_run
    flow = await load_flow_from_flow_run(flow_run, client=client)
  File "/usr/local/lib/python3.9/site-packages/prefect/client/utilities.py", line 47, in with_injected_client
    return await fn(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/prefect/deployments.py", line 163, in load_flow_from_flow_run
    basepath = deployment.path or Path(deployment.manifest_path).parent
  File "/usr/local/lib/python3.9/pathlib.py", line 1082, in __new__
    self = cls._from_parts(args, init=False)
  File "/usr/local/lib/python3.9/pathlib.py", line 707, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/usr/local/lib/python3.9/pathlib.py", line 691, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
how should the entry point look like when the code is pulled from s3
im in folder prefect-poc inside which im running the deploy command there is a folder named flows. entrypoint = ./flows/process_sso_integrations_flows/activities_mode_split_sync_flow.py:activities_mode_split_sync_flow
b
Hi Deepanshu! sorry, i missed the last bit of your messages here
did you get this resolved? are you still running into the same problem?
I think the entry point would somewhat depend on how your directory is structured in s3. if you wouldn't mind sharing that, it would be helpful
d
hi ! i was able to resolve this . thanks 🙏
1
🚀 1
b
awesome! happy to hear that