简体   繁体   English

如何在 Prefect 服务器上远程部署流程?

[英]How to deploy flow remotly on Prefect server?

I started working with the Prefect Orchestration tool.我开始使用 Prefect Orchestration 工具。 My goal is to set up a server managing my automation on different other PCs and servers.我的目标是建立一个服务器来管理我在不同的其他 PC 和服务器上的自动化。 I do not fully understand the architecture of Prefect yet (with all these Agents etc.) but I managed to start a server on a remote Ubuntu environment.我还没有完全理解 Prefect 的架构(使用所有这些代理等),但我设法在远程 Ubuntu 环境中启动了一个服务器。 To access the UI remotely I created a config.toml and added following lines:为了远程访问 UI,我创建了一个 config.toml 并添加了以下几行:

[server]
endpoint = "<IPofserver>:4200/graphql"
    [server.ui]
        apollo_url = "http://<IPofserver>:4200/graphql"
[telemetry]
    [server.telemetry]
        enabled = false

The telemetry part is just to disable sending analysis data to Prefect.遥测部分只是禁用向 Prefect 发送分析数据。 Afterswards it was possible to accesss the UI from another PC and also to start an Agent on another PC with:之后可以从另一台 PC 访问 UI,也可以在另一台 PC 上启动代理:

prefect agent local start --api "http://<IPofserver>:4200/graphql"

But how can I deploy flows now?但是我现在如何部署流? A do not find an option to set their api like for the agent. A 找不到为代理设置其 api 的选项。 Even if I try to register a flow on the machine where the server itself is runnig I get following error message:即使我尝试在服务器本身正在运行的机器上注册流,我也会收到以下错误消息:

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.10/dist-packages/prefect/core/flow.py", line 1726, in register registered_flow = client.register( File "/usr/local/lib/python3.10/dist-packages/prefect/client/client.py", line 831, in register project = self.graphql(query_project).data.project # type: ignore File "/usr/local/lib/python3.10/dist-packages/prefect/client/client.py", line 443, in graphql result = self.post( File "/usr/local/lib/python3.10/dist-packages/prefect/client/client.py", line 398, in post response = self._request( File "/usr/local/lib/python3.10/dist-packages/prefect/client/client.py", line 633, in _request response = self._send_request( File "/usr/local/lib/python3.10/dist-packages/prefect/client/client.py", line 497, in _send_request response = session.post( File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 635, in post return self.request("POST", url, data=data, json=json, **kwargs) File "/usr/local/lib/py回溯(最近一次调用最后):文件“”,第 1 行,在文件“/usr/local/lib/python3.10/dist-packages/prefect/core/flow.py”,第 1726 行,在寄存器中注册_flow = client .register( File "/usr/local/lib/python3.10/dist-packages/prefect/client/client.py", line 831, in register project = self.graphql(query_project).data.project # type: ignore文件“/usr/local/lib/python3.10/dist-packages/prefect/client/client.py”,第 443 行,在 graphql 结果 = self.post(文件“/usr/local/lib/python3.10/ dist-packages/prefect/client/client.py”,第 398 行,在响应后 = self._request(文件“/usr/local/lib/python3.10/dist-packages/prefect/client/client.py”,第 633 行,在 _request 响应 = self._send_request(文件“/usr/local/lib/python3.10/dist-packages/prefect/client/client.py”,第 497 行,在 _send_request 响应 = session.post(文件“ /usr/local/lib/python3.10/dist-packages/requests/sessions.py",第 635 行,在后返回 self.request("POST", url, data=data, json=json, **kwargs)文件“/usr/local/lib/py thon3.10/dist-packages/requests/sessions.py", line 587, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 695, in send adapter = self.get_adapter(url=request.url) File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 792, in get_adapter raise InvalidSchema(f"No connection adapters were found for {url!r}") requests.exceptions.InvalidSchema: No connection adapters were found for ':4200/graphql' thon3.10/dist-packages/requests/sessions.py”,第 587 行,在请求 resp = self.send(prep, **send_kwargs) 文件“/usr/local/lib/python3.10/dist-packages/requests /sessions.py”,第 695 行,发送适配器 = self.get_adapter(url=request.url) 文件“/usr/local/lib/python3.10/dist-packages/requests/sessions.py”,第 792 行,在 get_adapter raise InvalidSchema(f"No connection adapters were found for {url!r}") requests.exceptions.InvalidSchema: No connection adapters were found for ':4200/graphql'

Used Example Code:使用的示例代码:

import prefect
from prefect import task, Flow

@task
def say_hello():
    logger = prefect.context.get("logger")
    logger.info("Hello, Cloud!")

with Flow("hello-flow") as flow:
    say_hello()

# Register the flow under the "tutorial" project
flow.register(project_name="Test")

If you are getting started with Prefect, I'd recommend using Prefect 2.0 - check this documentation page on getting started and this one about the underlying architecture .如果您开始使用 Prefect,我建议您使用 Prefect 2.0 - 请查看此文档页面入门此文档关于底层架构

If you still need help with Prefect Server and Prefect 1.0, check this extensive troubleshooting guide and if that doesn't help, send us a message on Slack, and we'll try to help you there.如果您仍然需要 Prefect Server 和 Prefect 1.0 方面的帮助,请查看此详尽的故障排除指南,如果没有帮助,请在 Slack 上给我们发送消息,我们会尽力帮助您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM