Ask AI

AWS (dagster-aws)

Utilities for interfacing with AWS with Dagster.

S3

dagster_aws.s3.S3Resource ResourceDefinition[source]

Config Schema:
use_unsigned_session (Union[dagster.BoolSource, None], optional):

Specifies whether to use an unsigned S3 session.

Default Value: False

region_name (Union[dagster.StringSource, None], optional):

Specifies a custom region for the S3 session.

endpoint_url (Union[dagster.StringSource, None], optional):

Specifies a custom endpoint for the S3 session.

max_attempts (Union[dagster.IntSource, None], optional):

This provides Boto3’s retry handler with a value of maximum retry attempts, where the initial call counts toward the max_attempts value that you provide.

Default Value: 5

profile_name (Union[dagster.StringSource, None], optional):

Specifies a profile to connect that session.

use_ssl (Union[dagster.BoolSource, None], optional):

Whether or not to use SSL. By default, SSL is used.

Default Value: True

verify (Union[dagster.StringSource, None], optional):

Whether or not to verify SSL certificates. By default SSL certificates are verified. You can also specify this argument if you want to use a different CA cert bundle than the one used by botocore.

aws_access_key_id (Union[dagster.StringSource, None], optional):

AWS access key ID to use when creating the boto3 session.

aws_secret_access_key (Union[dagster.StringSource, None], optional):

AWS secret access key to use when creating the boto3 session.

aws_session_token (Union[dagster.StringSource, None], optional):

AWS session token to use when creating the boto3 session.

Resource that gives access to S3.

The underlying S3 session is created by calling boto3.session.Session(profile_name). The returned resource object is an S3 client, an instance of botocore.client.S3.

Example

from dagster import job, op, Definitions
from dagster_aws.s3 import S3Resource

@op
def example_s3_op(s3: S3Resource):
    return s3.get_client().list_objects_v2(
        Bucket='my-bucket',
        Prefix='some-key'
    )

@job
def example_job():
    example_s3_op()

defs = Definitions(
    jobs=[example_job],
    resources={'s3': S3Resource(region_name='us-west-1')}
)
dagster_aws.s3.S3PickleIOManager IOManagerDefinition[source]

Config Schema:
s3_bucket (dagster.StringSource):

S3 bucket to use for the file manager.

s3_prefix (Union[dagster.StringSource, None], optional):

Prefix to use for the S3 bucket for this file manager.

Default Value: ‘dagster’

Persistent IO manager using S3 for storage.

Serializes objects via pickling. Suitable for objects storage for distributed executors, so long as each execution node has network connectivity and credentials for S3 and the backing bucket.

Assigns each op output to a unique filepath containing run ID, step key, and output name. Assigns each asset to a single filesystem path, at “<base_dir>/<asset_key>”. If the asset key has multiple components, the final component is used as the name of the file, and the preceding components as parent directories under the base_dir.

Subsequent materializations of an asset will overwrite previous materializations of that asset. With a base directory of “/my/base/path”, an asset with key AssetKey([“one”, “two”, “three”]) would be stored in a file called “three” in a directory with path “/my/base/path/one/two/”.

Example usage:

from dagster import asset, Definitions
from dagster_aws.s3 import S3PickleIOManager, S3Resource


@asset
def asset1():
    # create df ...
    return df

@asset
def asset2(asset1):
    return asset1[:5]

defs = Definitions(
    assets=[asset1, asset2],
    resources={
        "io_manager": S3PickleIOManager(
            s3_resource=S3Resource(),
            s3_bucket="my-cool-bucket",
            s3_prefix="my-cool-prefix",
        )
    }
)
class dagster_aws.s3.S3ComputeLogManager(bucket, local_dir=None, inst_data=None, prefix='dagster', use_ssl=True, verify=True, verify_cert_path=None, endpoint_url=None, skip_empty_files=False, upload_interval=None, upload_extra_args=None, show_url_only=False, region=None)[source]

Logs compute function stdout and stderr to S3.

Users should not instantiate this class directly. Instead, use a YAML block in dagster.yaml such as the following:

compute_logs:
  module: dagster_aws.s3.compute_log_manager
  class: S3ComputeLogManager
  config:
    bucket: "mycorp-dagster-compute-logs"
    local_dir: "/tmp/cool"
    prefix: "dagster-test-"
    use_ssl: true
    verify: true
    verify_cert_path: "/path/to/cert/bundle.pem"
    endpoint_url: "http://alternate-s3-host.io"
    skip_empty_files: true
    upload_interval: 30
    upload_extra_args:
      ServerSideEncryption: "AES256"
    show_url_only: false
    region: "us-west-1"
Parameters:
  • bucket (str) – The name of the s3 bucket to which to log.

  • local_dir (Optional[str]) – Path to the local directory in which to stage logs. Default: dagster._seven.get_system_temp_directory().

  • prefix (Optional[str]) – Prefix for the log file keys.

  • use_ssl (Optional[bool]) – Whether or not to use SSL. Default True.

  • verify (Optional[bool]) – Whether or not to verify SSL certificates. Default True.

  • verify_cert_path (Optional[str]) – A filename of the CA cert bundle to use. Only used if verify set to False.

  • endpoint_url (Optional[str]) – Override for the S3 endpoint url.

  • skip_empty_files – (Optional[bool]): Skip upload of empty log files.

  • upload_interval – (Optional[int]): Interval in seconds to upload partial log files to S3. By default, will only upload when the capture is complete.

  • upload_extra_args – (Optional[dict]): Extra args for S3 file upload

  • show_url_only – (Optional[bool]): Only show the URL of the log file in the UI, instead of fetching and displaying the full content. Default False.

  • region – (Optional[str]): The region of the S3 bucket. If not specified, will use the default region of the AWS session.

  • inst_data (Optional[ConfigurableClassData]) – Serializable representation of the compute log manager when newed up from config.

dagster_aws.s3.S3Coordinate DagsterType

A dagster.DagsterType intended to make it easier to pass information about files on S3 from op to op. Objects of this type should be dicts with 'bucket' and 'key' keys, and may be hydrated from config in the intuitive way, e.g., for an input with the name s3_file:

inputs:
  s3_file:
    value:
      bucket: my-bucket
      key: my-key

File Manager (Experimental)

class dagster_aws.s3.S3FileHandle(s3_bucket, s3_key)[source]

A reference to a file on S3.

dagster_aws.s3.S3FileManagerResource ResourceDefinition[source]

Config Schema:
use_unsigned_session (Union[dagster.BoolSource, None], optional):

Specifies whether to use an unsigned S3 session.

Default Value: False

region_name (Union[dagster.StringSource, None], optional):

Specifies a custom region for the S3 session.

endpoint_url (Union[dagster.StringSource, None], optional):

Specifies a custom endpoint for the S3 session.

max_attempts (Union[dagster.IntSource, None], optional):

This provides Boto3’s retry handler with a value of maximum retry attempts, where the initial call counts toward the max_attempts value that you provide.

Default Value: 5

profile_name (Union[dagster.StringSource, None], optional):

Specifies a profile to connect that session.

use_ssl (Union[dagster.BoolSource, None], optional):

Whether or not to use SSL. By default, SSL is used.

Default Value: True

verify (Union[dagster.StringSource, None], optional):

Whether or not to verify SSL certificates. By default SSL certificates are verified. You can also specify this argument if you want to use a different CA cert bundle than the one used by botocore.

aws_access_key_id (Union[dagster.StringSource, None], optional):

AWS access key ID to use when creating the boto3 session.

aws_secret_access_key (Union[dagster.StringSource, None], optional):

AWS secret access key to use when creating the boto3 session.

aws_session_token (Union[dagster.StringSource, None], optional):

AWS session token to use when creating the boto3 session.

s3_bucket (dagster.StringSource):

S3 bucket to use for the file manager.

s3_prefix (Union[dagster.StringSource, None], optional):

Prefix to use for the S3 bucket for this file manager.

Default Value: ‘dagster’

Base class for Dagster resources that utilize structured config.

This class is a subclass of both ResourceDefinition and Config.

Example definition:

class WriterResource(ConfigurableResource):
    prefix: str

    def output(self, text: str) -> None:
        print(f"{self.prefix}{text}")

Example usage:

@asset
def asset_that_uses_writer(writer: WriterResource):
    writer.output("text")

defs = Definitions(
    assets=[asset_that_uses_writer],
    resources={"writer": WriterResource(prefix="a_prefix")},
)

You can optionally use this class to model configuration only and vend an object of a different type for use at runtime. This is useful for those who wish to have a separate object that manages configuration and a separate object at runtime. Or where you want to directly use a third-party class that you do not control.

To do this you override the create_resource methods to return a different object.

class WriterResource(ConfigurableResource):
    str: prefix

    def create_resource(self, context: InitResourceContext) -> Writer:
        # Writer is pre-existing class defined else
        return Writer(self.prefix)

Example usage:

@asset
def use_preexisting_writer_as_resource(writer: ResourceParam[Writer]):
    writer.output("text")

defs = Definitions(
    assets=[use_preexisting_writer_as_resource],
    resources={"writer": WriterResource(prefix="a_prefix")},
)

ECS

dagster_aws.ecs.EcsRunLauncher RunLauncher[source]

Config Schema:
task_definition (Union[String, strict dict], optional):

Either the short name of an existing task definition to use when launching new tasks, or a dictionary configuration to use when creating a task definition for the run.If neither is provided, the task definition will be created based on the current task’s task definition.

container_name (dagster.StringSource, optional):

The container name to use when launching new tasks. Defaults to ‘run’.

Default Value: ‘run’

secrets (List[Union[String, strict dict]], optional):

An array of AWS Secrets Manager secrets. These secrets will be mounted as environment variables in the container. See https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_Secret.html.

secrets_tag (Union[dagster.StringSource, None], optional):

AWS Secrets Manager secrets with this tag will be mounted as environment variables in the container. Defaults to ‘dagster’.

Default Value: ‘dagster’

include_sidecars (Bool, optional):

Whether each run should use the same sidecars as the task that launches it. Defaults to False.

Default Value: False

use_current_ecs_task_config (Bool, optional):

Whether to use the run launcher’s current ECS task in order to determine the cluster and networking configuration for the launched task. Defaults to True. Should only be called if the run launcher is running within an ECS task.

Default Value: True

run_task_kwargs (permissive dict, optional):

Additional arguments to include while running the task. See https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.run_task for the available parameters. The overrides and taskDefinition arguments will always be set by the run launcher.

Config Schema:
cluster (dagster.StringSource, optional):

Name of the ECS cluster to launch ECS tasks in.

env_vars (List[dagster.StringSource], optional):

List of environment variable names to include in the ECS task. Each can be of the form KEY=VALUE or just KEY (in which case the value will be pulled from the current process)

run_resources (permissive dict, optional):
Default Value:
{}
Config Schema:
cpu (String, optional):

The CPU override to use for the launched task.

memory (String, optional):

The memory override to use for the launched task.

ephemeral_storage (Int, optional):

The ephemeral storage, in GiB, to use for the launched task.

run_ecs_tags (List[strict dict], optional):

Additional tags to apply to the launched ECS task.

RunLauncher that starts a task in ECS for each Dagster job run.

Redshift

dagster_aws.redshift.RedshiftClientResource ResourceDefinition[source]

Config Schema:
host (dagster.StringSource):

Redshift host

port (Union[dagster.IntSource, None], optional):

Redshift port

Default Value: 5439

user (Union[dagster.StringSource, None], optional):

Username for Redshift connection

password (Union[dagster.StringSource, None], optional):

Password for Redshift connection

database (Union[dagster.StringSource, None], optional):

Name of the default database to use. After login, you can use USE DATABASE to change the database.

autocommit (Union[dagster.BoolSource, None], optional):

Whether to autocommit queries

connect_timeout (Union[dagster.IntSource, None], optional):

Timeout for connection to Redshift cluster. Defaults to 5 seconds.

Default Value: 5

sslmode (Union[dagster.StringSource, None], optional):

SSL mode to use. See the Redshift documentation for reference: https://docs.aws.amazon.com/redshift/latest/mgmt/connecting-ssl-support.html

Default Value: ‘require’

This resource enables connecting to a Redshift cluster and issuing queries against that cluster.

Example

from dagster import Definitions, asset, EnvVar
from dagster_aws.redshift import RedshiftClientResource

@asset
def example_redshift_asset(context, redshift: RedshiftClientResource):
    redshift.get_client().execute_query('SELECT 1', fetch_results=True)

redshift_configured = RedshiftClientResource(
    host='my-redshift-cluster.us-east-1.redshift.amazonaws.com',
    port=5439,
    user='dagster',
    password=EnvVar("DAGSTER_REDSHIFT_PASSWORD"),
    database='dev',
)

defs = Definitions(
    assets=[example_redshift_asset],
    resources={'redshift': redshift_configured},
)

Testing

dagster_aws.redshift.FakeRedshiftClientResource ResourceDefinition[source]

Config Schema:
host (dagster.StringSource):

Redshift host

port (Union[dagster.IntSource, None], optional):

Redshift port

Default Value: 5439

user (Union[dagster.StringSource, None], optional):

Username for Redshift connection

password (Union[dagster.StringSource, None], optional):

Password for Redshift connection

database (Union[dagster.StringSource, None], optional):

Name of the default database to use. After login, you can use USE DATABASE to change the database.

autocommit (Union[dagster.BoolSource, None], optional):

Whether to autocommit queries

connect_timeout (Union[dagster.IntSource, None], optional):

Timeout for connection to Redshift cluster. Defaults to 5 seconds.

Default Value: 5

sslmode (Union[dagster.StringSource, None], optional):

SSL mode to use. See the Redshift documentation for reference: https://docs.aws.amazon.com/redshift/latest/mgmt/connecting-ssl-support.html

Default Value: ‘require’

This resource enables connecting to a Redshift cluster and issuing queries against that cluster.

Example

from dagster import Definitions, asset, EnvVar
from dagster_aws.redshift import RedshiftClientResource

@asset
def example_redshift_asset(context, redshift: RedshiftClientResource):
    redshift.get_client().execute_query('SELECT 1', fetch_results=True)

redshift_configured = RedshiftClientResource(
    host='my-redshift-cluster.us-east-1.redshift.amazonaws.com',
    port=5439,
    user='dagster',
    password=EnvVar("DAGSTER_REDSHIFT_PASSWORD"),
    database='dev',
)

defs = Definitions(
    assets=[example_redshift_asset],
    resources={'redshift': redshift_configured},
)

EMR

dagster_aws.emr.emr_pyspark_step_launcher ResourceDefinition[source]

Config Schema:
spark_config (permissive dict, optional):
Default Value:
{
    "spark": {
        "app": {},
        "driver": {
            "blockManager": {}
        },
        "executor": {
            "pyspark": {},
            "logs": {
                "rolling": {
                    "time": {}
                }
            }
        },
        "local": {},
        "submit": {},
        "log": {},
        "redaction": {},
        "python": {
            "profile": {},
            "worker": {}
        },
        "files": {},
        "jars": {},
        "pyspark": {
            "driver": {}
        },
        "reducer": {},
        "shuffle": {
            "file": {},
            "io": {},
            "service": {
                "index": {
                    "cache": {}
                }
            },
            "sort": {},
            "spill": {},
            "registration": {}
        },
        "eventLog": {
            "logBlockUpdates": {},
            "longForm": {},
            "buffer": {}
        },
        "ui": {
            "dagGraph": {},
            "liveUpdate": {}
        },
        "worker": {
            "ui": {}
        },
        "sql": {
            "ui": {}
        },
        "streaming": {
            "ui": {},
            "backpressure": {},
            "receiver": {
                "writeAheadLog": {}
            },
            "kafka": {},
            "driver": {
                "writeAheadLog": {}
            }
        },
        "broadcast": {},
        "io": {
            "compression": {
                "lz4": {},
                "snappy": {},
                "zstd": {}
            }
        },
        "kryo": {},
        "kryoserializer": {
            "buffer": {}
        },
        "rdd": {},
        "serializer": {},
        "memory": {
            "offHeap": {}
        },
        "storage": {
            "replication": {}
        },
        "cleaner": {
            "periodicGC": {},
            "referenceTracking": {
                "blocking": {}
            }
        },
        "default": {},
        "hadoop": {
            "mapreduce": {
                "fileoutputcommitter": {
                    "algorithm": {}
                }
            }
        },
        "rpc": {
            "message": {},
            "retry": {}
        },
        "blockManager": {},
        "network": {},
        "port": {},
        "core": {
            "connection": {
                "ack": {
                    "wait": {}
                }
            }
        },
        "cores": {},
        "locality": {
            "wait": {}
        },
        "scheduler": {
            "revive": {},
            "listenerbus": {
                "eventqueue": {}
            }
        },
        "blacklist": {
            "task": {},
            "stage": {},
            "application": {
                "fetchFailure": {}
            }
        },
        "speculation": {},
        "task": {
            "reaper": {}
        },
        "stage": {},
        "dynamicAllocation": {},
        "r": {
            "driver": {},
            "shell": {}
        },
        "graphx": {
            "pregel": {}
        },
        "deploy": {
            "zookeeper": {}
        }
    }
}
Config Schema:
spark (permissive dict, optional):
Default Value:
{
    "app": {},
    "driver": {
        "blockManager": {}
    },
    "executor": {
        "pyspark": {},
        "logs": {
            "rolling": {
                "time": {}
            }
        }
    },
    "local": {},
    "submit": {},
    "log": {},
    "redaction": {},
    "python": {
        "profile": {},
        "worker": {}
    },
    "files": {},
    "jars": {},
    "pyspark": {
        "driver": {}
    },
    "reducer": {},
    "shuffle": {
        "file": {},
        "io": {},
        "service": {
            "index": {
                "cache": {}
            }
        },
        "sort": {},
        "spill": {},
        "registration": {}
    },
    "eventLog": {
        "logBlockUpdates": {},
        "longForm": {},
        "buffer": {}
    },
    "ui": {
        "dagGraph": {},
        "liveUpdate": {}
    },
    "worker": {
        "ui": {}
    },
    "sql": {
        "ui": {}
    },
    "streaming": {
        "ui": {},
        "backpressure": {},
        "receiver": {
            "writeAheadLog": {}
        },
        "kafka": {},
        "driver": {
            "writeAheadLog": {}
        }
    },
    "broadcast": {},
    "io": {
        "compression": {
            "lz4": {},
            "snappy": {},
            "zstd": {}
        }
    },
    "kryo": {},
    "kryoserializer": {
        "buffer": {}
    },
    "rdd": {},
    "serializer": {},
    "memory": {
        "offHeap": {}
    },
    "storage": {
        "replication": {}
    },
    "cleaner": {
        "periodicGC": {},
        "referenceTracking": {
            "blocking": {}
        }
    },
    "default": {},
    "hadoop": {
        "mapreduce": {
            "fileoutputcommitter": {
                "algorithm": {}
            }
        }
    },
    "rpc": {
        "message": {},
        "retry": {}
    },
    "blockManager": {},
    "network": {},
    "port": {},
    "core": {
        "connection": {
            "ack": {
                "wait": {}
            }
        }
    },
    "cores": {},
    "locality": {
        "wait": {}
    },
    "scheduler": {
        "revive": {},
        "listenerbus": {
            "eventqueue": {}
        }
    },
    "blacklist": {
        "task": {},
        "stage": {},
        "application": {
            "fetchFailure": {}
        }
    },
    "speculation": {},
    "task": {
        "reaper": {}
    },
    "stage": {},
    "dynamicAllocation": {},
    "r": {
        "driver": {},
        "shell": {}
    },
    "graphx": {
        "pregel": {}
    },
    "deploy": {
        "zookeeper": {}
    }
}
Config Schema:
app (permissive dict, optional):
Default Value:
{}
Config Schema:
name (dagster.StringSource, optional):

Application Properties: The name of your application. This will appear in the UI and in log data.

driver (permissive dict, optional):
Default Value:
{
    "blockManager": {}
}
Config Schema:
cores (dagster.IntSource, optional):

Application Properties: Number of cores to use for the driver process, only in cluster mode.

maxResultSize (dagster.StringSource, optional):

Application Properties: Limit of total size of serialized results of all partitions for each Spark action (e.g. collect) in bytes. Should be at least 1M, or 0 for unlimited. Jobs will be aborted if the total size is above this limit. Having a high limit may cause out-of-memory errors in driver (depends on spark.driver.memory and memory overhead of objects in JVM). Setting a proper limit can protect the driver from out-of-memory errors.

memory (dagster.StringSource, optional):

Application Properties: Amount of memory to use for the driver process, i.e. where SparkContext is initialized, in the same format as JVM memory strings with a size unit suffix (“k”, “m”, “g” or “t”) (e.g. 512m, 2g). Note: In client mode, this config must not be set through the SparkConf directly in your application, because the driver JVM has already started at that point. Instead, please set this through the –driver-memory command line option or in your default properties file.

memoryOverhead (dagster.StringSource, optional):

Application Properties: The amount of off-heap memory to be allocated per driver in cluster mode, in MiB unless otherwise specified. This is memory that accounts for things like VM overheads, interned strings, other native overheads, etc. This tends to grow with the container size (typically 6-10%). This option is currently supported on YARN and Kubernetes.

supervise (Bool, optional):

Application Properties: If true, restarts the driver automatically if it fails with a non-zero exit status. Only has effect in Spark standalone mode or Mesos cluster deploy mode.

extraClassPath (dagster.StringSource, optional):

Runtime Environment: Extra classpath entries to prepend to the classpath of the driver. Note: In client mode, this config must not be set through the SparkConf directly in your application, because the driver JVM has already started at that point. Instead, please set this through the –driver-class-path command line option or in your default properties file.

extraJavaOptions (dagster.StringSource, optional):

Runtime Environment: A string of extra JVM options to pass to the driver. For instance, GC settings or other logging. Note that it is illegal to set maximum heap size (-Xmx) settings with this option. Maximum heap size settings can be set with spark.driver.memory in the cluster mode and through the –driver-memory command line option in the client mode. Note: In client mode, this config must not be set through the SparkConf directly in your application, because the driver JVM has already started at that point. Instead, please set this through the –driver-java-options command line option or in your default properties file.

extraLibraryPath (dagster.StringSource, optional):

Runtime Environment: Set a special library path to use when launching the driver JVM. Note: In client mode, this config must not be set through the SparkConf directly in your application, because the driver JVM has already started at that point. Instead, please set this through the –driver-library-path command line option or in your default properties file.

userClassPathFirst (Bool, optional):

Runtime Environment: (Experimental) Whether to give user-added jars precedence over Spark’s own jars when loading classes in the driver. This feature can be used to mitigate conflicts between Spark’s dependencies and user dependencies. It is currently an experimental feature. This is used in cluster mode only.

blockManager (permissive dict, optional):
Default Value:
{}
Config Schema:
port (dagster.StringSource, optional):

Networking: Driver-specific port for the block manager to listen on, for cases where it cannot use the same configuration as executors.

bindAddress (dagster.StringSource, optional):

Networking: Hostname or IP address where to bind listening sockets. This config overrides the SPARK_LOCAL_IP environment variable (see below). It also allows a different address from the local one to be advertised to executors or external systems. This is useful, for example, when running containers with bridged networking. For this to properly work, the different ports used by the driver (RPC, block manager and UI) need to be forwarded from the container’s host.

host (dagster.StringSource, optional):

Networking: Hostname or IP address for the driver. This is used for communicating with the executors and the standalone Master.

port (dagster.StringSource, optional):

Networking: Port for the driver to listen on. This is used for communicating with the executors and the standalone Master.

executor (permissive dict, optional):
Default Value:
{
    "pyspark": {},
    "logs": {
        "rolling": {
            "time": {}
        }
    }
}
Config Schema:
memory (dagster.StringSource, optional):

Application Properties: Amount of memory to use per executor process, in the same format as JVM memory strings with a size unit suffix (“k”, “m”, “g” or “t”) (e.g. 512m, 2g).

pyspark (permissive dict, optional):
Default Value:
{}
Config Schema:
memory (dagster.StringSource, optional):

Application Properties: The amount of memory to be allocated to PySpark in each executor, in MiB unless otherwise specified. If set, PySpark memory for an executor will be limited to this amount. If not set, Spark will not limit Python’s memory use and it is up to the application to avoid exceeding the overhead memory space shared with other non-JVM processes. When PySpark is run in YARN or Kubernetes, this memory is added to executor resource requests.

memoryOverhead (dagster.StringSource, optional):

Application Properties: The amount of off-heap memory to be allocated per executor, in MiB unless otherwise specified. This is memory that accounts for things like VM overheads, interned strings, other native overheads, etc. This tends to grow with the executor size (typically 6-10%). This option is currently supported on YARN and Kubernetes.

extraClassPath (dagster.StringSource, optional):

Runtime Environment: Extra classpath entries to prepend to the classpath of executors. This exists primarily for backwards-compatibility with older versions of Spark. Users typically should not need to set this option.

extraJavaOptions (dagster.StringSource, optional):

Runtime Environment: A string of extra JVM options to pass to executors. For instance, GC settings or other logging. Note that it is illegal to set Spark properties or maximum heap size (-Xmx) settings with this option. Spark properties should be set using a SparkConf object or the spark-defaults.conf file used with the spark-submit script. Maximum heap size settings can be set with spark.executor.memory. The following symbols, if present will be interpolated: {{APP_ID}} will be replaced by application ID and {{EXECUTOR_ID}} will be replaced by executor ID. For example, to enable verbose gc logging to a file named for the executor ID of the app in /tmp, pass a ‘value’ of: -verbose:gc -Xloggc:/tmp/{{APP_ID}}-{{EXECUTOR_ID}}.gc

