英文:
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}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论