Direct submit in SPYT
With direct submit, a Spark application gets resources from the YTsaurus scheduler without a pre-launched standalone cluster. The driver coordinates the application, and executors run its tasks.
This page explains how direct submit works and how it is configured. For launch steps, see the guide.
Operating Principle
The key idea is that Spark delegates resource management to the YTsaurus scheduler.
Resource Allocation for the Driver
-
Cluster mode: The driver is also launched as a separate Vanilla operation within the YTsaurus cluster. In this mode, the driver's lifecycle (including logging, monitoring, and restart on failure) is fully controlled by YTsaurus. Suitable for production tasks.
-
Client mode: The driver is launched on a client host — for example, on a developer's local machine or in a Jupyter notebook. This mode is convenient for debugging and interactive work, as it provides direct access to the driver's logs and state.
Warning
In client mode, network access between executors and the driver must be ensured.
Resource Allocation for Executors
In this mode, the scheduler allocates resources to executors directly as part of a separate Vanilla operation on the YTsaurus cluster. A job within the operation corresponds to one Spark executor. The specifications for executors (number of CPUs, amount of memory, disk type, etc.) are described in the Task section of the operation specification. It is possible to describe different resource profiles for Spark executors for tasks with heterogeneous workload during the lifecycle.

Advantages of the Approach
- Efficient resource usage — allocation on demand, minimal downtime.
- Simple management — a single level of control instead of duplication (YTsaurus + Standalone).
- Flexibility — operation without losses at low load.
- Fast task startup — no need to pre-launch the cluster.
- Easy migration — compatibility with other clusters (including Hadoop) due to standard SparkAPI.
Configuring YTsaurus Operation
In addition to the standard Spark parameters for the driver and executors, you can further configure operations and tasks through the corresponding conf parameters spark.ytsaurus.{driver|executor}.{operation|task}.parameters. The value is specified as a YSON string with valid Vanilla operation parameters. For example, you can set the type and amount of attached disks:
--conf spark.ytsaurus.executor.task.parameters='{"disk_request"={"disk_space"=1234567;
"account"="disk_account_name";
"medium_name"="ssd_slots_physical";};
}'
The full list of parameters can be found in the section operation options.
Using Docker Images and Porto Layers
When directly submitting Spark applications to YTsaurus, you can use both Docker images and Porto layers for driver and executor tasks. This allows you to prepare the execution environment with the required system libraries, Python packages, and other dependencies.
You can find information on building your own Docker image in the cluster configuration section.
Docker images or Porto layers are passed via additional parameters:
OP_SPEC='{"docker_image"="[REGISTRY/]IMAGE:TAG";}'
spark-submit --master "ytsaurus://<cluster-host>:<port>" \
--deploy-mode cluster \
--num-executors 1 \
--queue <pool> \
--conf spark.ytsaurus.executor.task.parameters="$OP_SPEC" \
--conf spark.ytsaurus.driver.task.parameters="$OP_SPEC" \
./spark-job.py
For more details, see the root filesystem images section.
RPC proxy roles
A proxy role is a string label that selects a group of RPC proxies during proxy discovery. Different roles let you separate connections from the client host and from YTsaurus cluster jobs.
A process can use several YTsaurus clients: one for operation management and others for data access. The connection method depends on the client's purpose:
|
Process |
Client purpose |
Connection |
|
|
Application submission, reading SPYT configurations, and operation management |
Discovery |
|
Driver in |
Reading and writing data |
Discovery |
|
Driver in |
Managing executor operations |
Discovery |
|
Driver and executors in YTsaurus jobs |
Reading and writing data |
Local job proxy or discovery, under the conditions below |
To access the execution cluster, a data client uses the RPC proxy built into the job proxy when spark.ytsaurus.rpc.job.proxy.enabled=true (the default) and a local socket is available. This connection bypasses discovery and role selection. When reading data from another cluster, the client uses discovery with the configured role and bypasses the local socket.
For clients that use discovery, two parameters control the roles:
spark.hadoop.yt.proxyRole: The role for the client on the application submission host.spark.hadoop.yt.clusterProxyRole: A separate role for processes inside the cluster. It replacesspark.hadoop.yt.proxyRolewhen these processes are prepared. If no separate role is set, the client role is retained.
The Data Source V1 write client on an executor uses the driver's saved configuration. Its limitation in Spark 3.5.5 is described separately. For defaults, see the parameter reference. The configuration order is described below.
If discovery cannot find suitable RPC proxies for the role, see how to diagnose Cannot get rpc proxies.
Configuration sources and priority
During direct submit, SPYT augments the application's SparkConf from the following sources in descending priority order:
- The
--confoptions of thespark-submitcommand and the application'sSparkConf. - The
spark_confsection of the SPYT release configuration. Its path is composed ofspark.ytsaurus.config.releases.path, the SPYT version, andspark.ytsaurus.config.launch.file(see Options for launching tasks directly). - The
spark_confsection of the global configuration,//home/spark/conf/globalby default (thespark.ytsaurus.config.global.pathparameter).
Values from the user configuration are not overwritten: sources with lower priority only add missing parameters. The exception is Boolean flags from the enablers section of the cluster configurations: they can only disable a parameter, not enable it.
This order describes how SparkConf is merged. Parameters read before the merge do not change launch settings that have already been prepared. For example, spark.ytsaurus.java.home is read before the release and global settings are added to SparkConf; to change Java for launching the driver, specify it via --conf.
The client that reads the release and global configurations is created before they are applied. Its role comes from --conf or SparkConf. An incorrect role set only in the release configuration or //home/spark/conf/global therefore shows up later, in the driver or executors.
Applying the cluster role
In cluster mode, you can set spark.hadoop.yt.clusterProxyRole for all users in the spark_conf section of //home/spark/conf/global. The driver uses it to start executors. A user can override the value with --conf.
In client mode, set a separate executor role in --conf or SparkConf. The clusterProxyRole substitution happens before the release and global configurations are loaded, so a value set only in those documents is not applied. For examples, see the launch guide.
Proxy role limitations
Role when writing through Data Source V1
In Spark 3.5.5, writes through Data Source V1 (spark.sql.sources.useV1SourceList=yt) use the driver's saved Hadoop configuration on the executor. This configuration is created before the cluster role is substituted.
As a result, in cluster mode, the write client may retain external if spark.hadoop.yt.proxyRole=external is set in --conf and spark.hadoop.yt.clusterProxyRole=internal is set only in the global configuration. When the job proxy is disabled, this role is used for discovery.
Pass --conf spark.hadoop.yt.clusterProxyRole=internal when submitting the application. The role is then substituted before the Hadoop configuration is created. This removes the described cause of selecting the wrong role. Proxy availability and successful writes also depend on other settings and conditions.
Executing Local Files
Starting with SPYT version 2.4.0, when launching tasks directly in YTsaurus, you can specify local files as executable modules and dependencies without pre-loading them to Cypress. In this case, local files will be pre-loaded into the file cache on Cypress and then used from there in the application. On re-launch, the cached files will be used. An example of the spark-submit command for this method is provided below:
spark-submit --master ytsaurus://<cluster name> \
--deploy-mode cluster \
--num-executors 5 \
--executor-cores 4 \
--py-files ~/path/to/my/dependencies.py \
~/path/to/my/script.py