extraLibraryPath (dagster.StringSource, optional):

Runtime Environment: Set a special library path to use when launching executor JVM’s.

logs (permissive dict, optional):
Default Value:
{
    "rolling": {
        "time": {}
    }
}
Config Schema:
rolling (permissive dict, optional):
Default Value:
{
    "time": {}
}
Config Schema:
maxRetainedFiles (dagster.IntSource, optional):

Runtime Environment: Sets the number of latest rolling log files that are going to be retained by the system. Older log files will be deleted. Disabled by default.

enableCompression (Bool, optional):

Runtime Environment: Enable executor log compression. If it is enabled, the rolled executor logs will be compressed. Disabled by default.

maxSize (dagster.IntSource, optional):

Runtime Environment: Set the max size of the file in bytes by which the executor logs will be rolled over. Rolling is disabled by default. See spark.executor.logs.rolling.maxRetainedFiles for automatic cleaning of old logs.

strategy (dagster.StringSource, optional):

Runtime Environment: Set the strategy of rolling of executor logs. By default it is disabled. It can be set to “time” (time-based rolling) or “size” (size-based rolling). For “time”, use spark.executor.logs.rolling.time.interval to set the rolling interval. For “size”, use spark.executor.logs.rolling.maxSize to set the maximum file size for rolling.

time (permissive dict, optional):
Default Value:
{}
Config Schema:
interval (dagster.StringSource, optional):

Runtime Environment: Set the time interval by which the executor logs will be rolled over. Rolling is disabled by default. Valid values are daily, hourly, minutely or any interval in seconds. See spark.executor.logs.rolling.maxRetainedFiles for automatic cleaning of old logs.

userClassPathFirst (Bool, optional):

Runtime Environment: (Experimental) Same functionality as spark.driver.userClassPathFirst, but applied to executor instances.

cores (dagster.IntSource, optional):

Execution Behavior: The number of cores to use on each executor. In standalone and Mesos coarse-grained modes, for more detail, see this description.

heartbeatInterval (dagster.StringSource, optional):

Execution Behavior: Interval between each executor’s heartbeats to the driver. Heartbeats let the driver know that the executor is still alive and update it with metrics for in-progress tasks. spark.executor.heartbeatInterval should be significantly less than spark.network.timeout

extraListeners (dagster.StringSource, optional):

Application Properties: A comma-separated list of classes that implement SparkListener; when initializing SparkContext, instances of these classes will be created and registered with Spark’s listener bus. If a class has a single-argument constructor that accepts a SparkConf, that constructor will be called; otherwise, a zero-argument constructor will be called. If no valid constructor can be found, the SparkContext creation will fail with an exception.

local (permissive dict, optional):
Default Value:
{}
Config Schema:
dir (dagster.StringSource, optional):

Application Properties: Directory to use for “scratch” space in Spark, including map output files and RDDs that get stored on disk. This should be on a fast, local disk in your system. It can also be a comma-separated list of multiple directories on different disks. NOTE: In Spark 1.0 and later this will be overridden by SPARK_LOCAL_DIRS (Standalone), MESOS_SANDBOX (Mesos) or LOCAL_DIRS (YARN) environment variables set by the cluster manager.

logConf (Bool, optional):

Application Properties: Logs the effective SparkConf as INFO when a SparkContext is started.

master (dagster.StringSource, optional):

Application Properties: The cluster manager to connect to. See the list of allowed master URL’s.

submit (permissive dict, optional):
Default Value:
{}
Config Schema:
deployMode (dagster.StringSource, optional):

Application Properties: The deploy mode of Spark driver program, either “client” or “cluster”, Which means to launch driver program locally (“client”) or remotely (“cluster”) on one of the nodes inside the cluster.

pyFiles (dagster.StringSource, optional):

Runtime Environment: Comma-separated list of .zip, .egg, or .py files to place on the PYTHONPATH for Python apps. Globs are allowed.

log (permissive dict, optional):
Default Value:
{}
Config Schema:
callerContext (dagster.StringSource, optional):

Application Properties: Application information that will be written into Yarn RM log/HDFS audit log when running on Yarn/HDFS. Its length depends on the Hadoop configuration hadoop.caller.context.max.size. It should be concise, and typically can have up to 50 characters.

redaction (permissive dict, optional):
Default Value:
{}
Config Schema:
regex (dagster.StringSource, optional):

Runtime Environment: Regex to decide which Spark configuration properties and environment variables in driver and executor environments contain sensitive information. When this regex matches a property key or value, the value is redacted from the environment UI and various logs like YARN and event logs.

python (permissive dict, optional):
Default Value:
{
    "profile": {},
    "worker": {}
}
Config Schema:
profile (permissive dict, optional):
Default Value:
{}
Config Schema:
root (Bool, optional):

Runtime Environment: Enable profiling in Python worker, the profile result will show up by sc.show_profiles(), or it will be displayed before the driver exits. It also can be dumped into disk by sc.dump_profiles(path). If some of the profile results had been displayed manually, they will not be displayed automatically before driver exiting. By default the pyspark.profiler.BasicProfiler will be used, but this can be overridden by passing a profiler class in as a parameter to the SparkContext constructor.

dump (dagster.StringSource, optional):

Runtime Environment: The directory which is used to dump the profile result before driver exiting. The results will be dumped as separated file for each RDD. They can be loaded by ptats.Stats(). If this is specified, the profile result will not be displayed automatically.

worker (permissive dict, optional):
Default Value:
{}
Config Schema:
memory (dagster.StringSource, optional):

Runtime Environment: Amount of memory to use per python worker process during aggregation, in the same format as JVM memory strings with a size unit suffix (“k”, “m”, “g” or “t”) (e.g. 512m, 2g). If the memory used during aggregation goes above this amount, it will spill the data into disks.

reuse (Bool, optional):

Runtime Environment: Reuse Python worker or not. If yes, it will use a fixed number of Python workers, does not need to fork() a Python process for every task. It will be very useful if there is large broadcast, then the broadcast will not be needed to transferred from JVM to Python worker for every task.

files (permissive dict, optional):
Default Value:
{}
Config Schema:
root (dagster.StringSource, optional):

Runtime Environment: Comma-separated list of files to be placed in the working directory of each executor. Globs are allowed.

fetchTimeout (dagster.StringSource, optional):

Execution Behavior: Communication timeout to use when fetching files added through SparkContext.addFile() from the driver.

useFetchCache (Bool, optional):

Execution Behavior: If set to true (default), file fetching will use a local cache that is shared by executors that belong to the same application, which can improve task launching performance when running many executors on the same host. If set to false, these caching optimizations will be disabled and all executors will fetch their own copies of files. This optimization may be disabled in order to use Spark local directories that reside on NFS filesystems (see SPARK-6313 for more details).

overwrite (Bool, optional):

Execution Behavior: Whether to overwrite files added through SparkContext.addFile() when the target file exists and its contents do not match those of the source.

maxPartitionBytes (dagster.IntSource, optional):

Execution Behavior: The maximum number of bytes to pack into a single partition when reading files.

openCostInBytes (dagster.IntSource, optional):

Execution Behavior: The estimated cost to open a file, measured by the number of bytes could be scanned at the same time. This is used when putting multiple files into a partition. It is better to overestimate, then the partitions with small files will be faster than partitions with bigger files.

jars (permissive dict, optional):
Default Value:
{}
Config Schema:
root (dagster.StringSource, optional):

Runtime Environment: Comma-separated list of jars to include on the driver and executor classpaths. Globs are allowed.

packages (dagster.StringSource, optional):

Runtime Environment: Comma-separated list of Maven coordinates of jars to include on the driver and executor classpaths. The coordinates should be groupId:artifactId:version. If spark.jars.ivySettings is given artifacts will be resolved according to the configuration in the file, otherwise artifacts will be searched for in the local maven repo, then maven central and finally any additional remote repositories given by the command-line option –repositories. For more details, see Advanced Dependency Management.

excludes (dagster.StringSource, optional):

Runtime Environment: Comma-separated list of groupId:artifactId, to exclude while resolving the dependencies provided in spark.jars.packages to avoid dependency conflicts.

ivy (dagster.StringSource, optional):

Runtime Environment: Path to specify the Ivy user directory, used for the local Ivy cache and package files from spark.jars.packages. This will override the Ivy property ivy.default.ivy.user.dir which defaults to ~/.ivy2.

ivySettings (dagster.StringSource, optional):

Runtime Environment: Path to an Ivy settings file to customize resolution of jars specified using spark.jars.packages instead of the built-in defaults, such as maven central. Additional repositories given by the command-line option –repositories or spark.jars.repositories will also be included. Useful for allowing Spark to resolve artifacts from behind a firewall e.g. via an in-house artifact server like Artifactory. Details on the settings file format can be found at http://ant.apache.org/ivy/history/latest-milestone/settings.html

repositories (dagster.StringSource, optional):

Runtime Environment: Comma-separated list of additional remote repositories to search for the maven coordinates given with –packages or spark.jars.packages.

pyspark (permissive dict, optional):
Default Value:
{
    "driver": {}
}
Config Schema:
driver (permissive dict, optional):
Default Value:
{}
Config Schema:
python (dagster.StringSource, optional):

Runtime Environment: Python binary executable to use for PySpark in driver. (default is spark.pyspark.python)

python (dagster.StringSource, optional):

Runtime Environment: Python binary executable to use for PySpark in both driver and executors.

reducer (permissive dict, optional):
Default Value:
{}
Config Schema:
maxSizeInFlight (dagster.StringSource, optional):

Shuffle Behavior: Maximum size of map outputs to fetch simultaneously from each reduce task, in MiB unless otherwise specified. Since each output requires us to create a buffer to receive it, this represents a fixed memory overhead per reduce task, so keep it small unless you have a large amount of memory.

maxReqsInFlight (dagster.IntSource, optional):

Shuffle Behavior: This configuration limits the number of remote requests to fetch blocks at any given point. When the number of hosts in the cluster increase, it might lead to very large number of inbound connections to one or more nodes, causing the workers to fail under load. By allowing it to limit the number of fetch requests, this scenario can be mitigated.

maxBlocksInFlightPerAddress (dagster.IntSource, optional):

Shuffle Behavior: This configuration limits the number of remote blocks being fetched per reduce task from a given host port. When a large number of blocks are being requested from a given address in a single fetch or simultaneously, this could crash the serving executor or Node Manager. This is especially useful to reduce the load on the Node Manager when external shuffle is enabled. You can mitigate this issue by setting it to a lower value.

maxRemoteBlockSizeFetchToMem (dagster.IntSource, optional):

Shuffle Behavior: The remote block will be fetched to disk when size of the block is above this threshold in bytes. This is to avoid a giant request that takes too much memory. By default, this is only enabled for blocks > 2GB, as those cannot be fetched directly into memory, no matter what resources are available. But it can be turned down to a much lower value (eg. 200m) to avoid using too much memory on smaller blocks as well. Note this configuration will affect both shuffle fetch and block manager remote block fetch. For users who enabled external shuffle service, this feature can only be used when external shuffle service is newer than Spark 2.2.

shuffle (permissive dict, optional):
Default Value:
{
    "file": {},
    "io": {},
    "service": {
        "index": {
            "cache": {}
        }
    },
    "sort": {},
    "spill": {},
    "registration": {}
}
Config Schema:
compress (Bool, optional):

Shuffle Behavior: Whether to compress map output files. Generally a good idea. Compression will use spark.io.compression.codec.

file (permissive dict, optional):
Default Value:
{}
Config Schema:
buffer (dagster.StringSource, optional):

Shuffle Behavior: Size of the in-memory buffer for each shuffle file output stream, in KiB unless otherwise specified. These buffers reduce the number of disk seeks and system calls made in creating intermediate shuffle files.

io (permissive dict, optional):
Default Value:
{}
Config Schema:
maxRetries (dagster.IntSource, optional):

Shuffle Behavior: (Netty only) Fetches that fail due to IO-related exceptions are automatically retried if this is set to a non-zero value. This retry logic helps stabilize large shuffles in the face of long GC pauses or transient network connectivity issues.

numConnectionsPerPeer (dagster.IntSource, optional):

Shuffle Behavior: (Netty only) Connections between hosts are reused in order to reduce connection buildup for large clusters. For clusters with many hard disks and few hosts, this may result in insufficient concurrency to saturate all disks, and so users may consider increasing this value.

preferDirectBufs (Bool, optional):

Shuffle Behavior: (Netty only) Off-heap buffers are used to reduce garbage collection during shuffle and cache block transfer. For environments where off-heap memory is tightly limited, users may wish to turn this off to force all allocations from Netty to be on-heap.

retryWait (dagster.StringSource, optional):

Shuffle Behavior: (Netty only) How long to wait between retries of fetches. The maximum delay caused by retrying is 15 seconds by default, calculated as maxRetries * retryWait.

service (permissive dict, optional):
Default Value:
{
    "index": {
        "cache": {}
    }
}
Config Schema:
enabled (Bool, optional):

