使用sleep_until在GCP工作流中

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

Using sleep_until on GCP Workflow

问题

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

  1. main:
  2. params: [task]
  3. steps:
  4. - waitScheduleDate:
  5. call: sys.sleep_until
  6. args:
  7. time: time.parse(${task.schedule_date})

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

英文:

Given a json input:

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

This is the yaml for GCP workflow:

  1. main:
  2. params: [task]
  3. steps:
  4. - waitScheduleDate:
  5. call: sys.sleep_until
  6. args:
  7. time: time.parse(${task.schedule_date})
  8. - createTask:
  9. call: http.post
  10. args:
  11. url: https://typedwebhook.tools/webhook/0e74a54b-8e57-40f3-8a78-10a25b0ebb89
  12. body:
  13. date: ${task.schedule_date}
  14. description: ${task.description}
  15. result: task_output
  16. - returnOutput:
  17. return: ${task_output}

I am getting

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

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

}

答案1

得分: 3

你混淆了事情!!

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

或者

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

You mixed the things!!

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

or

  1. - waitScheduleDate:
  2. call: sys.sleep_until
  3. args:
  4. 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:

确定