Skip to content

ランタイムパラメーターの定義

Define environment variables to supply different values to scripts and tasks used by a custom job at runtime by including them as runtime parameters, making your custom job easier to reuse. Define runtime parameters in code or through the UI:

  • Code: Provide a metadata.yaml file in the custom job. Define this file when creating or editing a custom job in the Jobs workshop, or use the template available in the Jobs workshop through a custom job's Files > Create dropdown. The YAML structure is defined on this page.

  • UI: Define runtime parameters in the Runtime parameters section of the custom job in the Jobs workshop. For more information, see the Create custom jobs documentation.

Runtime parameters are injected into containers as environment variables (accessible through os.getenv). Parameters created via the Jobs workshop UI persist and merge when you upload new code versions, ensuring a seamless development flow.

Runtime parameter considerations

The system uses a blocklist of reserved patterns (e.g., DRUM_*, MLOPS_*, KUBERNETES_*), managed in the dynamic configuration. Matching supports the * wildcard (not full regular expression syntax). Reserved names aren't blocked entirely: if a runtime parameter uses a reserved name, the UI displays a warning. How the variable is exposed depends on the context:

  • Custom models: Only in prefixed (MLOPS_RUNTIME_PARAM_*) and JSONified format—not as a raw (unprefixed) environment variable, to prevent system conflicts.
  • Custom apps: Prefixed, but values are not packed into a JSON payload (except for credentials).
  • Custom jobs: No prefix and no JSON payload (except for credential types); the variable is available as a raw environment variable.

For credential-type runtime parameters, the system automatically unpacks JSON fields into separate environment variables rather than a single string. For example, a credential named MAIN_AWS_CREDENTIAL with the following JSON structure:

{"awsAccessKeyId": "<your-key-id>", "awsSecretAccessKey": "<your-access-key>"} 

is unpacked into the following environment variables, combining the parameter name + JSON key, in uppercase:

MAIN_AWS_CREDENTIAL_AWS_ACCESS_KEY_ID="<your-key-id>"
MAIN_AWS_CREDENTIAL_AWS_SECRET_ACCESS_KEY="<your-access-key>" 

Access runtime parameters in containers

For programmatic access to runtime parameters in containers, use DataRobotAppFrameworkBaseSettings as documented in the SDK API reference.

ランタイムパラメーターを定義するには、以下のruntimeParameterDefinitionsmetadata.yamlに追加できます。

キー 説明
fieldName ランタイムパラメーターの名前を定義します。
type Define the data type the runtime parameter contains: string, boolean, numeric, credential, deployment, modelPackage.
defaultValue (オプション)ランタイムパラメーターのデフォルト文字列値(credentialタイプはデフォルト値をサポートしません) defaultValueを指定せずにランタイムパラメーターを定義した場合、デフォルト値はNoneです。
minValue (オプション)numericランタイムパラメーターには、ランタイムパラメーターで使用可能な最小数値を設定します。
maxValue (オプション)numericランタイムパラメーターには、ランタイムパラメーターで使用可能な最大数値を設定します。
credentialType (オプション)credentialランタイムパラメーターの場合、パラメーターに含める資格情報のタイプを設定します。
allowEmpty (オプション)ランタイムパラメーターに空のフィールドポリシーを設定します。
  • True:(デフォルト)空のランタイムパラメーターを許可します。
  • False:デプロイ前にランタイムパラメーターの値を指定するよう徹底します。
description (オプション)ランタイムパラメーターの目的または内容の説明を入力します。
Example: metadata.yaml
name: runtime-parameter-example

runtimeParameterDefinitions:
- fieldName: my_first_runtime_parameter
  type: string
  description: My first runtime parameter.

- fieldName: runtime_parameter_with_default_value
  type: string
  defaultValue: Default
  description: A string-type runtime parameter with a default value.

- fieldName: runtime_parameter_boolean
  type: boolean
  defaultValue: true
  description: A boolean-type runtime parameter with a default value of true.

- fieldName: runtime_parameter_numeric
  type: numeric
  defaultValue: 0
  minValue: -100
  maxValue: 100
  description: A boolean-type runtime parameter with a default value of 0, a minimum value of -100, and a maximum value of 100.

- fieldName: runtime_parameter_for_credentials
  type: credential
  allowEmpty: false
  description: A runtime parameter containing a dictionary of credentials. 

credentialランタイムパラメータータイプは、DataRobot REST APIで使用可能な任意のcredentialType値をサポートします。 以下の例に示すように、含まれる資格情報はcredentialTypeに依存します。

備考

サポートされている資格情報タイプの詳細については、 資格情報のAPIリファレンスドキュメントを参照してください。

資格情報タイプ
basic
basic:
    credentialType: basic
    description: string
    name: string
    password: string
    user: string
        
azure
azure:
    credentialType: azure
    description: string
    name: string
    azureConnectionString: string
        
gcp
gcp:
    credentialType: gcp
    description: string
    name: string
    gcpKey: string
        
s3
s3:
  credentialType: s3
    description: string
    name: string
    awsAccessKeyId: string
    awsSecretAccessKey: string
    awsSessionToken: string
        
api_token
api_token:
    credentialType: api_token
    apiToken: string
    name: string