Shuffle Behavior: Enables the external shuffle service. This service preserves the shuffle files written by executors so the executors can be safely removed. This must be enabled if spark.dynamicAllocation.enabled is “true”. The external shuffle service must be set up in order to enable it. See dynamic allocation configuration and setup documentation for more information.

port (dagster.IntSource, optional):

Shuffle Behavior: Port on which the external shuffle service will run.

index (permissive dict, optional):
Default Value:
{
    "cache": {}
}
Config Schema:
cache (permissive dict, optional):
Default Value:
{}
Config Schema:
size (dagster.StringSource, optional):

Shuffle Behavior: Cache entries limited to the specified memory footprint in bytes.

maxChunksBeingTransferred (dagster.IntSource, optional):

Shuffle Behavior: The max number of chunks allowed to be transferred at the same time on shuffle service. Note that new incoming connections will be closed when the max number is hit. The client will retry according to the shuffle retry configs (see spark.shuffle.io.maxRetries and spark.shuffle.io.retryWait), if those limits are reached the task will fail with fetch failure.

sort (permissive dict, optional):
Default Value:
{}
Config Schema:
bypassMergeThreshold (dagster.IntSource, optional):

Shuffle Behavior: (Advanced) In the sort-based shuffle manager, avoid merge-sorting data if there is no map-side aggregation and there are at most this many reduce partitions.

spill (permissive dict, optional):
Default Value:
{}
Config Schema:
compress (Bool, optional):

Shuffle Behavior: Whether to compress data spilled during shuffles. Compression will use spark.io.compression.codec.

accurateBlockThreshold (dagster.IntSource, optional):

Shuffle Behavior: Threshold in bytes above which the size of shuffle blocks in HighlyCompressedMapStatus is accurately recorded. This helps to prevent OOM by avoiding underestimating shuffle block size when fetch shuffle blocks.

registration (permissive dict, optional):
Default Value:
{}
Config Schema:
timeout (dagster.IntSource, optional):

Shuffle Behavior: Timeout in milliseconds for registration to the external shuffle service.

maxAttempts (dagster.IntSource, optional):

Shuffle Behavior: When we fail to register to the external shuffle service, we will retry for maxAttempts times.

memoryFraction (Float, optional):

Memory Management: (deprecated) This is read only if spark.memory.useLegacyMode is enabled. Fraction of Java heap to use for aggregation and cogroups during shuffles. At any given time, the collective size of all in-memory maps used for shuffles is bounded by this limit, beyond which the contents will begin to spill to disk. If spills are often, consider increasing this value at the expense of spark.storage.memoryFraction.

eventLog (permissive dict, optional):
Default Value:
{
    "logBlockUpdates": {},
    "longForm": {},
    "buffer": {}
}
Config Schema:
logBlockUpdates (permissive dict, optional):
Default Value:
{}
Config Schema:
enabled (dagster.StringSource, optional):

Spark UI: Whether to log events for every block update, if spark.eventLog.enabled is true. *Warning*: This will increase the size of the event log considerably.

longForm (permissive dict, optional):
Default Value:
{}
Config Schema:
enabled (dagster.StringSource, optional):

Spark UI: If true, use the long form of call sites in the event log. Otherwise use the short form.

compress (dagster.StringSource, optional):

Spark UI: Whether to compress logged events, if spark.eventLog.enabled is true. Compression will use spark.io.compression.codec.

dir (dagster.StringSource, optional):

Spark UI: Base directory in which Spark events are logged, if spark.eventLog.enabled is true. Within this base directory, Spark creates a sub-directory for each application, and logs the events specific to the application in this directory. Users may want to set this to a unified location like an HDFS directory so history files can be read by the history server.

enabled (dagster.StringSource, optional):

Spark UI: Whether to log Spark events, useful for reconstructing the Web UI after the application has finished.

overwrite (dagster.StringSource, optional):

Spark UI: Whether to overwrite any existing files.

buffer (permissive dict, optional):
Default Value:
{}
Config Schema:
kb (dagster.StringSource, optional):

Spark UI: Buffer size to use when writing to output streams, in KiB unless otherwise specified.

ui (permissive dict, optional):
Default Value:
{
    "dagGraph": {},
    "liveUpdate": {}
}
Config Schema:
dagGraph (permissive dict, optional):
Default Value:
{}
Config Schema:
retainedRootRDDs (dagster.StringSource, optional):

Spark UI: How many DAG graph nodes the Spark UI and status APIs remember before garbage collecting.

enabled (dagster.StringSource, optional):

Spark UI: Whether to run the web UI for the Spark application.

killEnabled (dagster.StringSource, optional):

Spark UI: Allows jobs and stages to be killed from the web UI.

liveUpdate (permissive dict, optional):
Default Value:
{}
Config Schema:
period (dagster.StringSource, optional):

Spark UI: How often to update live entities. -1 means “never update” when replaying applications, meaning only the last write will happen. For live applications, this avoids a few operations that we can live without when rapidly processing incoming task events.

port (dagster.StringSource, optional):

Spark UI: Port for your application’s dashboard, which shows memory and workload data.

retainedJobs (dagster.StringSource, optional):

Spark UI: How many jobs the Spark UI and status APIs remember before garbage collecting. This is a target maximum, and fewer elements may be retained in some circumstances.

retainedStages (dagster.StringSource, optional):

Spark UI: How many stages the Spark UI and status APIs remember before garbage collecting. This is a target maximum, and fewer elements may be retained in some circumstances.

retainedTasks (dagster.StringSource, optional):

Spark UI: How many tasks the Spark UI and status APIs remember before garbage collecting. This is a target maximum, and fewer elements may be retained in some circumstances.

reverseProxy (dagster.StringSource, optional):

Spark UI: Enable running Spark Master as reverse proxy for worker and application UIs. In this mode, Spark master will reverse proxy the worker and application UIs to enable access without requiring direct access to their hosts. Use it with caution, as worker and application UI will not be accessible directly, you will only be able to access them through spark master/proxy public URL. This setting affects all the workers and application UIs running in the cluster and must be set on all the workers, drivers and masters.

reverseProxyUrl (dagster.StringSource, optional):

Spark UI: This is the URL where your proxy is running. This URL is for proxy which is running in front of Spark Master. This is useful when running proxy for authentication e.g. OAuth proxy. Make sure this is a complete URL including scheme (http/https) and port to reach your proxy.

showConsoleProgress (dagster.StringSource, optional):

Spark UI: Show the progress bar in the console. The progress bar shows the progress of stages that run for longer than 500ms. If multiple stages run at the same time, multiple progress bars will be displayed on the same line.

retainedDeadExecutors (dagster.StringSource, optional):

Spark UI: How many dead executors the Spark UI and status APIs remember before garbage collecting.

filters (dagster.StringSource, optional):

Spark UI: Comma separated list of filter class names to apply to the Spark Web UI. The filter should be a standard javax servlet Filter. Filter parameters can also be specified in the configuration, by setting config entries of the form spark.<class name of filter>.param.<param name>=<value> For example: spark.ui.filters=com.test.filter1 spark.com.test.filter1.param.name1=foo spark.com.test.filter1.param.name2=bar

worker (permissive dict, optional):
Default Value:
{
    "ui": {}
}
Config Schema:
ui (permissive dict, optional):
Default Value:
{}
Config Schema:
retainedExecutors (dagster.StringSource, optional):

Spark UI: How many finished executors the Spark UI and status APIs remember before garbage collecting.

retainedDrivers (dagster.StringSource, optional):

Spark UI: How many finished drivers the Spark UI and status APIs remember before garbage collecting.

sql (permissive dict, optional):
Default Value:
{
    "ui": {}
}
Config Schema:
ui (permissive dict, optional):
Default Value:
{}
Config Schema:
retainedExecutions (dagster.StringSource, optional):

Spark UI: How many finished executions the Spark UI and status APIs remember before garbage collecting.

streaming (permissive dict, optional):
Default Value:
{
    "ui": {},
    "backpressure": {},
    "receiver": {
        "writeAheadLog": {}
    },
    "kafka": {},
    "driver": {
        "writeAheadLog": {}
    }
}
Config Schema:
ui (permissive dict, optional):
Default Value:
{}
Config Schema:
retainedBatches (dagster.StringSource, optional):

Spark Streaming: How many batches the Spark Streaming UI and status APIs remember before garbage collecting.

backpressure (permissive dict, optional):
Default Value:
{}
Config Schema:
enabled (dagster.StringSource, optional):

Spark Streaming: Enables or disables Spark Streaming’s internal backpressure mechanism (since 1.5). This enables the Spark Streaming to control the receiving rate based on the current batch scheduling delays and processing times so that the system receives only as fast as the system can process. Internally, this dynamically sets the maximum receiving rate of receivers. This rate is upper bounded by the values spark.streaming.receiver.maxRate and spark.streaming.kafka.maxRatePerPartition if they are set (see below).

initialRate (dagster.StringSource, optional):

Spark Streaming: This is the initial maximum receiving rate at which each receiver will receive data for the first batch when the backpressure mechanism is enabled.

blockInterval (dagster.StringSource, optional):

Spark Streaming: Interval at which data received by Spark Streaming receivers is chunked into blocks of data before storing them in Spark. Minimum recommended - 50 ms. See the performance tuning section in the Spark Streaming programing guide for more details.

receiver (permissive dict, optional):
Default Value:
{
    "writeAheadLog": {}
}
Config Schema:
maxRate (dagster.StringSource, optional):

Spark Streaming: Maximum rate (number of records per second) at which each receiver will receive data. Effectively, each stream will consume at most this number of records per second. Setting this configuration to 0 or a negative number will put no limit on the rate. See the deployment guide in the Spark Streaming programing guide for mode details.

writeAheadLog (permissive dict, optional):
Default Value:
{}
Config Schema:
enable (dagster.StringSource, optional):

Spark Streaming: Enable write-ahead logs for receivers. All the input data received through receivers will be saved to write-ahead logs that will allow it to be recovered after driver failures. See the deployment guide in the Spark Streaming programing guide for more details.

closeFileAfterWrite (dagster.StringSource, optional):

Spark Streaming: Whether to close the file after writing a write-ahead log record on the receivers. Set this to ‘true’ when you want to use S3 (or any file system that does not support flushing) for the data WAL on the receivers.

unpersist (dagster.StringSource, optional):

Spark Streaming: Force RDDs generated and persisted by Spark Streaming to be automatically unpersisted from Spark’s memory. The raw input data received by Spark Streaming is also automatically cleared. Setting this to false will allow the raw data and persisted RDDs to be accessible outside the streaming application as they will not be cleared automatically. But it comes at the cost of higher memory usage in Spark.

stopGracefullyOnShutdown (dagster.StringSource, optional):

Spark Streaming: If true, Spark shuts down the StreamingContext gracefully on JVM shutdown rather than immediately.

kafka (permissive dict, optional):
Default Value:
{}
Config Schema:
maxRatePerPartition (dagster.StringSource, optional):

Spark Streaming: Maximum rate (number of records per second) at which data will be read from each Kafka partition when using the new Kafka direct stream API. See the Kafka Integration guide for more details.

minRatePerPartition (dagster.StringSource, optional):

Spark Streaming: Minimum rate (number of records per second) at which data will be read from each Kafka partition when using the new Kafka direct stream API.

maxRetries (dagster.StringSource, optional):

Spark Streaming: Maximum number of consecutive retries the driver will make in order to find the latest offsets on the leader of each partition (a default value of 1 means that the driver will make a maximum of 2 attempts). Only applies to the new Kafka direct stream API.

driver (permissive dict, optional):
Default Value:
{
    "writeAheadLog": {}
}
Config Schema:
writeAheadLog (permissive dict, optional):
Default Value:
{}
Config Schema:
closeFileAfterWrite (dagster.StringSource, optional):

Spark Streaming: Whether to close the file after writing a write-ahead log record on the driver. Set this to ‘true’ when you want to use S3 (or any file system that does not support flushing) for the metadata WAL on the driver.

broadcast (permissive dict, optional):
Default Value:
{}
Config Schema:
compress (dagster.StringSource, optional):

Compression and Serialization: Whether to compress broadcast variables before sending them. Generally a good idea. Compression will use spark.io.compression.codec.

blockSize (dagster.StringSource, optional):

Execution Behavior: Size of each piece of a block for TorrentBroadcastFactory, in KiB unless otherwise specified. Too large a value decreases parallelism during broadcast (makes it slower); however, if it is too small, BlockManager might take a performance hit.

checksum (dagster.StringSource, optional):

Execution Behavior: Whether to enable checksum for broadcast. If enabled, broadcasts will include a checksum, which can help detect corrupted blocks, at the cost of computing and sending a little more data. It’s possible to disable it if the network has other mechanisms to guarantee data won’t be corrupted during broadcast.

