Utilities for interfacing with AWS with Dagster.
Specifies whether to use an unsigned S3 session.
Default Value: False
Specifies a custom region for the S3 session.
Default Value: None
Specifies a custom endpoint for the S3 session.
Default Value: None
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
Specifies a profile to connect that session.
Default Value: None
Whether or not to use SSL. By default, SSL is used.
Default Value: True
Whether or not to verify SSL certificates. By default SSL certificates are verified.
Default Value: None
AWS access key ID to use when creating the boto3 session.
Default Value: None
AWS secret access key to use when creating the boto3 session.
Default Value: None
AWS session token to use when creating the boto3 session.
Default Value: None
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')}
)
S3 bucket to use for the file manager.
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",
)
}
)
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"
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.
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
Specifies whether to use an unsigned S3 session.
Default Value: False
Specifies a custom region for the S3 session.
Default Value: None
Specifies a custom endpoint for the S3 session.
Default Value: None
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
Specifies a profile to connect that session.
Default Value: None
Whether or not to use SSL. By default, SSL is used.
Default Value: True
Whether or not to verify SSL certificates. By default SSL certificates are verified.
Default Value: None
AWS access key ID to use when creating the boto3 session.
Default Value: None
AWS secret access key to use when creating the boto3 session.
Default Value: None
AWS session token to use when creating the boto3 session.
Default Value: None
S3 bucket to use for the file manager.
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")},
)
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.
The container name to use when launching new tasks. Defaults to ‘run’.
Default Value: ‘run’
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.
AWS Secrets Manager secrets with this tag will be mounted as environment variables in the container. Defaults to ‘dagster’.
Default Value: ‘dagster’
Whether each run should use the same sidecars as the task that launches it. Defaults to False.
Default Value: False
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
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.
Name of the ECS cluster to launch ECS tasks in.
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)
{}
The CPU override to use for the launched task.
The memory override to use for the launched task.
The ephemeral storage, in GiB, to use for the launched task.
Additional tags to apply to the launched ECS task.
RunLauncher that starts a task in ECS for each Dagster job run.
Redshift host
Redshift port
Default Value: 5439
Username for Redshift connection
Default Value: None
Password for Redshift connection
Default Value: None
Name of the default database to use. After login, you can use USE DATABASE to change the database.
Default Value: None
Whether to autocommit queries
Default Value: None
Timeout for connection to Redshift cluster. Defaults to 5 seconds.
Default Value: 5
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},
)
Redshift host
Redshift port
Default Value: 5439
Username for Redshift connection
Default Value: None
Password for Redshift connection
Default Value: None
Name of the default database to use. After login, you can use USE DATABASE to change the database.
Default Value: None
Whether to autocommit queries
Default Value: None
Timeout for connection to Redshift cluster. Defaults to 5 seconds.
Default Value: 5
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},
)
{
"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": {}
}
}
}
{
"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": {}
}
}
{}
Application Properties: The name of your application. This will appear in the UI and in log data.
{
"blockManager": {}
}
Application Properties: Number of cores to use for the driver process, only in cluster mode.
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.
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.
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.
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.
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.
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.
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.
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.
{}
Networking: Driver-specific port for the block manager to listen on, for cases where it cannot use the same configuration as executors.
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.
Networking: Hostname or IP address for the driver. This is used for communicating with the executors and the standalone Master.
Networking: Port for the driver to listen on. This is used for communicating with the executors and the standalone Master.
{
"pyspark": {},
"logs": {
"rolling": {
"time": {}
}
}
}
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).
{}
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.
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.
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.
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
Runtime Environment: Set a special library path to use when launching executor JVM’s.
{
"rolling": {
"time": {}
}
}
{
"time": {}
}
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.
Runtime Environment: Enable executor log compression. If it is enabled, the rolled executor logs will be compressed. Disabled by default.
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.
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.
{}
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.
Runtime Environment: (Experimental) Same functionality as spark.driver.userClassPathFirst, but applied to executor instances.
Execution Behavior: The number of cores to use on each executor. In standalone and Mesos coarse-grained modes, for more detail, see this description.
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
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.
{}
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.
Application Properties: Logs the effective SparkConf as INFO when a SparkContext is started.
Application Properties: The cluster manager to connect to. See the list of allowed master URL’s.
{}
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.
Runtime Environment: Comma-separated list of .zip, .egg, or .py files to place on the PYTHONPATH for Python apps. Globs are allowed.
{}
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.
{}
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.
{
"profile": {},
"worker": {}
}
{}
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.
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.
{}
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.
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.
{}
Runtime Environment: Comma-separated list of files to be placed in the working directory of each executor. Globs are allowed.
Execution Behavior: Communication timeout to use when fetching files added through SparkContext.addFile() from the driver.
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).
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.
Execution Behavior: The maximum number of bytes to pack into a single partition when reading files.
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.
{}
Runtime Environment: Comma-separated list of jars to include on the driver and executor classpaths. Globs are allowed.
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.
Runtime Environment: Comma-separated list of groupId:artifactId, to exclude while resolving the dependencies provided in spark.jars.packages to avoid dependency conflicts.
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.
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
Runtime Environment: Comma-separated list of additional remote repositories to search for the maven coordinates given with –packages or spark.jars.packages.
{
"driver": {}
}
{}
Runtime Environment: Python binary executable to use for PySpark in driver. (default is spark.pyspark.python)
Runtime Environment: Python binary executable to use for PySpark in both driver and executors.
{}
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.
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.
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.
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.
{
"file": {},
"io": {},
"service": {
"index": {
"cache": {}
}
},
"sort": {},
"spill": {},
"registration": {}
}
Shuffle Behavior: Whether to compress map output files. Generally a good idea. Compression will use spark.io.compression.codec.
{}
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.
{}
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.
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.
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.
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.
{
"index": {
"cache": {}
}
}
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.
Shuffle Behavior: Port on which the external shuffle service will run.
{
"cache": {}
}
{}
Shuffle Behavior: Cache entries limited to the specified memory footprint in bytes.
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.
{}
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.
{}
Shuffle Behavior: Whether to compress data spilled during shuffles. Compression will use spark.io.compression.codec.
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.
{}
Shuffle Behavior: Timeout in milliseconds for registration to the external shuffle service.
Shuffle Behavior: When we fail to register to the external shuffle service, we will retry for maxAttempts times.
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.
{
"logBlockUpdates": {},
"longForm": {},
"buffer": {}
}
{}
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.
{}
Spark UI: If true, use the long form of call sites in the event log. Otherwise use the short form.
Spark UI: Whether to compress logged events, if spark.eventLog.enabled is true. Compression will use spark.io.compression.codec.
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.
Spark UI: Whether to log Spark events, useful for reconstructing the Web UI after the application has finished.
Spark UI: Whether to overwrite any existing files.
{}
Spark UI: Buffer size to use when writing to output streams, in KiB unless otherwise specified.
{
"dagGraph": {},
"liveUpdate": {}
}
{}
Spark UI: How many DAG graph nodes the Spark UI and status APIs remember before garbage collecting.
Spark UI: Whether to run the web UI for the Spark application.
Spark UI: Allows jobs and stages to be killed from the web UI.
{}
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.
Spark UI: Port for your application’s dashboard, which shows memory and workload data.
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.
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.
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.
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.
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.
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.
Spark UI: How many dead executors the Spark UI and status APIs remember before garbage collecting.
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
{
"ui": {}
}
{}
Spark UI: How many finished executors the Spark UI and status APIs remember before garbage collecting.
Spark UI: How many finished drivers the Spark UI and status APIs remember before garbage collecting.
{
"ui": {}
}
{}
Spark UI: How many finished executions the Spark UI and status APIs remember before garbage collecting.
{
"ui": {},
"backpressure": {},
"receiver": {
"writeAheadLog": {}
},
"kafka": {},
"driver": {
"writeAheadLog": {}
}
}
{}
Spark Streaming: How many batches the Spark Streaming UI and status APIs remember before garbage collecting.
{}
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).
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.
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.
{
"writeAheadLog": {}
}
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.
{}
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.
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.
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.
Spark Streaming: If true, Spark shuts down the StreamingContext gracefully on JVM shutdown rather than immediately.
{}
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.
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.
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.
{
"writeAheadLog": {}
}
{}
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.
{}
Compression and Serialization: Whether to compress broadcast variables before sending them. Generally a good idea. Compression will use spark.io.compression.codec.
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.
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.
{
"compression": {
"lz4": {},
"snappy": {},
"zstd": {}
}
}
{
"lz4": {},
"snappy": {},
"zstd": {}
}
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.
{}
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.
{}
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.
{}
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.
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.
{}
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.
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.
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.
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.
Compression and Serialization: Whether to use unsafe based Kryo serializer. Can be substantially faster by using Unsafe Based IO.
{
"buffer": {}
}
{}
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.
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.
{}
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.
{}
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.
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.
{
"offHeap": {}
}
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.
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.
{}
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.
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.
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
{
"replication": {}
}
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.
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.
{}
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.
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.
{
"periodicGC": {},
"referenceTracking": {
"blocking": {}
}
}
{}
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.
{
"blocking": {}
}
Memory Management: Enables or disables context cleaning.
{}
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).
Memory Management: Controls whether the cleaning thread should block on shuffle cleanup tasks.
Memory Management: Controls whether to clean checkpoint files if the reference is out of scope.
{}
Execution Behavior: Default number of partitions in RDDs returned by transformations like join, reduceByKey, and parallelize when not set by user.
{
"mapreduce": {
"fileoutputcommitter": {
"algorithm": {}
}
}
}
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.
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.
{
"fileoutputcommitter": {
"algorithm": {}
}
}
{
"algorithm": {}
}
{}
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.
{
"message": {},
"retry": {}
}
{}
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.
Networking: Number of times to retry before an RPC task gives up. An RPC task will run at most times of this number.
{}
Networking: Duration for an RPC ask operation to wait before retrying.
Networking: Duration for an RPC ask operation to wait before timing out.
Networking: Duration for an RPC remote endpoint lookup operation to wait before timing out.
{}
Networking: Port for all block managers to listen on. These exist on both the driver and the executors.
{}
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.
{}
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.
{
"connection": {
"ack": {
"wait": {}
}
}
}
{
"ack": {
"wait": {}
}
}
{
"wait": {}
}
{}
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.
{}
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.
{
"wait": {}
}
{}
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.
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).
Scheduling: Customize the locality wait for process locality. This affects tasks that attempt to access cached data in a particular executor process.
Scheduling: Customize the locality wait for rack locality.
{
"revive": {},
"listenerbus": {
"eventqueue": {}
}
}
Scheduling: Maximum amount of time to wait for resources to register before scheduling begins.
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.
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.
{}
Scheduling: The interval length for the scheduler to revive the worker resource offers to run tasks.
{
"eventqueue": {}
}
{}
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.
{
"task": {},
"stage": {},
"application": {
"fetchFailure": {}
}
}
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.
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.
{}
Scheduling: (Experimental) For a given task, how many times it can be retried on one executor before the executor is blacklisted for that task.
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.
{}
Scheduling: (Experimental) How many different tasks must fail on one executor, within one stage, before the executor is blacklisted for that stage.
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.
{
"fetchFailure": {}
}
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.
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.
{}
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.
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.
{}
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.
Scheduling: How often Spark will check for tasks to speculate.
Scheduling: How many times slower a task is than the median to be considered for speculation.
Scheduling: Fraction of tasks which must be complete before speculation is enabled for a particular stage.
{
"reaper": {}
}
Scheduling: Number of cores to allocate for each task.
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.
{}
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.
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).
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.
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.
{}
Scheduling: Number of consecutive stage attempts allowed before a stage is aborted.
{}
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
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.
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.
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.
Dynamic Allocation: Upper bound for the number of executors if dynamic allocation is enabled.
Dynamic Allocation: Lower bound for the number of executors if dynamic allocation is enabled.
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
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.
Dynamic Allocation: Same as spark.dynamicAllocation.schedulerBacklogTimeout, but used only for subsequent executor requests. For more detail, see this description.
{
"driver": {},
"shell": {}
}
SparkR: Number of threads used by RBackend to handle RPC calls from SparkR package.
SparkR: Executable for executing R scripts in cluster modes for both driver and workers.
{}
SparkR: Executable for executing R scripts in client modes for driver. Ignored in cluster modes.
{}
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.
SparkR: Connection timeout set by R process on its connection to RBackend in seconds.
SparkR: Interval for heartbeats sent from SparkR backend to R process to prevent connection timeout.
{
"pregel": {}
}
{}
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.
{
"zookeeper": {}
}
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.
{}
Deploy: When spark.deploy.recoveryMode is set to ZOOKEEPER, this configuration is used to set the zookeeper URL to connect to.
Deploy: When spark.deploy.recoveryMode is set to ZOOKEEPER, this configuration is used to set the zookeeper directory to store recovery state.
Name of the job flow (cluster) on which to execute.
The AWS region that the cluster is in.
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’
S3 bucket to use for passing files between the plan process and EMR process.
S3 key prefix inside the staging_bucket to use for files passed the plan process and EMR process
Default Value: ‘emr_staging’
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
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.
(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.
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
(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
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.
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.
( superseded ) > This API has been superseded and it's usage is discouraged.
Consider using Dagster Pipes instead. Learn more here: https://docs.dagster.io/concepts/dagster-pipes.>
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.
Default Value: ‘INFO’
Default Value: ‘dagster’
The name of the log group
The name of the log stream
Specifies a custom region for the S3 session. Default is chosen through the ordinary boto3 credential chain.
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.
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.
Resources which surface SecretsManager secrets for use in Dagster resources and jobs.
Specifies a custom region for the Boto3 session
Default Value: None
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
Specifies a profile to connect that session
Default Value: None
Whether or not to use SSL. By default, SSL is used.
Default Value: True
Specifies a custom endpoint for the Boto3 session.
Default Value: None
Whether or not to verify SSL certificates. By default SSL certificates are verified.
Default Value: True
AWS access key ID to use when creating the boto3 session.
Default Value: None
AWS secret access key to use when creating the boto3 session.
Default Value: None
AWS session token to use when creating the boto3 session.
Default Value: None
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'
)
}
)
Specifies a custom region for the Boto3 session
Default Value: None
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
Specifies a profile to connect that session
Default Value: None
Whether or not to use SSL. By default, SSL is used.
Default Value: True
Specifies a custom endpoint for the Boto3 session.
Default Value: None
Whether or not to verify SSL certificates. By default SSL certificates are verified.
Default Value: True
AWS access key ID to use when creating the boto3 session.
Default Value: None
AWS secret access key to use when creating the boto3 session.
Default Value: None
AWS session token to use when creating the boto3 session.
Default Value: None
An array of AWS Secrets Manager secrets arns to fetch.
Default Value: []
AWS Secrets Manager secrets with this tag will be fetched and made available.
Default Value: None
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.
A context injector that injects context by writing to a temporary S3 location.
bucket (str) – The S3 bucket to write to.
client (boto3.client) – A boto3 client to use to write to S3.
key_prefix (Optional[str]) – An optional prefix to use for the S3 key. Defaults to a random string.
Message reader that reads messages by periodically reading message chunks from a specified S3 bucket.
If log_readers is passed, this reader will also start the passed readers when the first message is received from the external process.
interval (float) – interval in seconds between attempts to download a chunk
bucket (str) – The S3 bucket to read from.
client (WorkspaceClient) – A boto3 client.
log_readers (Optional[Sequence[PipesLogReader]]) – A set of log readers for logs on S3.
A pipes client for invoking AWS lambda.
By default context is injected via the lambda input event and messages are parsed out of the 4k tail of logs.
client (boto3.client) – The boto lambda client used to call invoke.
context_injector (Optional[PipesContextInjector]) – A context injector to use to inject
context into the lambda function. Defaults to PipesLambdaEventContextInjector
.
message_reader (Optional[PipesMessageReader]) – A message reader to use to read messages
from the lambda function. Defaults to PipesLambdaLogsMessageReader
.
Synchronously invoke a lambda function, enriched with the pipes protocol.
function_name (str) – The name of the function to use.
event (Mapping[str, Any]) – A JSON serializable object to pass as input to the lambda.
context (Union[OpExecutionContext, AssetExecutionContext]) – The context of the currently executing Dagster op or asset.
Wrapper containing results reported by the external process.
PipesClientCompletedInvocation
( experimental ) > This API may break in future versions, even between dot releases.
A pipes client for invoking AWS Glue jobs.
context_injector (Optional[PipesContextInjector]) – A context injector to use to inject
context into the Glue job, for example, PipesS3ContextInjector
.
message_reader (Optional[PipesMessageReader]) – A message reader to use to read messages
from the glue job run. Defaults to PipesCloudWatchsMessageReader
.
When provided with PipesCloudWatchMessageReader
,
it will be used to recieve logs and events from the .../output/<job-run-id>
CloudWatch log stream created by AWS Glue. Note that AWS Glue routes both
stderr
and stdout
from the main job process into this LogStream.
client (Optional[boto3.client]) – The boto Glue client used to launch the Glue job
forward_termination (bool) – Whether to cancel the Glue job run when the Dagster process receives a termination signal.
Start a Glue job, enriched with the pipes protocol.
See also: AWS API Documentation
context (Union[OpExecutionContext, AssetExecutionContext]) – The context of the currently executing Dagster op or asset.
start_job_run_params (Dict) – Parameters for the start_job_run
boto3 Glue client call.
extras (Optional[Dict[str, Any]]) – Additional Dagster metadata to pass to the Glue job.
Wrapper containing results reported by the external process.
PipesClientCompletedInvocation
( experimental ) > This API may break in future versions, even between dot releases.
A pipes client for running AWS ECS tasks.
client (Any) – The boto ECS client used to launch the ECS task
context_injector (Optional[PipesContextInjector]) – A context injector to use to inject
context into the ECS task. Defaults to PipesEnvContextInjector
.
message_reader (Optional[PipesMessageReader]) – A message reader to use to read messages
from the ECS task. Defaults to PipesCloudWatchMessageReader
.
forward_termination (bool) – Whether to cancel the ECS task when the Dagster process receives a termination signal.
Run ECS tasks, enriched with the pipes protocol.
context (Union[OpExecutionContext, AssetExecutionContext]) – The context of the currently executing Dagster op or asset.
run_task_params (dict) – Parameters for the run_task
boto3 ECS client call.
Must contain taskDefinition
key.
See Boto3 API Documentation
extras (Optional[Dict[str, Any]]) – Additional information to pass to the Pipes session in the external process.
pipes_container_name (Optional[str]) – If running more than one container in the task,
and using PipesCloudWatchMessageReader
, specify the container name which will be running Pipes.
Wrapper containing results reported by the external process.
PipesClientCompletedInvocation
( experimental ) > This API may break in future versions, even between dot releases.
A pipes client for running jobs on AWS EMR.
message_reader (Optional[PipesMessageReader]) – A message reader to use to read messages
from the EMR jobs. Recommended to use PipesS3MessageReader
with expect_s3_message_writer set to True.
client (Optional[boto3.client]) – The boto3 EMR client used to interact with AWS EMR.
context_injector (Optional[PipesContextInjector]) – A context injector to use to inject
context into AWS EMR job. Defaults to PipesEnvContextInjector
.
forward_termination (bool) – Whether to cancel the EMR job if the Dagster process receives a termination signal.
wait_for_s3_logs_seconds (int) – The number of seconds to wait for S3 logs to be written after execution completes.
Run a job on AWS EMR, enriched with the pipes protocol.
Starts a new EMR cluster for each invocation.
context (Union[OpExecutionContext, AssetExecutionContext]) – The context of the currently executing Dagster op or asset.
run_job_flow_params (Optional[dict]) – Parameters for the run_job_flow
boto3 EMR client call.
See Boto3 EMR API Documentation
extras (Optional[Dict[str, Any]]) – Additional information to pass to the Pipes session in the external process.
Wrapper containing results reported by the external process.
PipesClientCompletedInvocation
( experimental ) > This API may break in future versions, even between dot releases.
A pipes client for running workloads on AWS EMR Serverless.
client (Optional[boto3.client]) – The boto3 AWS EMR Serverless client used to interact with AWS EMR Serverless.
context_injector (Optional[PipesContextInjector]) – A context injector to use to inject
context into AWS EMR Serverless workload. Defaults to PipesEnvContextInjector
.
message_reader (Optional[PipesMessageReader]) – A message reader to use to read messages
from the AWS EMR Serverless workload. Defaults to PipesCloudWatchMessageReader
.
forward_termination (bool) – Whether to cancel the AWS EMR Serverless workload if the Dagster process receives a termination signal.
poll_interval (float) – The interval in seconds to poll the AWS EMR Serverless workload for status updates. Defaults to 5 seconds.
Run a workload on AWS EMR Serverless, enriched with the pipes protocol.
context (Union[OpExecutionContext, AssetExecutionContext]) – The context of the currently executing Dagster op or asset.
params (dict) – Parameters for the start_job_run
boto3 AWS EMR Serverless client call.
See Boto3 EMR Serverless API Documentation
extras (Optional[Dict[str, Any]]) – Additional information to pass to the Pipes session in the external process.
Wrapper containing results reported by the external process.
PipesClientCompletedInvocation
S3 bucket to use for the file manager.
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.
Specifies whether to use an unsigned S3 session.
Default Value: False
Specifies a custom region for the S3 session.
Default Value: None
Specifies a custom endpoint for the S3 session.
Default Value: None
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
Specifies a profile to connect that session.
Default Value: None
Whether or not to use SSL. By default, SSL is used.
Default Value: True
Whether or not to verify SSL certificates. By default SSL certificates are verified.
Default Value: None
AWS access key ID to use when creating the boto3 session.
Default Value: None
AWS secret access key to use when creating the boto3 session.
Default Value: None
AWS session token to use when creating the boto3 session.
Default Value: None
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.
S3 bucket to use for the file manager.
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:
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,
},
)
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():
...
Specifies whether to use an unsigned S3 session.
Default Value: False
Specifies a custom region for the S3 session.
Default Value: None
Specifies a custom endpoint for the S3 session.
Default Value: None
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
Specifies a profile to connect that session.
Default Value: None
Whether or not to use SSL. By default, SSL is used.
Default Value: True
Whether or not to verify SSL certificates. By default SSL certificates are verified.
Default Value: None
AWS access key ID to use when creating the boto3 session.
Default Value: None
AWS secret access key to use when creating the boto3 session.
Default Value: None
AWS session token to use when creating the boto3 session.
Default Value: None
S3 bucket to use for the file manager.
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.
Redshift host
Redshift port
Default Value: 5439
Username for Redshift connection
Default Value: None
Password for Redshift connection
Default Value: None
Name of the default database to use. After login, you can use USE DATABASE to change the database.
Default Value: None
Whether to autocommit queries
Default Value: None
Timeout for connection to Redshift cluster. Defaults to 5 seconds.
Default Value: 5
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,)]
Redshift host
Redshift port
Default Value: 5439
Username for Redshift connection
Default Value: None
Password for Redshift connection
Default Value: None
Name of the default database to use. After login, you can use USE DATABASE to change the database.
Default Value: None
Whether to autocommit queries
Default Value: None
Timeout for connection to Redshift cluster. Defaults to 5 seconds.
Default Value: 5
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’
Specifies a custom region for the Boto3 session
Default Value: None
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
Specifies a profile to connect that session
Default Value: None
Whether or not to use SSL. By default, SSL is used.
Default Value: True
Specifies a custom endpoint for the Boto3 session.
Default Value: None
Whether or not to verify SSL certificates. By default SSL certificates are verified.
Default Value: True
AWS access key ID to use when creating the boto3 session.
Default Value: None
AWS secret access key to use when creating the boto3 session.
Default Value: None
AWS session token to use when creating the boto3 session.
Default Value: None
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
Specifies a custom region for the Boto3 session
Default Value: None
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
Specifies a profile to connect that session
Default Value: None
Whether or not to use SSL. By default, SSL is used.
Default Value: True
Specifies a custom endpoint for the Boto3 session.
Default Value: None
Whether or not to verify SSL certificates. By default SSL certificates are verified.
Default Value: True
AWS access key ID to use when creating the boto3 session.
Default Value: None
AWS secret access key to use when creating the boto3 session.
Default Value: None
AWS session token to use when creating the boto3 session.
Default Value: None
An array of AWS Secrets Manager secrets arns to fetch.
Default Value: []
AWS Secrets Manager secrets with this tag will be fetched and made available.
Default Value: None
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.