Netanel Malka
03/05/2024, 12:02 PMprefect work-pool create --type docker my-docker-pool
I have a local running prefect server (2.14.21)
And get this error:
File "/home/netanel/.cache/pypoetry/virtualenvs/upstream-data-engineering-ptQzHj37-py3.10/lib/python3.10/site-packages/httpx/_models.py", line 762, in json
return jsonlib.loads(self.content, **kwargs)
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Marvin
03/05/2024, 12:13 PMJSONDecodeError
. While the documentation search didn't yield a direct solution, an issue on GitHub describes a problem that matches your description, although it's about an earlier Prefect version (2.10.8) and not being able to create work pools using the CLI.
For now, there isn't a straightforward answer from the documentation or issues, but you may want to double-check your server version compatibility and if the Prefect server is running correctly. If the problem persists, consider reporting it as a new issue on Prefect's GitHub repository.
In the context of the JSONDecodeError
, which typically occurs when trying to parse an empty or incorrectly formatted JSON string, make sure that the Prefect server APIs are responding correctly and that there isn't a networking or configuration problem that could be causing an empty response.Netanel Malka
03/05/2024, 12:39 PMprefect.yaml
with prefect docker server? I am trying to create a workpool (proces or docker) but this error prevent it from meMarvin
03/05/2024, 12:46 PMprefect.yaml
with your Prefect Docker server, you would typically follow the standard workflow for defining and deploying flows in Prefect 2.x. However, since you're experiencing issues with creating work pools, you might be facing a situation where flows cannot be properly assigned to workers for execution.
Here's a basic example of how a deployment might look in `prefect.yaml`:
yaml
version: 1
deployments:
- name: "my-deployment"
flow_location: "/path/to/flow.py"
infrastructure:
type: "docker"
image: "my-custom-image"
And then, to serve this using Prefect Docker server, you could execute the following command in the same directory as your prefect.yaml
file:
bash
prefect deployment apply prefect.yaml
If the command to create a work pool is failing due to the JSONDecodeError and you cannot correct this using the server settings or CLI command, you might want to try manually running your flow locally or within a Docker container without relying on the Prefect server's work pool.
Since you're looking to test, you could temporarily bypass the work pool by executing the deployment within a Docker container manually. This means running your flow script directly on your machine – outside of the Prefect work pools.
The example code provided simulates fetching and processing data. It ends with serving the flow with a specified name and default parameters. This way, you can manually test the script parts without the automated execution managed by Prefect's work pools:
python
if __name__ == "__main__":
work_i_need_to_do_sometimes.serve(
name="sporadic-deployment",
parameters={"keys": ["foo", "bar", "baz"]},
)
Please remember that this approach is just a workaround and doesn't substitute long-term solutions or proper usage of Prefect's work pools and orchestration capabilities. If you're experiencing persistent issues, opening a new GitHub issue with Prefect might be your best course of action.
You can view and reference the provided example directly from GitHub here.