Hi guys Could you help and explain please I have ...
# ask-community
a
Hi guys Could you help and explain please I have following structure in my project:
Copy code
my-project
└── important_directory
    ├── flow.py
└── prefect.yaml
How should I fill prefect.yaml to update code from gitlab storage, given that
my-project
is a git repo? I've tried a lot of stuff but nothing worked, flow runs fail with file not found error Last attempt was:
Copy code
pull:
- prefect.deployments.steps.set_working_directory:
    directory: /home/user/my-project/
- prefect.deployments.steps.git_clone:
    repository: <https://gitlab.sth.com/my-project.git>
    branch: main

# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: my-deployment
  entrypoint: important_directory/flow.py:my_method
GitLab blocks are installed; prefect version 2.13.1
s
Hi @Ana, when you say “GitLab blocks are installed”, do you mean a GitLabCredentials block? If this is a private repo you will want to pass in credentials in the
git_clone
step, like so:
Copy code
pull:
    - prefect.deployments.steps.git_clone:
        repository: <https://github.com/org/repo.git>
        credentials: "{{ prefect.blocks.gitlab-credentials.my-credentials }}"
But you also mentioned that it’s actually failing on a file not found error. The output to the error would be useful. Also, I don’t believe there is a need for the
set_working_directory
step prior to
git_clone
but I may be missing something about your setup.
a
i dont need credentials, but ive tried with them as well it seems I succeeded with cloning because finally I found out that it is cloned actually in /tmp/tmp-prefect folder😃 and now i have a problem that i cannot import my flow coz it seems that tmp folder is deleted straightforward actually i would like to just imitate "git pull" command in "root folder/master branch" on serverhost, is it possible not to clone in other folders?
logs in UI
s
It shouldn’t be getting deleted after cloning. Can you the errors for where you run into a file not found error?
a
I found out
Copy code
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
[SQL: INSERT INTO worker (name, last_heartbeat_time, heartbeat_interval_seconds, work_pool_id, id, created, updated) VALUES (:name, :last_heartbeat_time, :heartbeat_interval_seconds, :work_pool_id, :id, :created, :updated) ON CONFLICT (work_pool_id, name) DO UPDATE SET last_heartbeat_time = :param_1, heartbeat_interval_seconds = :param_2]
[parameters: {'name': 'ProcessWorker 06ec47b8-bf47-4deb-9d23-aeb9da2e3dbb', 'last_heartbeat_time': '2023-10-24 13:07:38.895798', 'heartbeat_interval_seconds': 30, 'work_pool_id': '7a172727-f6fd-45a7-ae05-fde389bec150', 'id': '58a9f905-a7cc-4b77-bda3-d0ff6f2c141e', 'created': '2023-10-24 13:07:38.896628', 'updated': '2023-10-24 13:07:38.896639', 'param_1': '2023-10-24 13:07:38.895798', 'param_2': 30}]
the only thing to blame, ive tried the same on ec2 with postgres and it seems work fine but still is there any option not to clone in tmp? just update the remote ?