io (permissive dict, optional):
Default Value:
{
    "compression": {
        "lz4": {},
        "snappy": {},
        "zstd": {}
    }
}
Config Schema:
compression (permissive dict, optional):
Default Value:
{
    "lz4": {},
    "snappy": {},
    "zstd": {}
}
Config Schema:
codec (dagster.StringSource, optional):

Compression and Serialization: The codec used to compress internal data such as RDD partitions, event log, broadcast variables and shuffle outputs. By default, Spark provides four codecs: lz4, lzf, snappy, and zstd. You can also use fully qualified class names to specify the codec, e.g. org.apache.spark.io.LZ4CompressionCodec, org.apache.spark.io.LZFCompressionCodec, org.apache.spark.io.SnappyCompressionCodec, and org.apache.spark.io.ZStdCompressionCodec.

lz4 (permissive dict, optional):
Default Value:
{}
Config Schema:
blockSize (dagster.StringSource, optional):

Compression and Serialization: Block size in bytes used in LZ4 compression, in the case when LZ4 compression codec is used. Lowering this block size will also lower shuffle memory usage when LZ4 is used.

snappy (permissive dict, optional):
Default Value:
{}
Config Schema:
blockSize (dagster.StringSource, optional):

Compression and Serialization: Block size in bytes used in Snappy compression, in the case when Snappy compression codec is used. Lowering this block size will also lower shuffle memory usage when Snappy is used.

zstd (permissive dict, optional):
Default Value:
{}
Config Schema:
level (dagster.StringSource, optional):

Compression and Serialization: Compression level for Zstd compression codec. Increasing the compression level will result in better compression at the expense of more CPU and memory.

bufferSize (dagster.StringSource, optional):

Compression and Serialization: Buffer size in bytes used in Zstd compression, in the case when Zstd compression codec is used. Lowering this size will lower the shuffle memory usage when Zstd is used, but it might increase the compression cost because of excessive JNI call overhead.

kryo (permissive dict, optional):
Default Value:
{}
Config Schema:
classesToRegister (dagster.StringSource, optional):

Compression and Serialization: If you use Kryo serialization, give a comma-separated list of custom class names to register with Kryo. See the tuning guide for more details.

referenceTracking (dagster.StringSource, optional):

Compression and Serialization: Whether to track references to the same object when serializing data with Kryo, which is necessary if your object graphs have loops and useful for efficiency if they contain multiple copies of the same object. Can be disabled to improve performance if you know this is not the case.

registrationRequired (dagster.StringSource, optional):

Compression and Serialization: Whether to require registration with Kryo. If set to ‘true’, Kryo will throw an exception if an unregistered class is serialized. If set to false (the default), Kryo will write unregistered class names along with each object. Writing class names can cause significant performance overhead, so enabling this option can enforce strictly that a user has not omitted classes from registration.

registrator (dagster.StringSource, optional):

Compression and Serialization: If you use Kryo serialization, give a comma-separated list of classes that register your custom classes with Kryo. This property is useful if you need to register your classes in a custom way, e.g. to specify a custom field serializer. Otherwise spark.kryo.classesToRegister is simpler. It should be set to classes that extend KryoRegistrator. See the tuning guide for more details.

unsafe (dagster.StringSource, optional):

Compression and Serialization: Whether to use unsafe based Kryo serializer. Can be substantially faster by using Unsafe Based IO.

kryoserializer (permissive dict, optional):
Default Value:
{
    "buffer": {}
}
Config Schema:
buffer (permissive dict, optional):
Default Value:
{}
Config Schema:
root (dagster.StringSource, optional):

Compression and Serialization: Initial size of Kryo’s serialization buffer, in KiB unless otherwise specified. Note that there will be one buffer per core on each worker. This buffer will grow up to spark.kryoserializer.buffer.max if needed.

max (dagster.StringSource, optional):

Compression and Serialization: Maximum allowable size of Kryo serialization buffer, in MiB unless otherwise specified. This must be larger than any object you attempt to serialize and must be less than 2048m. Increase this if you get a “buffer limit exceeded” exception inside Kryo.

rdd (permissive dict, optional):
Default Value:
{}
Config Schema:
compress (dagster.StringSource, optional):

Compression and Serialization: Whether to compress serialized RDD partitions (e.g. for StorageLevel.MEMORY_ONLY_SER in Java and Scala or StorageLevel.MEMORY_ONLY in Python). Can save substantial space at the cost of some extra CPU time. Compression will use spark.io.compression.codec.

serializer (permissive dict, optional):
Default Value:
{}
Config Schema:
root (dagster.StringSource, optional):

Compression and Serialization: Class to use for serializing objects that will be sent over the network or need to be cached in serialized form. The default of Java serialization works with any Serializable Java object but is quite slow, so we recommend using org.apache.spark.serializer.KryoSerializer and configuring Kryo serialization when speed is necessary. Can be any subclass of org.apache.spark.Serializer.

objectStreamReset (dagster.StringSource, optional):

Compression and Serialization: When serializing using org.apache.spark.serializer.JavaSerializer, the serializer caches objects to prevent writing redundant data, however that stops garbage collection of those objects. By calling ‘reset’ you flush that info from the serializer, and allow old objects to be collected. To turn off this periodic reset set it to -1. By default it will reset the serializer every 100 objects.

memory (permissive dict, optional):
Default Value:
{
    "offHeap": {}
}
Config Schema:
fraction (Float, optional):

Memory Management: Fraction of (heap space - 300MB) used for execution and storage. The lower this is, the more frequently spills and cached data eviction occur. The purpose of this config is to set aside memory for internal metadata, user data structures, and imprecise size estimation in the case of sparse, unusually large records. Leaving this at the default value is recommended. For more detail, including important information about correctly tuning JVM garbage collection when increasing this value, see this description.

storageFraction (Float, optional):

Memory Management: Amount of storage memory immune to eviction, expressed as a fraction of the size of the region set aside by spark.memory.fraction. The higher this is, the less working memory may be available to execution and tasks may spill to disk more often. Leaving this at the default value is recommended. For more detail, see this description.

offHeap (permissive dict, optional):
Default Value:
{}
Config Schema:
enabled (Bool, optional):

Memory Management: If true, Spark will attempt to use off-heap memory for certain operations. If off-heap memory use is enabled, then spark.memory.offHeap.size must be positive.

size (dagster.IntSource, optional):

Memory Management: The absolute amount of memory in bytes which can be used for off-heap allocation. This setting has no impact on heap memory usage, so if your executors’ total memory consumption must fit within some hard limit then be sure to shrink your JVM heap size accordingly. This must be set to a positive value when spark.memory.offHeap.enabled=true.

useLegacyMode (Bool, optional):

Memory Management: Whether to enable the legacy memory management mode used in Spark 1.5 and before. The legacy mode rigidly partitions the heap space into fixed-size regions, potentially leading to excessive spilling if the application was not tuned. The following deprecated memory fraction configurations are not read unless this is enabled: spark.shuffle.memoryFraction spark.storage.memoryFraction spark.storage.unrollFraction

storage (permissive dict, optional):
Default Value:
{
    "replication": {}
}
Config Schema:
memoryFraction (Float, optional):

Memory Management: (deprecated) This is read only if spark.memory.useLegacyMode is enabled. Fraction of Java heap to use for Spark’s memory cache. This should not be larger than the “old” generation of objects in the JVM, which by default is given 0.6 of the heap, but you can increase it if you configure your own old generation size.

unrollFraction (Float, optional):

Memory Management: (deprecated) This is read only if spark.memory.useLegacyMode is enabled. Fraction of spark.storage.memoryFraction to use for unrolling blocks in memory. This is dynamically allocated by dropping existing blocks when there is not enough free storage space to unroll the new block in its entirety.

replication (permissive dict, optional):
Default Value:
{}
Config Schema:
proactive (Bool, optional):

Memory Management: Enables proactive block replication for RDD blocks. Cached RDD block replicas lost due to executor failures are replenished if there are any existing available replicas. This tries to get the replication level of the block to the initial number.

memoryMapThreshold (dagster.StringSource, optional):

Execution Behavior: Size in bytes of a block above which Spark memory maps when reading a block from disk. This prevents Spark from memory mapping very small blocks. In general, memory mapping has high overhead for blocks close to or below the page size of the operating system.

cleaner (permissive dict, optional):
Default Value:
{
    "periodicGC": {},
    "referenceTracking": {
        "blocking": {}
    }
}
Config Schema:
periodicGC (permissive dict, optional):
Default Value:
{}
Config Schema:
interval (dagster.StringSource, optional):

Memory Management: Controls how often to trigger a garbage collection. This context cleaner triggers cleanups only when weak references are garbage collected. In long-running applications with large driver JVMs, where there is little memory pressure on the driver, this may happen very occasionally or not at all. Not cleaning at all may lead to executors running out of disk space after a while.

referenceTracking (permissive dict, optional):
Default Value:
{
    "blocking": {}
}
Config Schema:
root (Bool, optional):

Memory Management: Enables or disables context cleaning.

blocking (permissive dict, optional):
Default Value:
{}
Config Schema:
root (Bool, optional):

Memory Management: Controls whether the cleaning thread should block on cleanup tasks (other than shuffle, which is controlled by spark.cleaner.referenceTracking.blocking.shuffle Spark property).

shuffle (Bool, optional):

Memory Management: Controls whether the cleaning thread should block on shuffle cleanup tasks.

cleanCheckpoints (Bool, optional):

Memory Management: Controls whether to clean checkpoint files if the reference is out of scope.

default (permissive dict, optional):
Default Value:
{}
Config Schema:
parallelism (dagster.IntSource, optional):

Execution Behavior: Default number of partitions in RDDs returned by transformations like join, reduceByKey, and parallelize when not set by user.

hadoop (permissive dict, optional):
Default Value:
{
    "mapreduce": {
        "fileoutputcommitter": {
            "algorithm": {}
        }
    }
}
Config Schema:
cloneConf (Bool, optional):

Execution Behavior: If set to true, clones a new Hadoop Configuration object for each task. This option should be enabled to work around Configuration thread-safety issues (see SPARK-2546 for more details). This is disabled by default in order to avoid unexpected performance regressions for jobs that are not affected by these issues.

validateOutputSpecs (Bool, optional):

Execution Behavior: If set to true, validates the output specification (e.g. checking if the output directory already exists) used in saveAsHadoopFile and other variants. This can be disabled to silence exceptions due to pre-existing output directories. We recommend that users do not disable this except if trying to achieve compatibility with previous versions of Spark. Simply use Hadoop’s FileSystem API to delete output directories by hand. This setting is ignored for jobs generated through Spark Streaming’s StreamingContext, since data may need to be rewritten to pre-existing output directories during checkpoint recovery.

mapreduce (permissive dict, optional):
Default Value:
{
    "fileoutputcommitter": {
        "algorithm": {}
    }
}
Config Schema:
fileoutputcommitter (permissive dict, optional):
Default Value:
{
    "algorithm": {}
}
Config Schema:
algorithm (permissive dict, optional):
Default Value:
{}
Config Schema:
version (dagster.IntSource, optional):

Execution Behavior: The file output committer algorithm version, valid algorithm version number: 1 or 2. Version 2 may have better performance, but version 1 may handle failures better in certain situations, as per MAPREDUCE-4815.

rpc (permissive dict, optional):
Default Value:
{
    "message": {},
    "retry": {}
}
Config Schema:
message (permissive dict, optional):
Default Value:
{}
Config Schema:
maxSize (dagster.StringSource, optional):

Networking: Maximum message size (in MB) to allow in “control plane” communication; generally only applies to map output size information sent between executors and the driver. Increase this if you are running jobs with many thousands of map and reduce tasks and see messages about the RPC message size.

numRetries (dagster.StringSource, optional):

Networking: Number of times to retry before an RPC task gives up. An RPC task will run at most times of this number.

retry (permissive dict, optional):
Default Value:
{}
Config Schema:
wait (dagster.StringSource, optional):

Networking: Duration for an RPC ask operation to wait before retrying.

askTimeout (dagster.StringSource, optional):

Networking: Duration for an RPC ask operation to wait before timing out.

lookupTimeout (dagster.StringSource, optional):

Networking: Duration for an RPC remote endpoint lookup operation to wait before timing out.

blockManager (permissive dict, optional):
Default Value:
{}
Config Schema:
port (dagster.StringSource, optional):

Networking: Port for all block managers to listen on. These exist on both the driver and the executors.

network (permissive dict, optional):
Default Value:
{}
Config Schema:
timeout (dagster.StringSource, optional):

Networking: Default timeout for all network interactions. This config will be used in place of spark.core.connection.ack.wait.timeout, spark.storage.blockManagerSlaveTimeoutMs, spark.shuffle.io.connectionTimeout, spark.rpc.askTimeout or spark.rpc.lookupTimeout if they are not configured.

port (permissive dict, optional):
Default Value:
{}
Config Schema:
maxRetries (dagster.StringSource, optional):

