Arnaud Stephan
08/19/2024, 3:56 PMFlow could not be retrieved from deployment.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/prefect/deployments/steps/core.py", line 154, in run_steps
step_output = await run_step(step, upstream_outputs)
File "/usr/local/lib/python3.10/site-packages/prefect/deployments/steps/core.py", line 125, in run_step
result = await from_async.call_soon_in_new_thread(
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 327, in aresult
return await asyncio.wrap_future(self.future)
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 352, in _run_sync
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 311, in coroutine_wrapper
return call()
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 432, in __call__
return self.result()
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 318, in result
return self.future.result(timeout=timeout)
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 179, in result
return self.__get_result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 389, in _run_async
result = await coro
File "/usr/local/lib/python3.10/site-packages/prefect/deployments/steps/pull.py", line 123, in git_clone
await storage.pull_code()
File "/usr/local/lib/python3.10/site-packages/prefect/runner/storage.py", line 233, in pull_code
await self._clone_repo()
File "/usr/local/lib/python3.10/site-packages/prefect/runner/storage.py", line 241, in _clone_repo
repository_url = self._repository_url_with_credentials
File "/usr/local/lib/python3.10/site-packages/prefect/runner/storage.py", line 167, in _repository_url_with_credentials
for k, v in credentials.items():
AttributeError: 'str' object has no attribute 'items'
I don't really know where the problem is coming from, as it seems to come from Prefect's modules and not something I wrote. Here is the .yaml of my deployment :
name: tenacy-prefect
prefect-version: 2.20.2
# build section allows you to manage and build docker images
build:
# push section allows you to manage if and how this project is uploaded to remote locations
push:
# pull section allows you to provide instructions for cloning this project in remote locations
pull:
- prefect.deployments.steps.git_clone:
repository: <https://my-private-gitlab-instance.io/data/tenacy-prefect.git>
credentials: '{{prefect.blocks.secret.gitlab-personal-token}}'
# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: Younium
version:
tags: []
description:
entrypoint: flows/flows.py:younium_flow
parameters: {}
work_pool:
name: tenacy-work-pool
work_queue_name:
job_variables: {}
schedules: []
Jake Kaplan
08/19/2024, 4:08 PMcredentials: '{{ ... }}'
with
access_token: '{{ ... }}'
?Arnaud Stephan
08/19/2024, 4:46 PMRuntimeError: Failed to clone repository '<https://my-private-gitlab-instance.io/data/tenacy-prefect.git>' with exit code 128.
It seems that with credentials
it managed to clone the repo but got stuck somewhere else.Arnaud Stephan
08/19/2024, 4:49 PMArnaud Stephan
08/19/2024, 4:49 PM@flow(log_prints=True, name='Younium Extract')
def younium_flow():
secret_block = Secret.load("younium-pipeline-token")
pipeline_token = secret_block.get()
project_id = 64
pipeline_id = trigger_pipeline(project_id=project_id, pipeline_token=pipeline_token)
get_pipeline_status(project_id=project_id, pipeline_id=pipeline_id)
Jake Kaplan
08/19/2024, 4:53 PMcredentials
it error'ed before it was able to even clone, because you're passing a Secret
block instead of a GitLabCredentials
blockJake Kaplan
08/19/2024, 4:54 PMSecret
block named gitlab-personal-token
and that stored token has access to your repo?
2. your yaml looks like the following, including quotes and spaces:
access_token: "{{ prefect.blocks.secret.gitlab-personal-token }}"
Jake Kaplan
08/19/2024, 4:55 PMArnaud Stephan
08/19/2024, 4:58 PMArnaud Stephan
08/19/2024, 5:00 PMArnaud Stephan
08/19/2024, 5:02 PMArnaud Stephan
08/19/2024, 6:39 PMArnaud Stephan
08/19/2024, 6:39 PMArnaud Stephan
08/20/2024, 9:23 AMArnaud Stephan
08/20/2024, 10:05 AMJake Kaplan
08/20/2024, 2:45 PMArnaud Stephan
08/20/2024, 3:06 PMdocker run -e PREFECT_API_URL=$PREFECT_API_URL -e PREFECT_API_KEY=$PREFECT_API_KEY prefect-tenacy
It works on my machine, but I imagine it will work as well when we host it on our infra, because in that case it will be us calling the Prefect API, and not Prefect trying to clone our repo. Have I understood correctly ?Jake Kaplan
08/20/2024, 4:12 PMArnaud Stephan
08/20/2024, 4:36 PMJake Kaplan
08/20/2024, 6:04 PMArnaud Stephan
08/20/2024, 6:16 PMJake Kaplan
08/20/2024, 6:17 PM