不接受Bigquery自定义计划Cron语法 [英] Bigquery Custom Schedule Cron Syntax Not Accepted

查看:51
本文介绍了不接受Bigquery自定义计划Cron语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安排要在Bigquery UI中当日运行的查询.根据Google的文档,此选项使用cron语法.我已经使用crontab guru来验证语法是否正确,尽管您将调度程序放在什么语法上似乎不接受任何语法都没有关系.这是一个已知的错误?以下是我每6个小时运行一次的cron语法.

0 */6 * * *

解决方案

接受的答案不会直接链接到正确的文档,也不会解释有效的选项,只是给出了工具提示中已经提供的少量示例(但是确实回答了张贴的特定问题)

这篇文章试图为那些可能遇到类似问题的人提供一个更笼统的答案.

可以直接此处位于时间表"下,字段信息 ..

为进行全面披露,我将在此处直接从该文档中摘录一些内容,以便使此答案可以独立".

通常,时间表必须采用以下格式:

[TYPE] [INTERVAL_VALUE] [INTERVAL_SCOPE]

,并且您必须决定要使用三种不同类型的间隔中的哪一个:

  • 结束时间间隔
  • 开始时间间隔
  • 自定义间隔

间隔类型由您提供的时间表隐式选择.

结束时间间隔

这些是从作业完成时开始的时间间隔.

TYPE

每日间隔必须以"每个"开始前缀

INTERVAL_VALUE

有效时间单位如下:

  • 分钟分钟
  • 小时

INTERVAL_SCOPE

不适用于结束时间间隔.

示例

如果每5分钟",并且作业在0201处完成,则下一个作业在完成后等待5分钟以再次开始,并从0206开始.

开始时间间隔

严格的查询时间表.

TYPE

每日间隔必须以"每个"开始前缀

INTERVAL_VALUE

以下时间单位的一些整数:

  • 分钟分钟
  • 小时

即使使用1作为数量单位也保持不变.

INTERVAL_SCOPE

必须采用以下形式:

从[HH:MM]到[HH:MM] ,HH = 00,01,...,23和MM = 00,01,...,59.或者已同步

已同步重复一个时间间隔,并将其均匀地分布在24小时内(例如,像结束时间安排,但将其固定为开始时间).

