You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GCP Workflow中sys.sleep_until传ISO-8601日期报错的解决方法

解决GCP Workflows中sys.sleep_until的ISO-8601日期传递问题

错误原因

当前写法time: time.parse(${task.schedule_date})会被YAML解析为普通字符串,而非执行time.parse函数调用,导致sys.sleep_until无法识别格式,抛出ValueError。

修正后的YAML配置

main:
  params: [task]
  steps:
    - waitScheduleDate:
        call: sys.sleep_until
        args:
            time: ${time.parse(task.schedule_date)}

    - createTask:
        call: http.post
        args:
          url: https://typedwebhook.tools/webhook/0e74a54b-8e57-40f3-8a78-10a25b0ebb89
          body: 
            date: ${task.schedule_date}
            description: ${task.description}
        result: task_output
    - returnOutput:
        return: ${task_output}

关键修改点

将time: time.parse(${task.schedule_date})改为time: ${time.parse(task.schedule_date)}:

  • GCP Workflows的表达式语法要求完整的函数调用必须包裹在${}内部,这样引擎才会执行函数并返回时间对象,而非将其作为字符串传递。
  • time.parse函数可以直接处理你传入的2023-05-17T15:04:07+0000格式(带时区的ISO-8601变体),无需额外转换格式。

内容的提问来源于stack exchange,提问作者p.magalhaes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 17:07:42