Skip to content

バッチ予測ジョブのスケジュール

ジョブ定義の作成後、/batchPredictions/fromJobDefinitionエンドポイントを介してジョブ定義を手動で実行する代わりにスケジュールに基づいてジョブ定義を実行することを選択できます。

スケジュールされたバッチ予測ジョブは、DataRobotがジョブの実行を処理する場合を除き、通常のバッチ予測ジョブと同じように機能します。

バッチ予測ジョブの実行をスケジュールするには、ここで説明されているように、最初に定義を作成する必要があります。

バッチ予測REST APIルートの詳細については、 DataRobot REST APIリファレンスドキュメントをご覧ください。

ジョブ定義をスケジュールする

APIは以下のように、キーワードenabledscheduleオブジェクトを受け入れます。

POST https://app.datarobot.com/api/v2/batchPredictionJobDefinitions

{
    "deploymentId": "<deployment_id>",
    "intakeSettings": {
        "type": "dataset",
        "datasetId": "<dataset_ud>"
    },
    "outputSettings": {
        "type": "jdbc",
        "statementType": "insert",
        "credentialId": "<credential_id>",
        "dataStoreId": "<data_store_id>",
        "schema": "public",
        "table": "example_table",
        "createTableIfNotExists": false
    },
    "includeProbabilities": true,
    "includePredictionStatus": true,
    "passthroughColumnsSet": "all"
    "enabled": false,
    "schedule": {
        "minute": [0],
        "hour": [1],
        "month": ["*"]
        "dayOfWeek": ["*"],
        "dayOfMonth": ["*"],
    }
} 

Scheduleペイロード

scheduleペイロードは、ジョブを実行する間隔を定義します。これは、必要に応じ、さまざまな方法で組み合わせて複雑なスケジューリング条件を構築することができます。 オブジェクト内のすべての要素で、「毎回」の時間単位を表すアスタリスク["*"]または整数の配列(例:[1, 2, 3])のいずれかを入力して具体的な間隔を定義することができます。

キー 可能な値 説明
["*"]または[0 ... 59] [15, 30, 45] ジョブは、1日の毎時間ごとに、これらの分の値で実行されます。
時間 ["*"]または[0 ... 23] [12,23] ジョブを何時に実行するかを指定します。
["*"]または[0 ... 12] ["jan"] 文字列は、月の3文字の省略形でも月の完全名でも同じ意味で使用できます(例:"jan"または"october")。
Months that are not compatible with dayOfMonth are ignored, for example {"dayOfMonth": [31], "month":["feb"]}.
dayOfWeek (Sunday=0)の場合、["*"]または[0 ... 6] ["sun"] ジョブを実行する曜日。 Strings, either 3-letter abbreviations or the full name of the day, can be used interchangeably (e.g., "sunday", "Sunday", "sun", or "Sun", all map to [0]).

NOTE: This field is additive with dayOfMonth, meaning the job will run both on the date specified by dayOfMonth and the day defined in this field.
dayOfMonth ["*"]または[0 ... 31] [1, 25] ジョブを実行する日付。 Allowed values are either [1 ... 31] or ["*"] for all days of the month.

NOTE: This field is additive with dayOfWeek, meaning the job will run both on the date(s) defined in this field and the day specified by dayOfWeek (for example, dates 1st, 2nd, 3rd, plus every Tuesday). If dayOfMonth is set to ["*"] and dayOfWeek is defined, the scheduler will trigger on every day of the month that matches dayOfWeek (for example, Tuesday the 2nd, 9th, 16th, 23rd, 30th). 2月31日などの無効な日付は無視されます。

備考

ジョブを実行する日の時刻を指定する際、scheduleペイロードでUTCを使用する必要があります。ローカルタイムゾーンはサポートしていません。 DST(夏時間)を計算に入れるには、現地時間に従ってスケジュールを更新します。

間隔 説明
5分ごとに実行 "schedule": { "minute": [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55], "hour": ["*"], "month": ["*"] "dayOfWeek": ["*"], "dayOfMonth": ["*"], } 他のすべてのフィールドがアスタリスクで指定されているため、時計の分ダイヤルがminuteで定義された数字に達するたびに実行されます。
1時間ごとに実行 "schedule": { "minute": [0], "hour": ["*"], "month": ["*"] "dayOfWeek": ["*"], "dayOfMonth": ["*"], } 時計がminuteで定義された分に達するたびに実行されます。