Networking: Maximum number of retries when binding to a port before giving up. When a port is given a specific value (non 0), each subsequent retry will increment the port used in the previous attempt by 1 before retrying. This essentially allows it to try a range of ports from the start port specified to port + maxRetries.

core (permissive dict, optional):
Default Value:
{
    "connection": {
        "ack": {
            "wait": {}
        }
    }
}
Config Schema:
connection (permissive dict, optional):
Default Value:
{
    "ack": {
        "wait": {}
    }
}
Config Schema:
ack (permissive dict, optional):
Default Value:
{
    "wait": {}
}
Config Schema:
wait (permissive dict, optional):
Default Value:
{}
Config Schema:
timeout (dagster.StringSource, optional):

Networking: How long for the connection to wait for ack to occur before timing out and giving up. To avoid unwilling timeout caused by long pause like GC, you can set larger value.

cores (permissive dict, optional):
Default Value:
{}
Config Schema:
max (dagster.StringSource, optional):

Scheduling: When running on a standalone deploy cluster or a Mesos cluster in “coarse-grained” sharing mode, the maximum amount of CPU cores to request for the application from across the cluster (not from each machine). If not set, the default will be spark.deploy.defaultCores on Spark’s standalone cluster manager, or infinite (all available cores) on Mesos.

locality (permissive dict, optional):
Default Value:
{
    "wait": {}
}
Config Schema:
wait (permissive dict, optional):
Default Value:
{}
Config Schema:
root (dagster.StringSource, optional):

Scheduling: How long to wait to launch a data-local task before giving up and launching it on a less-local node. The same wait will be used to step through multiple locality levels (process-local, node-local, rack-local and then any). It is also possible to customize the waiting time for each level by setting spark.locality.wait.node, etc. You should increase this setting if your tasks are long and see poor locality, but the default usually works well.

node (dagster.StringSource, optional):

Scheduling: Customize the locality wait for node locality. For example, you can set this to 0 to skip node locality and search immediately for rack locality (if your cluster has rack information).

process (dagster.StringSource, optional):

Scheduling: Customize the locality wait for process locality. This affects tasks that attempt to access cached data in a particular executor process.

rack (dagster.StringSource, optional):

Scheduling: Customize the locality wait for rack locality.

scheduler (permissive dict, optional):
Default Value:
{
    "revive": {},
    "listenerbus": {
        "eventqueue": {}
    }
}
Config Schema:
maxRegisteredResourcesWaitingTime (dagster.StringSource, optional):

Scheduling: Maximum amount of time to wait for resources to register before scheduling begins.

minRegisteredResourcesRatio (dagster.StringSource, optional):

Scheduling: The minimum ratio of registered resources (registered resources / total expected resources) (resources are executors in yarn mode and Kubernetes mode, CPU cores in standalone mode and Mesos coarse-grained mode [‘spark.cores.max’ value is total expected resources for Mesos coarse-grained mode] ) to wait for before scheduling begins. Specified as a double between 0.0 and 1.0. Regardless of whether the minimum ratio of resources has been reached, the maximum amount of time it will wait before scheduling begins is controlled by config spark.scheduler.maxRegisteredResourcesWaitingTime.

mode (dagster.StringSource, optional):

Scheduling: The scheduling mode between jobs submitted to the same SparkContext. Can be set to FAIR to use fair sharing instead of queueing jobs one after another. Useful for multi-user services.

revive (permissive dict, optional):
Default Value:
{}
Config Schema:
interval (dagster.StringSource, optional):

Scheduling: The interval length for the scheduler to revive the worker resource offers to run tasks.

listenerbus (permissive dict, optional):
Default Value:
{
    "eventqueue": {}
}
Config Schema:
eventqueue (permissive dict, optional):
Default Value:
{}
Config Schema:
capacity (dagster.StringSource, optional):

Scheduling: Capacity for event queue in Spark listener bus, must be greater than 0. Consider increasing value (e.g. 20000) if listener events are dropped. Increasing this value may result in the driver using more memory.

blacklist (permissive dict, optional):
Default Value:
{
    "task": {},
    "stage": {},
    "application": {
        "fetchFailure": {}
    }
}
Config Schema:
enabled (dagster.StringSource, optional):

Scheduling: If set to “true”, prevent Spark from scheduling tasks on executors that have been blacklisted due to too many task failures. The blacklisting algorithm can be further controlled by the other “spark.blacklist” configuration options.

timeout (dagster.StringSource, optional):

Scheduling: (Experimental) How long a node or executor is blacklisted for the entire application, before it is unconditionally removed from the blacklist to attempt running new tasks.

task (permissive dict, optional):
Default Value:
{}
Config Schema:
maxTaskAttemptsPerExecutor (dagster.StringSource, optional):

Scheduling: (Experimental) For a given task, how many times it can be retried on one executor before the executor is blacklisted for that task.

maxTaskAttemptsPerNode (dagster.StringSource, optional):

Scheduling: (Experimental) For a given task, how many times it can be retried on one node, before the entire node is blacklisted for that task.

stage (permissive dict, optional):
Default Value:
{}
Config Schema:
maxFailedTasksPerExecutor (dagster.StringSource, optional):

Scheduling: (Experimental) How many different tasks must fail on one executor, within one stage, before the executor is blacklisted for that stage.

maxFailedExecutorsPerNode (dagster.StringSource, optional):

Scheduling: (Experimental) How many different executors are marked as blacklisted for a given stage, before the entire node is marked as failed for the stage.

application (permissive dict, optional):
Default Value:
{
    "fetchFailure": {}
}
Config Schema:
maxFailedTasksPerExecutor (dagster.StringSource, optional):

Scheduling: (Experimental) How many different tasks must fail on one executor, in successful task sets, before the executor is blacklisted for the entire application. Blacklisted executors will be automatically added back to the pool of available resources after the timeout specified by spark.blacklist.timeout. Note that with dynamic allocation, though, the executors may get marked as idle and be reclaimed by the cluster manager.

maxFailedExecutorsPerNode (dagster.StringSource, optional):

Scheduling: (Experimental) How many different executors must be blacklisted for the entire application, before the node is blacklisted for the entire application. Blacklisted nodes will be automatically added back to the pool of available resources after the timeout specified by spark.blacklist.timeout. Note that with dynamic allocation, though, the executors on the node may get marked as idle and be reclaimed by the cluster manager.

fetchFailure (permissive dict, optional):
Default Value:
{}
Config Schema:
enabled (dagster.StringSource, optional):

Scheduling: (Experimental) If set to “true”, Spark will blacklist the executor immediately when a fetch failure happens. If external shuffle service is enabled, then the whole node will be blacklisted.

killBlacklistedExecutors (dagster.StringSource, optional):

Scheduling: (Experimental) If set to “true”, allow Spark to automatically kill the executors when they are blacklisted on fetch failure or blacklisted for the entire application, as controlled by spark.blacklist.application.*. Note that, when an entire node is added to the blacklist, all of the executors on that node will be killed.

speculation (permissive dict, optional):
Default Value:
{}
Config Schema:
root (dagster.StringSource, optional):

Scheduling: If set to “true”, performs speculative execution of tasks. This means if one or more tasks are running slowly in a stage, they will be re-launched.

interval (dagster.StringSource, optional):

Scheduling: How often Spark will check for tasks to speculate.

multiplier (dagster.StringSource, optional):

Scheduling: How many times slower a task is than the median to be considered for speculation.

quantile (dagster.StringSource, optional):

Scheduling: Fraction of tasks which must be complete before speculation is enabled for a particular stage.

task (permissive dict, optional):
Default Value:
{
    "reaper": {}
}
Config Schema:
cpus (dagster.StringSource, optional):

Scheduling: Number of cores to allocate for each task.

maxFailures (dagster.StringSource, optional):

Scheduling: Number of failures of any particular task before giving up on the job. The total number of failures spread across different tasks will not cause the job to fail; a particular task has to fail this number of attempts. Should be greater than or equal to 1. Number of allowed retries = this value - 1.

reaper (permissive dict, optional):
Default Value:
{}
Config Schema:
enabled (dagster.StringSource, optional):

Scheduling: Enables monitoring of killed / interrupted tasks. When set to true, any task which is killed will be monitored by the executor until that task actually finishes executing. See the other spark.task.reaper.* configurations for details on how to control the exact behavior of this monitoring. When set to false (the default), task killing will use an older code path which lacks such monitoring.

pollingInterval (dagster.StringSource, optional):

Scheduling: When spark.task.reaper.enabled = true, this setting controls the frequency at which executors will poll the status of killed tasks. If a killed task is still running when polled then a warning will be logged and, by default, a thread-dump of the task will be logged (this thread dump can be disabled via the spark.task.reaper.threadDump setting, which is documented below).

threadDump (dagster.StringSource, optional):

Scheduling: When spark.task.reaper.enabled = true, this setting controls whether task thread dumps are logged during periodic polling of killed tasks. Set this to false to disable collection of thread dumps.

killTimeout (dagster.StringSource, optional):

Scheduling: When spark.task.reaper.enabled = true, this setting specifies a timeout after which the executor JVM will kill itself if a killed task has not stopped running. The default value, -1, disables this mechanism and prevents the executor from self-destructing. The purpose of this setting is to act as a safety-net to prevent runaway noncancellable tasks from rendering an executor unusable.

stage (permissive dict, optional):
Default Value:
{}
Config Schema:
maxConsecutiveAttempts (dagster.StringSource, optional):

Scheduling: Number of consecutive stage attempts allowed before a stage is aborted.

dynamicAllocation (permissive dict, optional):
Default Value:
{}
Config Schema:
enabled (dagster.StringSource, optional):

Dynamic Allocation: Whether to use dynamic resource allocation, which scales the number of executors registered with this application up and down based on the workload. For more detail, see the description here. This requires spark.shuffle.service.enabled to be set. The following configurations are also relevant: spark.dynamicAllocation.minExecutors, spark.dynamicAllocation.maxExecutors, and spark.dynamicAllocation.initialExecutors spark.dynamicAllocation.executorAllocationRatio

executorIdleTimeout (dagster.StringSource, optional):

Dynamic Allocation: If dynamic allocation is enabled and an executor has been idle for more than this duration, the executor will be removed. For more detail, see this description.

cachedExecutorIdleTimeout (dagster.StringSource, optional):

Dynamic Allocation: If dynamic allocation is enabled and an executor which has cached data blocks has been idle for more than this duration, the executor will be removed. For more details, see this description.

initialExecutors (dagster.StringSource, optional):

Dynamic Allocation: Initial number of executors to run if dynamic allocation is enabled. If –num-executors (or spark.executor.instances) is set and larger than this value, it will be used as the initial number of executors.

maxExecutors (dagster.StringSource, optional):

Dynamic Allocation: Upper bound for the number of executors if dynamic allocation is enabled.

minExecutors (dagster.StringSource, optional):

Dynamic Allocation: Lower bound for the number of executors if dynamic allocation is enabled.

executorAllocationRatio (dagster.StringSource, optional):

Dynamic Allocation: By default, the dynamic allocation will request enough executors to maximize the parallelism according to the number of tasks to process. While this minimizes the latency of the job, with small tasks this setting can waste a lot of resources due to executor allocation overhead, as some executor might not even do any work. This setting allows to set a ratio that will be used to reduce the number of executors w.r.t. full parallelism. Defaults to 1.0 to give maximum parallelism. 0.5 will divide the target number of executors by 2 The target number of executors computed by the dynamicAllocation can still be overridden by the spark.dynamicAllocation.minExecutors and spark.dynamicAllocation.maxExecutors settings

schedulerBacklogTimeout (dagster.StringSource, optional):

Dynamic Allocation: If dynamic allocation is enabled and there have been pending tasks backlogged for more than this duration, new executors will be requested. For more detail, see this description.

sustainedSchedulerBacklogTimeout (dagster.StringSource, optional):

Dynamic Allocation: Same as spark.dynamicAllocation.schedulerBacklogTimeout, but used only for subsequent executor requests. For more detail, see this description.

r (permissive dict, optional):
Default Value:
{
    "driver": {},
    "shell": {}
}
Config Schema:
numRBackendThreads (dagster.StringSource, optional):

SparkR: Number of threads used by RBackend to handle RPC calls from SparkR package.

command (dagster.StringSource, optional):

SparkR: Executable for executing R scripts in cluster modes for both driver and workers.

driver (permissive dict, optional):
Default Value:
{}
Config Schema:
command (dagster.StringSource, optional):

SparkR: Executable for executing R scripts in client modes for driver. Ignored in cluster modes.

shell (permissive dict, optional):
Default Value:
{}
Config Schema:
command (dagster.StringSource, optional):

SparkR: Executable for executing sparkR shell in client modes for driver. Ignored in cluster modes. It is the same as environment variable SPARKR_DRIVER_R, but take precedence over it. spark.r.shell.command is used for sparkR shell while spark.r.driver.command is used for running R script.

backendConnectionTimeout (dagster.StringSource, optional):

SparkR: Connection timeout set by R process on its connection to RBackend in seconds.

