Hi everyone! I am running prefect local and work ...
# prefect-community
Hi everyone! I am running prefect local and work fine, but when I try to run a agent in ec2 i got this error:
Copy code
prefect.exceptions.ScriptError: Script at 'test.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
What am i doing wrong? My storage is on github!
Hey Gabriel! Could you share your deployment configuration? The output of
prefect deployment inspect
is probably the most verbose, but the CLI command you used to build the deployment would also work
And what type of infrastructure block are you using?
(also if you wouldn't mind reducing your traceback to just the
that will help keep the channel clean - thank you!)
This is my inspect:
Copy code
    'id': '8b747014-63b1-40b2-908b-e619879ddc39',
    'created': '2023-04-06T20:54:03.311565+00:00',
    'updated': '2023-04-07T01:15:07.704438+00:00',
    'name': 'dbt',
    'version': '56814c126fc663ce6b506c5330834507',
    'description': None,
    'flow_id': '831f53e7-f9a4-4e62-b5c5-a09239173277',
    'schedule': None,
    'is_schedule_active': True,
    'infra_overrides': {},
    'parameters': {},
    'tags': [],
    'work_queue_name': 'dbt',
    'parameter_openapi_schema': {'type': 'object', 'title': 'Parameters', 'properties': {}},
    'path': '',
    'pull_steps': [],
    'entrypoint': 'test.py:hi',
    'manifest_path': None,
    'storage_document_id': 'f7f5e987-9e6d-469c-a9e3-7e4966b91cec',
    'infrastructure_document_id': '4a50245a-ef01-424e-8ab7-b3f19175b64a',
    'created_by': {'id': '0043aef4-727e-4e86-a979-45fcb878ad3a', 'type': 'USER', 'display_value': 'gabrielsantosoicocombr'},
    'updated_by': {'id': '0043aef4-727e-4e86-a979-45fcb878ad3a', 'type': 'USER', 'display_value': 'gabrielsantosoicocombr'},
    'work_pool_name': 'default-agent-pool',
    'infrastructure': {'type': 'process', 'env': {}, 'labels': {}, 'name': None, 'command': None, 'stream_output': True, 'working_dir': None, 'block_type_slug': 'process'}
I using GitHub block
and is
located at the root of your repository?
yes is in repository root
👍 1
If you're open to upgrading, we just released a new feature that makes deployments much simpler. You'd need to change one or two things but I think you could get up and running in a few minutes and avoid this issue; here's what I recommend: upgrade to
on both your local environment and also your EC2 environment. In EC2, run
prefect worker start -t process -p ec2-work
(this will create a work pool called "ec2-work") On your local machine, from the root of your repository, run:
Copy code
rm deployment.yaml # delete old deployment yaml file for now

prefect project init --recipe git
prefect deploy test.py:hi -n dbt -p ec2-work
I'm fairly certain that with only those changes your deployment will be healthy again on your EC2 instance, but if you run into an error please let me know!
Thanks @Chris White
Save may holiday
🤩 1
Another question, there is a way to start prefect worker as a background processor?
Prefect doesn't currently expose that as an option, but you could use
, or
or even
to do so. This is a pretty common request so I'll make a note of it and see if we can offer a
flag for workers to do this natively
🎉 2
🙌 2
@Chris White - the link you gave is broken - looks like it should be https://docs.prefect.io/latest/tutorial/projects/ But I notice that the projects tutorial is not available past 2.10.13 - did that get dropped accidentally?
I understand now that it's deprecated. This page has the latest info: https://docs.prefect.io/latest/concepts/deployments-ux/