This example executes every day at 1:00 AM, 2:00 AM, 3:00 AM, and so forth.
毎日正午直前に実行 "schedule": { "minute": [59], "hour": [11], "month": ["*"] "dayOfWeek": ["*"], "dayOfMonth": ["*"], } Executes every time the minute dial of a clock reaches the minutes(s) defined in minute, and the same when the hour dial reaches the number(s) defined in hour.

この例では、毎日11:59 AMに実行されます。
月曜日と土曜日のみ、半年に1回、1時間おきに実行 "schedule": { "minute": [0], "hour": ["*"], "month": [1, 6] "dayOfWeek": ["*"], "dayOfMonth": ["*"], } Executes every time the minute dial of a clock reaches the minute(s) defined in minute, and only when the month is January (1) or June (6).
月曜日と土曜日のみ、半年に1回、1時間おきに実行 "schedule": { "minute": [0], "hour": ["*"], "month": [1, 6] "dayOfWeek": ["mon", "sun"], "dayOfMonth": ["*"], } 上記と同じですが、dayOfWeekを指定したため、間隔は指定した曜日にのみ実行されます。
半年おきに1時間ごと、月曜日と土曜日のみ、加えて、毎月1日と10日に実行 "schedule": { "minute": [0], "hour": ["*"], "month": [1, 6] "dayOfWeek": ["mon", "sun"], "dayOfMonth": [1, 10], } Same as above, but with both dayOfWeek and dayOfMonth specified, these values add to each other, not excluding.

This example executes on both the times defined in dayOfWeek and dayOfMonth, and not, as could be believed, only on those years where the 1st and 10th are Mondays and Sundays.

スケジュールされたジョブを無効化する

ジョブ定義は、enabledTrueに設定された場合にのみ、スケジューラによって実行されます。 過去にスケジュールされたジョブとして実行されていても、すぐに停止すべきジョブ定義がある場合、enabledFalseに設定したエンドポイントをPATCHします。 ジョブが現在実行中の場合、これは関係なく実行を終了します。

PATCH https://app.datarobot.com/api/v2/batchPredictionJobDefinitions/<job_definition_id>

    {
        "enabled": false
    } 

容量制限

スケジューラーには、ジョブを実行できる頻度と一度に実行できるジョブの数に制限が設定されています。

1日あたりの合計実行回数

各組織は、1日あたりのジョブ実行数に制限があります。 セルフマネージドAIプラットフォームの場合、環境特徴量BATCH_PREDICTIONS_JOB_SCHEDULER_MAX_NUMBER_OF_RUNS_PER_DAY_PER_ORGANIZATIONを変更することでこの制限を変更できます。 クラウドの場合、この制限はデフォルトで1000です。

この制限は、組織ごとにスケジュールされたすべてのジョブ全体に適用されることに注意してください。そのため、1つのスケジュールされたジョブの最大実行時間は1日あたり1000で、その組織はスケジュールされたジョブをそれ以上アクティブ化できません。

スケジュールはベストエフォートです。

組織全体で同時に実行されているさまざまな定義の負荷によっては、スケジューラーはスケジュールの正確な秒ですべてのジョブを実行することを保証できません。 ただし、ほとんどの場合、スケジューラーは、スケジュールの5秒以内にジョブをトリガーするリソースを備えることになります。

同じ定義を同時に実行する

1つのジョブ定義をスケジュールに基づいて複数回実行することはできません。 つまり、スケジュールジョブの実行に時間がかかって最初の間隔が完了する前に次の間隔がトリガーされる場合、ジョブは拒否され、中止されます。 これは、実行中のジョブが完了するまで発生し続けます。

失敗したジョブの自動無効化

ユーザーが、設定ミスで実行できずに中止されるジョブ定義を作成すると、enabled特徴量は、5連続して失敗した後に自動で無効化されます。 したがって、同一のペイロードをPOSTし、/batchPredictionJobDefinitionsに対して機能するペイロードを確認する前に、既存の/batchPredictionsエンドポイントを使用してソリューションが機能するかどうかをテストしてから、することを推奨します。 セルフマネージドAIプラットフォームのお客様の場合、BATCH_PREDICTIONS_JOB_SCHEDULER_FAILURES_BEFORE_ABORT環境特徴量を変更することで、連続する障害のこのカットオフポイントを調整できます。