使用sleep_until在GCP工作流中

huangapple go评论54阅读模式
英文:

Using sleep_until on GCP Workflow

问题

Here's the translated code snippet with the desired parts:

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

The error message you provided is in English and doesn't need translation.

英文:

Given a json input:

{"description":"12345","schedule_date":"2023-05-17T15:04:07+0000"}

This is the yaml for GCP workflow:

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}

I am getting

ValueError: unknown format "time.parse(${task.schedule_date})"
in step "waitScheduleDate", routine "main", line: 5
{
  "message": "ValueError: unknown format \"time.parse(${task.schedule_date})\"",
  "tags": [
    "ValueError"
  ]

How to pass a date ISO-8601 string format as input for sys.sleep_until?

}

答案1

得分: 3

你混淆了事情!!

  • Sleep -> 时间戳
  • Sleep_until -> 字符串中的日期
    - waitScheduleDate:
        调用:sys.sleep
        参数:
            时间:time.parse(${task.schedule_date})

或者

    - waitScheduleDate:
        调用:sys.sleep_until
        参数:
            时间:${task.schedule_date}
英文:

You mixed the things!!

  • Sleep -> timestamp
  • Sleep_until -> Date in String
    - waitScheduleDate:
        call: sys.sleep
        args:
            time: time.parse(${task.schedule_date})

or

    - waitScheduleDate:
        call: sys.sleep_until
        args:
            time: ${task.schedule_date}

huangapple
  • 本文由 发表于 2023年5月18日 00:06:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76274087.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定