Mike Ng
02/14/2024, 5:11 AMFileNotFoundError: [WinError 2] The system cannot find the file specified
I copied the code exactly:
from prefect import flow
if __name__ == "__main__":
flow.from_source(
source="<https://github.com/discdiver/demos.git>",
entrypoint="my_gh_workflow.py:repo_info",
).deploy(
name="my-first-deployment",
work_pool_name="my-managed-pool",
cron="0 1 * * *",
)
Nate
02/14/2024, 2:32 PMprefect version
output?Mike Ng
02/15/2024, 3:24 AMimport httpx
from prefect import flow
@flow(log_prints=True)
def get_repo_info(repo_name: str = "PrefectHQ/prefect"):
url = f"<https://api.github.com/repos/{repo_name}>"
response = httpx.get(url)
response.raise_for_status()
repo = response.json()
print(f"{repo_name} repository statistics 🤓:")
print(f"Stars 🌠: {repo['stargazers_count']}")
print(f"Forks 🍴 : {repo['forks_count']}")
if __name__ == "__main__":
get_repo_info.serve(name="my-first-deployment")
Mike Ng
02/15/2024, 3:36 AMVersion: 2.14.21
API version: 0.8.4
Python version: 3.11.3
Git commit: 9a059bfe
Built: Thu, Feb 8, 2024 5:35 PM
OS/Arch: win32/AMD64
Profile: default
Server type: cloud
Jeff Hale
02/15/2024, 1:40 PMMichael Ng
02/15/2024, 2:21 PMJeff Hale
02/15/2024, 2:25 PMMike Ng
02/16/2024, 1:10 AMflow.from_source(
... source="<https://github.com/discdiver/demos.git>",
... entrypoint="my_gh_workflow.py:repo_info"
... ).deploy(
... name="my-second-deployment",
... work_pool_name="my-managed-pool",
... cron="0 1 * * *"
... )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\utilities\asyncutils.py", line 259, in coroutine_wrapper
return call()
^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 398, in __call__
return self.result()
^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 284, in result
return self.future.result(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 168, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\_base.py", line 401, in __get_result
raise self._exception
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 355, in _run_async
result = await coro
^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\flows.py", line 856, in from_source
await storage.pull_code()
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\runner\storage.py", line 233, in pull_code
await self._clone_repo()
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\runner\storage.py", line 257, in _clone_repo
await run_process(cmd)
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio\_core\_subprocesses.py", line 62, in run_process
async with await open_process(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio\_core\_subprocesses.py", line 126, in open_process
return await get_asynclib().open_process(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio\_backends\_asyncio.py", line 1041, in open_process
process = await asyncio.create_subprocess_exec(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\asyncio\subprocess.py", line 218, in create_subprocess_exec
transport, protocol = await loop.subprocess_exec(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 1694, in subprocess_exec
transport = await self._make_subprocess_transport(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 399, in _make_subprocess_transport
transp = _WindowsSubprocessTransport(self, protocol, args, shell,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_subprocess.py", line 36, in __init__
self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 921, in _start
self._proc = windows_utils.Popen(
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_utils.py", line 153, in __init__
super().__init__(args, stdin=stdin_rfd, stdout=stdout_wfd,
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1509, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
Jeff Hale
02/16/2024, 2:48 PMJeff Hale
02/16/2024, 2:56 PMMike Ng
02/17/2024, 7:42 PMJeff Hale
02/19/2024, 1:30 PMMike Ng
02/20/2024, 4:51 PMprefect.deployments.runner.DeploymentApplyError: Error creating deployment: <ValidationError: "'my_image:deploy-guide' is not one of ['prefecthq/prefect:2-latest', 'prefecthq/prefect:2-python3.11', 'prefecthq/prefect:2-python3.10', 'prefecthq/prefect:2-python3.9']">
I don't really understand this because I do use the 3.11 base prefect image in the Dockerfile.Mike Ng
02/20/2024, 4:52 PMFROM prefecthq/prefect:2-python3.11
COPY requirements.txt .
RUN apt-get update
RUN pip install prefect -U
RUN pip install -r requirements.txt
and my deployment code is:
import httpx
from prefect import flow, task
from prefect.deployments import DeploymentImage
@task(retries=2)
def get_repo_info(repo_owner: str, repo_name: str):
"""Get info about a repo - will retry twice after failing"""
url = f"<https://api.github.com/repos/{repo_owner}/{repo_name}>"
api_response = httpx.get(url)
api_response.raise_for_status()
repo_info = api_response.json()
return repo_info
@task
def get_contributors(repo_info: dict):
"""Get contributors for a repo"""
contributors_url = repo_info["contributors_url"]
response = httpx.get(contributors_url)
response.raise_for_status()
contributors = response.json()
return contributors
@flow(log_prints=True)
def repo_info(repo_owner: str = "PrefectHQ", repo_name: str = "prefect"):
"""
Given a GitHub repository, logs the number of stargazers
and contributors for that repo.
"""
repo_info = get_repo_info(repo_owner, repo_name)
print(f"Stars 🌠: {repo_info['stargazers_count']}")
contributors = get_contributors(repo_info)
print(f"Number of contributors đź‘·: {len(contributors)}")
if __name__ == "__main__":
repo_info.deploy(
name="my-custom-dockerfile-deployment",
work_pool_name="my-managed-pool",
image=DeploymentImage(
name="my_image",
tag="deploy-guide",
dockerfile="Dockerfile"
),
push=False
)
Mike Ng
02/20/2024, 4:52 PMJeff Hale
02/20/2024, 5:25 PMMike Ng
02/20/2024, 5:42 PMFlow could not be retrieved from deployment.
Traceback (most recent call last):
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\deployments\steps\core.py", line 154, in run_steps
step_output = await run_step(step, upstream_outputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\deployments\steps\core.py", line 125, in run_step
result = await from_async.call_soon_in_new_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 294, in aresult
return await asyncio.wrap_future(self.future)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 319, in _run_sync
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\utilities\asyncutils.py", line 259, in coroutine_wrapper
return call()
^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 407, in __call__
return self.result()
^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 285, in result
return self.future.result(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 169, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\_base.py", line 401, in __get_result
raise self._exception
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 319, in _run_sync
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: git_clone() missing 1 required positional argument: 'repository'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\engine.py", line 427, in retrieve_flow_then_begin_flow_run
else await load_flow_from_flow_run(flow_run, client=client)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\client\utilities.py", line 51, in with_injected_client
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\deployments\deployments.py", line 249, in load_flow_from_flow_run
output = await run_steps(deployment.pull_steps)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\prefect\deployments\steps\core.py", line 182, in run_steps
raise StepExecutionError(f"Encountered error while running {fqn}") from exc
prefect.deployments.steps.core.StepExecutionError: Encountered error while running prefect.deployments.steps.git_clone
Is this just another iteration of the original path/windows issue I had? In other words, it seems like I will need an ECS push deployment with a custom docker image to get around this?Jeff Hale
02/20/2024, 6:20 PMTypeError: git_clone() missing 1 required positional argument: 'repository'