与此选项一起提供的[INTERVAL_VALUE]必须是24的因子(1、2、3、4、6、8、12或24),以使每一天都有相同的时间表(否则,您将在第二天收到溢出".

示例

示例1:从10:00到14:00每5分钟如果作业从1000开始并耗时6分钟,则它将运行1000、1010、1020,...,因为1005、1015,...由于作业仍在运行而被跳过.

直接报价:

因为作业的开始时间很严格,如果一个作业的实例运行时间超过定义的时间间隔,然后Cron服务可以跳过工作.如果出现以下情况,则可以跳过间隔中的单个开始时间先前的工作尚未完成或超时.

示例2: 每2小时同步运行0000,0200,0400,...,2200.

自定义间隔

这些用于指定日或月级别的时间间隔,而不能指定次日时间间隔.

TYPE

  • 使用每个指定一个重复间隔:

    • 每天06:00
    • 每个星期一
    • 每周二
    • ...
    • 每个星期天
  • 特定日期可以用序号( 1st 2nd 3rd ,OR, first second third ,...,直至 31st thirtyfirst )

    • 第一,第二个星期二
    • 每月第二个第三个星期三09:00

请注意,序号和单词可以混合使用.

INTERVAL_VALUE 有效日期是以下各项的任意组合:

  • 星期一 mon
  • 星期二星期二
  • 星期三星期三
  • 星期四 thu
  • 星期五 fri
  • 星期六 sat
  • 星期日 sun
  • 一周中所有天的
  • day

INTERVAL_SCOPE 可以包含

  • 每月[HH:MM]
  • jan,feb,sep,nov [HH:MM] ,即以逗号分隔的月份列表

请注意,时间必须指定给定的月份,并按上述方式分别给出 HH MM (分别为00-23和00-59).如果"of"为"of",则表示"of".排除在外,该作业每月运行.

允许的值:

  • 一月 jan
  • 2月 feb
  • march mar
  • april apr
  • 可能
  • june jun
  • july jul
  • 八月 aug
  • 9月 sep
  • 十月 oct
  • 11月 nov
  • 十二月 dec
  • 一年中所有月份的
  • month

示例

  • 第二个星期一,星期四
  • 每月09:00的1,8,15,22
  • 周一,周三,9月,10月,11月1日(周四)17:00

请注意,在未明确指定时间(例如第二个星期一,星期四)的情况下,找不到描述工作运行时间的文档.

一般示例

  • 第二个星期一,星期四->自定义间隔"
  • 第三秒,第二十二秒,30日星期一->自定义间隔"
  • 1月1日,4月,7月,10月00:00 ->自定义间隔"
  • 9月,10月,11月1日的第一周一->自定义间隔"
  • 每月04:00的第一,第三周一->自定义间隔"
  • 每月09:00的1,8,15,22 ->自定义间隔"
  • 每个星期一09:00 ->自定义间隔"
  • 从10:00到14:00的每5分钟->开始时间间隔"
  • 从08:00到16:00每1个小时->开始时间间隔"
  • 每2个小时同步一次->开始时间间隔"
  • 每5分钟->结束时间间隔"
  • 每1个小时->结束时间间隔"

重要提示:

  • 输入时间表时会隐式选择时间间隔类型
  • 您不能混合使用不同间隔类型的选项.
  • 所有指定时间均为世界标准时间
如上面的介绍中所述,该信息实质上是从现有文档中删除的,但是我认为这些信息已被掩埋了,这个问题值得独立"解决.参考文字.

I am trying to schedule a query to run intraday in Bigquery UI. According to Google's documentation this option uses cron syntax. I have used crontab guru to verify the syntax is correct, although it doesn't matter what syntax you put the scheduler doesn't seem to accept any. Is this a known bug? Below is the cron syntax I'm using to run every 6 hours.

0 */6 * * *

解决方案

The accepted answer does not link directly to the correct documentation nor explain the valid options, except to give a small number of examples already provided by the tooltip (but it does answer the specific question posted)

This post attempts to give a more general answer for those that may follow with similar questions.

A full description of the allowed syntax can be found directly here as well as related materials here under "schedule" field information..

For full disclosure, I'm going to lift out some parts directly from that documentation here so this answer can "stand alone".

Generally, the schedule must be of the form:

[TYPE] [INTERVAL_VALUE] [INTERVAL_SCOPE]

and you must decide which of the three different kinds of intervals you will use:

  • End-time intervals
  • Start-time intervals
  • Custom intervals

The kind of interval is chosen implicitly by the schedule you provide.

End-Time Intervals

These are intervals implemented from when a job finishes.

TYPE

Daily intervals must start with the "every" prefix

INTERVAL_VALUE

Valid units of time are as follows:

  • minutes or mins
  • hours

INTERVAL_SCOPE

Not applicable for end-time intervals.

Example

If "every 5 mins", and the job finishes at 0201, then then next job waits 5 minutes AFTER completion to begin again, and starts at 0206.

Start-Time Intervals

A strict schedule for the queries to follow.

TYPE

Daily intervals must start with the "every" prefix

INTERVAL_VALUE

Some integer amount of the following units of time:

  • minutes or mins
  • hours

The units remain the same even using 1 as the amount.

INTERVAL_SCOPE

Must be of the form:

from [HH:MM] to [HH:MM] with HH=00,01,...,23 and MM=00,01,..., 59. OR synchronized

synchronized repeats a time interval and spreads it evenly across the 24 hour period (e.g. like end-time scheduling but fixing it to a start-time).

The [INTERVAL_VALUE] given in conjunction with this option must be a factor of 24 (1, 2, 3, 4, 6, 8, 12, or 24), presumably so that each day has the same schedule (otherwise, you would get a "spill" over into the next day).

Examples

Example 1: every 5 minutes from 10:00 to 14:00 If the job starts at 1000, and takes 6 minutes, then it will run 1000, 1010, 1020, ..., because the 1005,1015, ..., jobs were skipped because they were still running.

Direct quote:

Because the start time of a job is strict, if an instance of a job runs longer than the defined time interval, then the Cron service can skip a job. An individual start time in the interval can be skipped if the prior job has not completed or times out.

Example 2: every 2 hours synchronized Runs 0000,0200,0400, ..., 2200.

Custom Intervals

These specify intervals on the day or month level, and cannot specify sub-daily intervals.

TYPE

  • Using every specifies a repeating interval:

    • every day 06:00
    • every monday
    • every tuesday
    • ...
    • every sunday
  • Specific days can be specified with ordinal numbers (1st, 2nd, 3rd, OR, first, second, third, ..., up to 31st OR thirtyfirst)

    • 1st,3rd tuesday
    • 2nd, third wednesday of month 09:00

Note that the ordinal number and words can be mixed.

INTERVAL_VALUE Valid days are any mix of the following:

  • monday or mon
  • tuesday or tue
  • wednesday or wed
  • thursday or thu
  • friday or fri
  • saturday or sat
  • sunday or sun
  • day for all days of the week

INTERVAL_SCOPE Can include

  • of month [HH:MM]
  • of jan,feb,sep,nov [HH:MM] i.e. a comma-separated list of months

Note, a time must be given with any given month, with HH and MM given as above (00-23 and 00-59, respectively). If "of" is excluded, the job runs every month.

Allowed values:

  • january or jan
  • february or feb
  • march or mar
  • april or apr
  • may
  • june or jun
  • july or jul
  • august or aug
  • september or sep
  • october or oct
  • november or nov
  • december or dec
  • month for all months in the year

Examples

  • 2nd monday,thu
  • 1,8,15,22 of month 09:00
  • 1st mon,wednesday,thu of sep,oct,nov 17:00

Note, there is no documentation that could be found describing the time a job runs when the time is not explicitly specified (e.g. 2nd monday,thu).

General Examples

  • second monday,thu -> "Custom Interval"
  • third, twentysecond, 30th mon -> "Custom Interval"
  • 1 of jan,april,july,oct 00:00 -> "Custom Interval"
  • 1st monday of sep,oct,nov 09:00 -> "Custom Interval"
  • 1st,third monday of month 04:00 -> "Custom Interval"
  • 1,8,15,22 of month 09:00 -> "Custom Interval"
  • every monday 09:00 -> "Custom Interval"
  • every 5 minutes from 10:00 to 14:00 -> "Start-time Interval"
  • every 1 hours from 08:00 to 16:00 -> "Start-time Interval"
  • every 2 hours synchronized -> "Start-time Interval"
  • every 5 minutes -> "End-time Interval"
  • every 1 hours -> "End-time Interval"

IMPORTANT:

  • Interval types are chosen implicitly when you enter the schedule
  • You can't mix and match the options for the different interval types.
  • All specified times are UTC

As said in the intro above, this information is essentially ripped from the existing documentation, but I felt that was buried away and that this question deserved a "stand alone" reference text.

这篇关于不接受Bigquery自定义计划Cron语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