Hi Prefect Team, I have a question. I would like t...
# ask-community
a
Hi Prefect Team, I have a question. I would like to deploy a flow to a Process work pool running on a PC. Here is my code:
Copy code
from prefect.runner.storage import GitRepository
from prefect_github import GitHubCredentials
from prefect import flow


if __name__ == "__main__":
    github_credentials_block = GitHubCredentials.load("<block_name>")
    flow.from_source(
        source=GitRepository(
            url="<my_private_repo>",
            branch='main',
            credentials={
                "access_token": github_credentials_block.token.get_secret_value()
            }
        ),
        entrypoint="flow_file.py:flow_name"
    ).deploy(name="test-flow", work_pool_name="windows", build=False)
When I run this code to deploy, I get the following error: ValueError: Work pool 'windows' does not support custom Docker images. Please use a work pool with an
image
variable in its base job template. If I don't want my code to run in a docker image and run as a subprocess, how should I change my code?
n
hey @Alex Rodriguez i think this sounds like a good use case for
serve
Copy code
from prefect.runner.storage import GitRepository
from prefect_github import GitHubCredentials
from prefect import flow


if __name__ == "__main__":
    github_credentials_block = GitHubCredentials.load("<block_name>")
    flow.from_source(
        source=GitRepository(
            url="<my_private_repo>",
            branch='main',
            credentials={
                "access_token": github_credentials_block.token.get_secret_value()
            }
        ),
        entrypoint="flow_file.py:flow_name"
    ).serve(name="test-flow")
this circumvents the need for a process worker at all, as when you run
python your_script.py
, this will effectively do what the Process worker would do, that is, poll for scheduled / triggered runs of your deployed flow and then execute them
.deploy
is meant for containerized deployments
a
@Nate Thank you for response, this should get everything working.
a
@Nate do you know if there are any plans to add support for deploying to Process work-pools using
.deploy()
. So far I have just been using the CLI
deploy
command to achieve this, however, it's a bit more cumbersome and the ability to version the deployment configurations on a per flow basis would be helpful.
🙌 1
For context, I'm using work-pools over just
.serve
because it's very helpful being able to monitor groups of flows (by work-pool) in the UI.
n
thanks for the context @Aj Floersch - that makes a lot of sense you'd want to group them by work pool and dynamically add deployments there (unlike
serve(*my_deployments)
we have this issue for tracking now
a
Awesome - yep that's exactly what I was hoping for. Subscribed to see where this issue heads. Thank you!