Define runtime parameters¶
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.yamlfile 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.
To define runtime parameters, you can add the following runtimeParameterDefinitions in metadata.yaml:
| Key | Description |
|---|---|
fieldName |
Define the name of the runtime parameter. |
type |
Define the data type the runtime parameter contains: string, boolean, numeric, credential, deployment, modelPackage. |
defaultValue |
(Optional) Set the default string value for the runtime parameter (the credential type doesn't support default values). If you define a runtime parameter without specifying a defaultValue, the default value is None. |
minValue |
(Optional) For numeric runtime parameters, set the minimum numeric value allowed in the runtime parameter. |
maxValue |
(Optional) For numeric runtime parameters, set the maximum numeric value allowed in the runtime parameter. |
credentialType |
(Optional) For credential runtime parameters, set the type of credentials the parameter must contain. |
allowEmpty |
(Optional) Set the empty field policy for the runtime parameter.
|
description |
(Optional) Provide a description of the purpose or contents of the runtime parameter. |
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.
The credential runtime parameter type supports any credentialType value available in the DataRobot REST API. The credential information included depends on the credentialType, as shown in the examples below:
Note
For more information on the supported credential types, see the API reference documentation for credentials.
| Credential Type | Example |
|---|---|
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
|