【问题标题】:Dataprep: job finish eventDataprep:作业完成事件
【发布时间】:2018-03-08 19:17:47
【问题描述】:

我们正在考虑按自动计划使用 Dataprep,以便将 GCS .gz 文件的文件夹加载到 Big Query 中。

挑战在于:如何将源 .gz 文件在处理后移至冷存储?

我找不到由 Dataprep 生成的事件,我们可以连接到该事件以执行归档任务。如果 Dataprep 可以自行归档源文件,那将是最理想的。

有什么建议吗?

【问题讨论】:

    标签: google-cloud-platform google-cloud-dataprep


    【解决方案1】:

    我认为没有办法在直接从 Dataprep 完成工作时收到通知。您可以做的是轮询底层数据流作业。您可以安排脚本在您计划的数据准备作业运行时运行。这是一个简单的例子:

    #!/bin/bash
    
    # list running dataflow jobs, filter so that only the one with the "dataprep" string in its name is actually listed and keep its id
    id=$(gcloud dataflow jobs list --status=active --filter="name:dataprep" | sed -n 2p | cut -f 1 -d " ")
    # loop until the state of the job changes to done
    until [ $(gcloud dataflow jobs describe $id | grep currentState | head -1 | awk '{print $2}') == "JOB_STATE_DONE" ]
    do
    # sleep so that you reduce API calls
    sleep 5m
    done
    # send to cold storage, e.g. gsutil mv ...
    echo "done"
    

    这里的问题是上面假设您只运行一个数据准备作业。如果您安排许多并发数据准备作业,则脚本会更复杂。

    【讨论】:

      猜你喜欢
      • 2020-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-20
      • 2022-11-01
      • 1970-01-01
      • 2018-10-17
      相关资源
      最近更新 更多