heartBeatInterval (dagster.StringSource, optional):

SparkR: Interval for heartbeats sent from SparkR backend to R process to prevent connection timeout.

graphx (permissive dict, optional):
Default Value:
{
    "pregel": {}
}
Config Schema:
pregel (permissive dict, optional):
Default Value:
{}
Config Schema:
checkpointInterval (dagster.StringSource, optional):

GraphX: Checkpoint interval for graph and message in Pregel. It used to avoid stackOverflowError due to long lineage chains after lots of iterations. The checkpoint is disabled by default.

deploy (permissive dict, optional):
Default Value:
{
    "zookeeper": {}
}
Config Schema:
recoveryMode (dagster.StringSource, optional):

Deploy: The recovery mode setting to recover submitted Spark jobs with cluster mode when it failed and relaunches. This is only applicable for cluster mode when running with Standalone or Mesos.

zookeeper (permissive dict, optional):
Default Value:
{}
Config Schema:
url (dagster.StringSource, optional):

Deploy: When spark.deploy.recoveryMode is set to ZOOKEEPER, this configuration is used to set the zookeeper URL to connect to.

dir (dagster.StringSource, optional):

Deploy: When spark.deploy.recoveryMode is set to ZOOKEEPER, this configuration is used to set the zookeeper directory to store recovery state.

cluster_id (dagster.StringSource):

Name of the job flow (cluster) on which to execute.

region_name (dagster.StringSource):

The AWS region that the cluster is in.

action_on_failure (String, optional):

The EMR action to take when the cluster step fails: https://docs.aws.amazon.com/emr/latest/APIReference/API_StepConfig.html

Default Value: ‘CANCEL_AND_WAIT’

staging_bucket (dagster.StringSource):

S3 bucket to use for passing files between the plan process and EMR process.

staging_prefix (dagster.StringSource, optional):

S3 key prefix inside the staging_bucket to use for files passed the plan process and EMR process

Default Value: ‘emr_staging’

wait_for_logs (Bool, optional):

If set, the system will wait for EMR logs to appear on S3. Note that logs are copied every 5 minutes, so enabling this will add several minutes to the job runtime.

Default Value: False

local_job_package_path (dagster.StringSource, optional):

Absolute path to the package that contains the job definition(s) whose steps will execute remotely on EMR. This is a path on the local fileystem of the process executing the job. The expectation is that this package will also be available on the python path of the launched process running the Spark step on EMR, either deployed on step launch via the deploy_local_job_package option, referenced on s3 via the s3_job_package_path option, or installed on the cluster via bootstrap actions.

local_pipeline_package_path (dagster.StringSource, optional):

(legacy) Absolute path to the package that contains the pipeline definition(s) whose steps will execute remotely on EMR. This is a path on the local fileystem of the process executing the pipeline. The expectation is that this package will also be available on the python path of the launched process running the Spark step on EMR, either deployed on step launch via the deploy_local_pipeline_package option, referenced on s3 via the s3_pipeline_package_path option, or installed on the cluster via bootstrap actions.

deploy_local_job_package (Bool, optional):

If set, before every step run, the launcher will zip up all the code in local_job_package_path, upload it to s3, and pass it to spark-submit’s –py-files option. This gives the remote process access to up-to-date user code. If not set, the assumption is that some other mechanism is used for distributing code to the EMR cluster. If this option is set to True, s3_job_package_path should not also be set.

Default Value: False

deploy_local_pipeline_package (Bool, optional):

(legacy) If set, before every step run, the launcher will zip up all the code in local_job_package_path, upload it to s3, and pass it to spark-submit’s –py-files option. This gives the remote process access to up-to-date user code. If not set, the assumption is that some other mechanism is used for distributing code to the EMR cluster. If this option is set to True, s3_job_package_path should not also be set.

Default Value: False

s3_job_package_path (dagster.StringSource, optional):

If set, this path will be passed to the –py-files option of spark-submit. This should usually be a path to a zip file. If this option is set, deploy_local_job_package should not be set to True.

s3_pipeline_package_path (dagster.StringSource, optional):

If set, this path will be passed to the –py-files option of spark-submit. This should usually be a path to a zip file. If this option is set, deploy_local_pipeline_package should not be set to True.

  • spark_config:

  • cluster_id: Name of the job flow (cluster) on which to execute.

  • region_name: The AWS region that the cluster is in.

  • action_on_failure: The EMR action to take when the cluster step fails: https://docs.aws.amazon.com/emr/latest/APIReference/API_StepConfig.html

  • staging_bucket: S3 bucket to use for passing files between the plan process and EMR process.

  • staging_prefix: S3 key prefix inside the staging_bucket to use for files passed the plan process and EMR process

  • wait_for_logs: If set, the system will wait for EMR logs to appear on S3. Note that logs are copied every 5 minutes, so enabling this will add several minutes to the job runtime.

  • local_job_package_path: Absolute path to the package that contains the job definition(s) whose steps will execute remotely on EMR. This is a path on the local fileystem of the process executing the job. The expectation is that this package will also be available on the python path of the launched process running the Spark step on EMR, either deployed on step launch via the deploy_local_job_package option, referenced on s3 via the s3_job_package_path option, or installed on the cluster via bootstrap actions.

  • local_pipeline_package_path: (legacy) Absolute path to the package that contains the pipeline definition(s) whose steps will execute remotely on EMR. This is a path on the local fileystem of the process executing the pipeline. The expectation is that this package will also be available on the python path of the launched process running the Spark step on EMR, either deployed on step launch via the deploy_local_pipeline_package option, referenced on s3 via the s3_pipeline_package_path option, or installed on the cluster via bootstrap actions.

  • deploy_local_job_package: If set, before every step run, the launcher will zip up all the code in local_job_package_path, upload it to s3, and pass it to spark-submit’s –py-files option. This gives the remote process access to up-to-date user code. If not set, the assumption is that some other mechanism is used for distributing code to the EMR cluster. If this option is set to True, s3_job_package_path should not also be set.

  • deploy_local_pipeline_package: (legacy) If set, before every step run, the launcher will zip up all the code in local_job_package_path, upload it to s3, and pass it to spark-submit’s –py-files option. This gives the remote process access to up-to-date user code. If not set, the assumption is that some other mechanism is used for distributing code to the EMR cluster. If this option is set to True, s3_job_package_path should not also be set.

  • s3_job_package_path: If set, this path will be passed to the –py-files option of spark-submit. This should usually be a path to a zip file. If this option is set, deploy_local_job_package should not be set to True.

  • s3_pipeline_package_path: If set, this path will be passed to the –py-files option of spark-submit. This should usually be a path to a zip file. If this option is set, deploy_local_pipeline_package should not be set to True.

class dagster_aws.emr.EmrJobRunner(region, check_cluster_every=30, aws_access_key_id=None, aws_secret_access_key=None)[source]
class dagster_aws.emr.EmrError[source]
dagster_aws.emr.EmrClusterState = <enum 'EmrClusterState'>[source]

Cluster state for EMR.

dagster_aws.emr.EmrStepState = <enum 'EmrStepState'>[source]

Step state for EMR.

CloudWatch

dagster_aws.cloudwatch.cloudwatch_logger LoggerDefinition

Config Schema:
log_level (String, optional):

Default Value: ‘INFO’

name (String, optional):

Default Value: ‘dagster’

log_group_name (String):

The name of the log group

log_stream_name (String):

The name of the log stream

aws_region (dagster.StringSource, optional):

Specifies a custom region for the S3 session. Default is chosen through the ordinary boto3 credential chain.

aws_secret_access_key (dagster.StringSource, optional):

aws_access_key_id (dagster.StringSource, optional):

Core class for defining loggers.

Loggers are job-scoped logging handlers, which will be automatically invoked whenever dagster messages are logged from within a job.

Parameters:
  • logger_fn (Callable[[InitLoggerContext], logging.Logger]) – User-provided function to instantiate the logger. This logger will be automatically invoked whenever the methods on context.log are called from within job compute logic.

  • config_schema (Optional[ConfigSchema]) – The schema for the config. Configuration data available in init_context.logger_config. If not set, Dagster will accept any config provided.

  • description (Optional[str]) – A human-readable description of this logger.

SecretsManager

Resources which surface SecretsManager secrets for use in Dagster resources and jobs.

dagster_aws.secretsmanager.SecretsManagerResource ResourceDefinition[source]

Config Schema:
region_name (Union[dagster.StringSource, None], optional):

Specifies a custom region for the Boto3 session

max_attempts (Union[dagster.IntSource, None], optional):

This provides Boto3’s retry handler with a value of maximum retry attempts, where the initial call counts toward the max_attempts value that you provide

Default Value: 5

profile_name (Union[dagster.StringSource, None], optional):

Specifies a profile to connect that session

Resource that gives access to AWS SecretsManager.

The underlying SecretsManager session is created by calling boto3.session.Session(profile_name). The returned resource object is a SecretsManager client, an instance of botocore.client.SecretsManager.

Example

from dagster import build_op_context, job, op
from dagster_aws.secretsmanager import SecretsManagerResource

@op
def example_secretsmanager_op(secretsmanager: SecretsManagerResource):
    return secretsmanager.get_client().get_secret_value(
        SecretId='arn:aws:secretsmanager:region:aws_account_id:secret:appauthexample-AbCdEf'
    )

@job
def example_job():
    example_secretsmanager_op()

defs = Definitions(
    jobs=[example_job],
    resources={
        'secretsmanager': SecretsManagerResource(
            region_name='us-west-1'
        )
    }
)
dagster_aws.secretsmanager.SecretsManagerSecretsResource ResourceDefinition[source]

Config Schema:
region_name (Union[dagster.StringSource, None], optional):

Specifies a custom region for the Boto3 session

max_attempts (Union[dagster.IntSource, None], optional):

This provides Boto3’s retry handler with a value of maximum retry attempts, where the initial call counts toward the max_attempts value that you provide

Default Value: 5

profile_name (Union[dagster.StringSource, None], optional):

Specifies a profile to connect that session

secrets (Union[List[dagster.StringSource], None], optional):

An array of AWS Secrets Manager secrets arns to fetch.

Default Value: []

secrets_tag (Union[dagster.StringSource, None], optional):

AWS Secrets Manager secrets with this tag will be fetched and made available.

Resource that provides a dict which maps selected SecretsManager secrets to their string values. Also optionally sets chosen secrets as environment variables.

Example

import os
from dagster import build_op_context, job, op, ResourceParam
from dagster_aws.secretsmanager import SecretsManagerSecretsResource

@op
def example_secretsmanager_secrets_op(secrets: SecretsManagerSecretsResource):
    return secrets.fetch_secrets().get("my-secret-name")

@op
def example_secretsmanager_secrets_op_2(secrets: SecretsManagerSecretsResource):
    with secrets.secrets_in_environment():
        return os.getenv("my-other-secret-name")

@job
def example_job():
    example_secretsmanager_secrets_op()
    example_secretsmanager_secrets_op_2()

defs = Definitions(
    jobs=[example_job],
    resources={
        'secrets': SecretsManagerSecretsResource(
            region_name='us-west-1',
            secrets_tag="dagster",
            add_to_environment=True,
        )
    }
)

Note that your ops must also declare that they require this resource with or it will not be initialized for the execution of their compute functions.

Pipes

dagster_aws.pipes.PipesLambdaClient

alias of _PipesLambdaClient[_PipesLambdaClient]

Legacy

dagster_aws.s3.ConfigurablePickledObjectS3IOManager IOManagerDefinition[source]

Config Schema:
s3_bucket (dagster.StringSource):

S3 bucket to use for the file manager.

s3_prefix (Union[dagster.StringSource, None], optional):

Prefix to use for the S3 bucket for this file manager.

Default Value: ‘dagster’

deprecated This API will be removed in version 2.0.

Please use S3PickleIOManager instead..

Renamed to S3PickleIOManager. See S3PickleIOManager for documentation.

dagster_aws.s3.s3_resource ResourceDefinition[source]

Config Schema:
use_unsigned_session (Union[dagster.BoolSource, None], optional):

Specifies whether to use an unsigned S3 session.

Default Value: False

region_name (Union[dagster.StringSource, None], optional):

Specifies a custom region for the S3 session.

endpoint_url (Union[dagster.StringSource, None], optional):

Specifies a custom endpoint for the S3 session.

max_attempts (Union[dagster.IntSource, None], optional):

This provides Boto3’s retry handler with a value of maximum retry attempts, where the initial call counts toward the max_attempts value that you provide.

Default Value: 5

profile_name (Union[dagster.StringSource, None], optional):

Specifies a profile to connect that session.

use_ssl (Union[dagster.BoolSource, None], optional):

Whether or not to use SSL. By default, SSL is used.

Default Value: True

verify (Union[dagster.StringSource, None], optional):

Whether or not to verify SSL certificates. By default SSL certificates are verified. You can also specify this argument if you want to use a different CA cert bundle than the one used by botocore.

