我目前正在尝试在我的本地机器上运行一些完美的流程(然后在一些谷歌云运行实例中),我想将运行日志发送到远程的完美服务器。
这是示例代码:
@task
def my_task():
logger = prefect.context.get("logger")
logger.info("An info message.")
logger.warning("A warning message.")
@task(log_stdout=True)
def say_hello(name):
print("Hello, {}!".format(name))
with Flow(name="My First Flow") as flow:
my_task()
say_hello(Parameter('msg'))
flow.run(msg='You')
另外,我在 backend.toml 中放置了一些配置:
backend = "server"
[server]
host = "SERVER_PUBLIC_IP"
port = "4200"
host_port = "4200"
endpoint = "${server.host}:${server.port}"
[server.graphql]
host = "SERVER_PUBLIC_IP"
[server.ui]
host = "SERVER_PUBLIC_IP"
port = "8080"
host_port = "8080"
endpoint = "${server.ui.host}:${server.ui.port}"
graphql_url = "SERVER_PUBLIC_IP:4200/graphql"
[logging]
# The logging level: NOTSET, DEBUG, INFO, WARNING, ERROR, or CRITICAL
level = "INFO"
# The log format
format = "[%(asctime)s] %(levelname)s - %(name)s | %(message)s"
# additional log attributes to extract from context
# e.g., log_attributes = "['context_var']"
log_attributes = "[]"
# the timestamp format
datefmt = "%Y-%m-%d %H:%M:%S"
log_to_cloud = true
所以,这是我遇到的问题:
当我运行这段代码时,我有这个错误=>
INTERNAL_SERVER_ERROR: Variable "$input" got invalid value null at
"input.logs[0].flow_run_id"; Expected non-nullable type UUID! not to be null.
The GraphQL query was:
mutation($input: write_run_logs_input!) {
write_run_logs(input: $input) {
success
}
}
因为我的日志的第一行没有 flow_run_id。
示例: {"input": {"logs": [{"flow_run_id": null, "task_run_id": null, "timestamp": "2020-12-22T21:24:13.628595+00:00", "name": “prefect.FlowRunner”、“message”:“为“我的第一个流程”运行开始流程”、“级别”:“信息”....
我想知道我忘记了什么或者我做错了什么:(
感谢帮助