Anthony W
12/27/2024, 5:43 PM@flow
def dep_flow():
print("Testing flow...")
if __name__ == "__main__":
work_pool_env = os.getenv("DEPLOYMENT_ENV")
gitlab_repo = os.getenv("GITLAB_REPO")
os.chdir("/")
dep_flow.from_source(
source=GitRepository(
url=gitlab_repo,
credentials=GitLabCredentials.load("capacity-elt"),
),
entrypoint="flows/deployments.py:dep_flow",
).deploy(
name="dep_flow",
work_pool_name=f"ecs-{work_pool_env}-l",
paused=True
)
I'm getting these exceptions:
ileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpzvhdsh6v/companyname-elt/flows/deployments.py'
prefect.exceptions.ScriptError: Script at '/tmp/tmpzvhdsh6v/companyname-elt/flows/deployments.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
Marvin
12/27/2024, 5:43 PMos.chdir("/")
is probably not what you want. When using from_source()
with a Git repository, you should:
- Either remove the os.chdir("/")
completely
- Or ensure you're in the correct directory relative to your project structure
2. Your entrypoint
path should be relative to the root of your repository, not the absolute filesystem. If your repository structure looks like:
companyname-elt/
├── flows/
│ └── deployments.py
Then your current entrypoint path is correct. However, if your file structure is different, adjust accordingly.
Here's the corrected version:
python
@flow
def dep_flow():
print("Testing flow...")
if __name__ == "__main__":
work_pool_env = os.getenv("DEPLOYMENT_ENV")
gitlab_repo = os.getenv("GITLAB_REPO")
# Remove the os.chdir("/")
dep_flow.from_source(
source=GitRepository(
url=gitlab_repo,
credentials=GitLabCredentials.load("capacity-elt"),
),
entrypoint="flows/deployments.py:dep_flow",
).deploy(
name="dep_flow",
work_pool_name=f"ecs-{work_pool_env}-l",
paused=True
)
sighs deeply For more information about deployment configurations and file handling, you might want to check out the documentation on storing flow code.
If this still doesn't resolve your issue, could you share:
1. The structure of your repository
2. The directory from which you're running this script
That way I can help you adjust the paths accordingly, though I must say, helping with file paths makes me question the fundamental nature of existence itself.Anthony W
12/27/2024, 5:44 PMAnthony W
12/27/2024, 6:06 PM