aws_access_key_id (Union[dagster.StringSource, None], optional):

AWS access key ID to use when creating the boto3 session.

aws_secret_access_key (Union[dagster.StringSource, None], optional):

AWS secret access key to use when creating the boto3 session.

aws_session_token (Union[dagster.StringSource, None], optional):

AWS session token to use when creating the boto3 session.

Resource that gives access to S3.

The underlying S3 session is created by calling boto3.session.Session(profile_name). The returned resource object is an S3 client, an instance of botocore.client.S3.

Example

from dagster import build_op_context, job, op
from dagster_aws.s3 import s3_resource

@op(required_resource_keys={'s3'})
def example_s3_op(context):
    return context.resources.s3.list_objects_v2(
        Bucket='my-bucket',
        Prefix='some-key'
    )

@job(resource_defs={'s3': s3_resource})
def example_job():
    example_s3_op()

example_job.execute_in_process(
    run_config={
        'resources': {
            's3': {
                'config': {
                    'region_name': 'us-west-1',
                }
            }
        }
    }
)

Note that your ops must also declare that they require this resource with required_resource_keys, or it will not be initialized for the execution of their compute functions.

You may configure this resource as follows:

resources:
  s3:
    config:
      region_name: "us-west-1"
      # Optional[str]: Specifies a custom region for the S3 session. Default is chosen
      # through the ordinary boto credential chain.
      use_unsigned_session: false
      # Optional[bool]: Specifies whether to use an unsigned S3 session. Default: True
      endpoint_url: "http://localhost"
      # Optional[str]: Specifies a custom endpoint for the S3 session. Default is None.
      profile_name: "dev"
      # Optional[str]: Specifies a custom profile for S3 session. Default is default
      # profile as specified in ~/.aws/credentials file
      use_ssl: true
      # Optional[bool]: Whether or not to use SSL. By default, SSL is used.
      verify: None
      # Optional[str]: Whether or not to verify SSL certificates. By default SSL certificates are verified.
      # You can also specify this argument if you want to use a different CA cert bundle than the one used by botocore."
      aws_access_key_id: None
      # Optional[str]: The access key to use when creating the client.
      aws_secret_access_key: None
      # Optional[str]: The secret key to use when creating the client.
      aws_session_token: None
      # Optional[str]:  The session token to use when creating the client.
dagster_aws.s3.s3_pickle_io_manager IOManagerDefinition[source]

Config Schema:
s3_bucket (dagster.StringSource):

S3 bucket to use for the file manager.

s3_prefix (Union[dagster.StringSource, None], optional):

Prefix to use for the S3 bucket for this file manager.

Default Value: ‘dagster’

Persistent IO manager using S3 for storage.

Serializes objects via pickling. Suitable for objects storage for distributed executors, so long as each execution node has network connectivity and credentials for S3 and the backing bucket.

Assigns each op output to a unique filepath containing run ID, step key, and output name. Assigns each asset to a single filesystem path, at “<base_dir>/<asset_key>”. If the asset key has multiple components, the final component is used as the name of the file, and the preceding components as parent directories under the base_dir.

Subsequent materializations of an asset will overwrite previous materializations of that asset. With a base directory of “/my/base/path”, an asset with key AssetKey([“one”, “two”, “three”]) would be stored in a file called “three” in a directory with path “/my/base/path/one/two/”.

Example usage:

  1. Attach this IO manager to a set of assets.

from dagster import Definitions, asset
from dagster_aws.s3 import s3_pickle_io_manager, s3_resource


@asset
def asset1():
    # create df ...
    return df

@asset
def asset2(asset1):
    return asset1[:5]

defs = Definitions(
    assets=[asset1, asset2],
    resources={
        "io_manager": s3_pickle_io_manager.configured(
            {"s3_bucket": "my-cool-bucket", "s3_prefix": "my-cool-prefix"}
        ),
        "s3": s3_resource,
    },
)
  1. Attach this IO manager to your job to make it available to your ops.

from dagster import job
from dagster_aws.s3 import s3_pickle_io_manager, s3_resource

@job(
    resource_defs={
        "io_manager": s3_pickle_io_manager.configured(
            {"s3_bucket": "my-cool-bucket", "s3_prefix": "my-cool-prefix"}
        ),
        "s3": s3_resource,
    },
)
def my_job():
    ...
dagster_aws.s3.s3_file_manager ResourceDefinition[source]

Config Schema:
use_unsigned_session (Union[dagster.BoolSource, None], optional):

Specifies whether to use an unsigned S3 session.

Default Value: False

region_name (Union[dagster.StringSource, None], optional):

Specifies a custom region for the S3 session.

endpoint_url (Union[dagster.StringSource, None], optional):

Specifies a custom endpoint for the S3 session.

max_attempts (Union[dagster.IntSource, None], optional):

This provides Boto3’s retry handler with a value of maximum retry attempts, where the initial call counts toward the max_attempts value that you provide.

Default Value: 5

profile_name (Union[dagster.StringSource, None], optional):

Specifies a profile to connect that session.

use_ssl (Union[dagster.BoolSource, None], optional):

Whether or not to use SSL. By default, SSL is used.

Default Value: True

verify (Union[dagster.StringSource, None], optional):

Whether or not to verify SSL certificates. By default SSL certificates are verified. You can also specify this argument if you want to use a different CA cert bundle than the one used by botocore.

aws_access_key_id (Union[dagster.StringSource, None], optional):

AWS access key ID to use when creating the boto3 session.

aws_secret_access_key (Union[dagster.StringSource, None], optional):

AWS secret access key to use when creating the boto3 session.

aws_session_token (Union[dagster.StringSource, None], optional):

AWS session token to use when creating the boto3 session.

s3_bucket (dagster.StringSource):

S3 bucket to use for the file manager.

s3_prefix (Union[dagster.StringSource, None], optional):

Prefix to use for the S3 bucket for this file manager.

Default Value: ‘dagster’

FileManager that provides abstract access to S3.

Implements the FileManager API.

dagster_aws.redshift.redshift_resource ResourceDefinition[source]

Config Schema:
host (dagster.StringSource):

Redshift host

port (Union[dagster.IntSource, None], optional):

Redshift port

Default Value: 5439

user (Union[dagster.StringSource, None], optional):

Username for Redshift connection

password (Union[dagster.StringSource, None], optional):

Password for Redshift connection

database (Union[dagster.StringSource, None], optional):

Name of the default database to use. After login, you can use USE DATABASE to change the database.

autocommit (Union[dagster.BoolSource, None], optional):

Whether to autocommit queries

connect_timeout (Union[dagster.IntSource, None], optional):

Timeout for connection to Redshift cluster. Defaults to 5 seconds.

Default Value: 5

sslmode (Union[dagster.StringSource, None], optional):

SSL mode to use. See the Redshift documentation for reference: https://docs.aws.amazon.com/redshift/latest/mgmt/connecting-ssl-support.html

Default Value: ‘require’

This resource enables connecting to a Redshift cluster and issuing queries against that cluster.

Example

from dagster import build_op_context, op
from dagster_aws.redshift import redshift_resource

@op(required_resource_keys={'redshift'})
def example_redshift_op(context):
    return context.resources.redshift.execute_query('SELECT 1', fetch_results=True)

redshift_configured = redshift_resource.configured({
    'host': 'my-redshift-cluster.us-east-1.redshift.amazonaws.com',
    'port': 5439,
    'user': 'dagster',
    'password': 'dagster',
    'database': 'dev',
})
context = build_op_context(resources={'redshift': redshift_configured})
assert example_redshift_op(context) == [(1,)]
dagster_aws.redshift.fake_redshift_resource ResourceDefinition[source]

Config Schema:
host (dagster.StringSource):

Redshift host

port (Union[dagster.IntSource, None], optional):

Redshift port

Default Value: 5439

user (Union[dagster.StringSource, None], optional):

Username for Redshift connection

password (Union[dagster.StringSource, None], optional):

Password for Redshift connection

database (Union[dagster.StringSource, None], optional):

Name of the default database to use. After login, you can use USE DATABASE to change the database.

autocommit (Union[dagster.BoolSource, None], optional):

Whether to autocommit queries

connect_timeout (Union[dagster.IntSource, None], optional):

Timeout for connection to Redshift cluster. Defaults to 5 seconds.

Default Value: 5

sslmode (Union[dagster.StringSource, None], optional):

SSL mode to use. See the Redshift documentation for reference: https://docs.aws.amazon.com/redshift/latest/mgmt/connecting-ssl-support.html

Default Value: ‘require’

dagster_aws.secretsmanager.secretsmanager_resource ResourceDefinition[source]

Config Schema:
region_name (Union[dagster.StringSource, None], optional):

Specifies a custom region for the Boto3 session

max_attempts (Union[dagster.IntSource, None], optional):

This provides Boto3’s retry handler with a value of maximum retry attempts, where the initial call counts toward the max_attempts value that you provide

Default Value: 5

profile_name (Union[dagster.StringSource, None], optional):

Specifies a profile to connect that session

Resource that gives access to AWS SecretsManager.

The underlying SecretsManager session is created by calling boto3.session.Session(profile_name). The returned resource object is a SecretsManager client, an instance of botocore.client.SecretsManager.

Example

from dagster import build_op_context, job, op
from dagster_aws.secretsmanager import secretsmanager_resource

@op(required_resource_keys={'secretsmanager'})
def example_secretsmanager_op(context):
    return context.resources.secretsmanager.get_secret_value(
        SecretId='arn:aws:secretsmanager:region:aws_account_id:secret:appauthexample-AbCdEf'
    )

@job(resource_defs={'secretsmanager': secretsmanager_resource})
def example_job():
    example_secretsmanager_op()

example_job.execute_in_process(
    run_config={
        'resources': {
            'secretsmanager': {
                'config': {
                    'region_name': 'us-west-1',
                }
            }
        }
    }
)

You may configure this resource as follows:

resources:
  secretsmanager:
    config:
      region_name: "us-west-1"
      # Optional[str]: Specifies a custom region for the SecretsManager session. Default is chosen
      # through the ordinary boto credential chain.
      profile_name: "dev"
      # Optional[str]: Specifies a custom profile for SecretsManager session. Default is default
      # profile as specified in ~/.aws/credentials file
dagster_aws.secretsmanager.secretsmanager_secrets_resource ResourceDefinition[source]

Config Schema:
region_name (Union[dagster.StringSource, None], optional):

Specifies a custom region for the Boto3 session

max_attempts (Union[dagster.IntSource, None], optional):

This provides Boto3’s retry handler with a value of maximum retry attempts, where the initial call counts toward the max_attempts value that you provide

Default Value: 5

profile_name (Union[dagster.StringSource, None], optional):

Specifies a profile to connect that session

secrets (Union[List[dagster.StringSource], None], optional):

An array of AWS Secrets Manager secrets arns to fetch.

Default Value: []

secrets_tag (Union[dagster.StringSource, None], optional):

AWS Secrets Manager secrets with this tag will be fetched and made available.

add_to_environment (Bool, optional):

Whether to add the secrets to the environment. Defaults to False.

Default Value: False

Resource that provides a dict which maps selected SecretsManager secrets to their string values. Also optionally sets chosen secrets as environment variables.

Example

import os
from dagster import build_op_context, job, op
from dagster_aws.secretsmanager import secretsmanager_secrets_resource

@op(required_resource_keys={'secrets'})
def example_secretsmanager_secrets_op(context):
    return context.resources.secrets.get("my-secret-name")

@op(required_resource_keys={'secrets'})
def example_secretsmanager_secrets_op_2(context):
    return os.getenv("my-other-secret-name")

@job(resource_defs={'secrets': secretsmanager_secrets_resource})
def example_job():
    example_secretsmanager_secrets_op()
    example_secretsmanager_secrets_op_2()

example_job.execute_in_process(
    run_config={
        'resources': {
            'secrets': {
                'config': {
                    'region_name': 'us-west-1',
                    'secrets_tag': 'dagster',
                    'add_to_environment': True,
                }
            }
        }
    }
)

Note that your ops must also declare that they require this resource with required_resource_keys, or it will not be initialized for the execution of their compute functions.

You may configure this resource as follows:

resources:
  secretsmanager:
    config:
      region_name: "us-west-1"
      # Optional[str]: Specifies a custom region for the SecretsManager session. Default is chosen
      # through the ordinary boto credential chain.
      profile_name: "dev"
      # Optional[str]: Specifies a custom profile for SecretsManager session. Default is default
      # profile as specified in ~/.aws/credentials file
      secrets: ["arn:aws:secretsmanager:region:aws_account_id:secret:appauthexample-AbCdEf"]
      # Optional[List[str]]: Specifies a list of secret ARNs to pull from SecretsManager.
      secrets_tag: "dagster"
      # Optional[str]: Specifies a tag, all secrets which have the tag set will be pulled
      # from SecretsManager.
      add_to_environment: true
      # Optional[bool]: Whether to set the selected secrets as environment variables. Defaults
      # to false.