Limits and troubleshooting

Spark runtimeDownload PDF (3.0 MB)

Limits and quotas#

Limit Value
Workers per session 1 minimum (default), 10 maximum
Worker scale-up threshold 70 percent CPU or memory
Executor memory 65 percent of worker memory, at most worker memory minus 1 GiB
Idle executor release 120 seconds
Rows collected for a preview 100,000
Dataset page size Default 1,000, maximum 10,000
Dataset run wait 300 seconds
Session kept after its last run 280 seconds
Session inactivity shutdown 300 seconds
Network and broadcast timeout 600 seconds
Agent invocation wait 15 minutes
Agent corpus documents, calls 10,000, 50,000 by default
Agent corpus workers 1 to 32, default 4
LLM request timeout 120 seconds by default
LLM retries 3, for HTTP 429 and 5xx

What the limits mean in practice:

  • Dataset runs are bounded. A dataset run must answer within 300 seconds. Move long transformations into a scheduled job and let the dataset read the result.
  • Sessions end. A session is released after about 5 minutes of inactivity. Never keep state in the driver's memory that you cannot rebuild.
  • Previews are samples. The preview holds at most 100,000 rows. Write the complete result to a table or file when you need all rows.
  • Stop times end the session. When a schedule's stop time is reached, the session ends and aborts running work.

Restrictions in job scripts#

Job scripts run with restrictions. Notebook kernels do not apply these rules.

Area Rule
Imports socket, urllib, http, ssl, threading, multiprocessing, pickle, shutil, pathlib, glob, gzip, zipfile, sqlite3, signal, asyncio and similar modules cannot be imported
Processes subprocess, os.system, os.popen, os.exec*, os.spawn* and os.fork are blocked
Files open works under /tmp, /home/workspace and /home; other system paths are refused
Credentials Secret values in os.environ show as ****; changes stay private to your script
Dynamic code eval, exec, compile, input and breakpoint are blocked
AWS boto3 clients cannot be created; use the connectors or getClient()
Exit sys.exit() is blocked

Use connectors for network and storage access, and finish a script by assigning outputDF rather than calling exit.

Things to know#

  • Spark settings apply once. In a reused session (notebook, shared dataset session) sparkSession(..., **settings) returns the existing session and ignores new settings. Restart the session to change them.
  • collect() has no result limit. A very large collect() exhausts the driver's memory.
  • coalesce=True writes through a single task. Use it for small outputs only.
  • A lakehouse catalog belongs to one run. Do not keep a catalog name from an earlier run (see belongs to another execution below).
  • Unpinned packages move. The TensorFlow variant and any package without a pinned version can change when the runtime is rebuilt.
  • Streaming into a lakehouse table needs its partitioning first. Create the table with its partition spec, then stream into it.

Troubleshooting#

Each entry gives the message exactly as you see it, then the cause and the fix.

Symptom Cause Fix
AttributeError: 'sparkSession' object has no attribute 'read' You used spark.read, spark.write or spark.sparkContext. Use the connector methods, for example spark.readS3(...), or DataFrame operations.
ImportError: Import of 'x' is not allowed for security reasons The module is blocked in job scripts. Use a connector for the same task, or run the code in a notebook.
PermissionError: os.system() is not allowed (and similar for subprocess) Job code cannot start processes. Use library calls instead.
PermissionError: Access to '/data/x' outside sandbox-safe directories is not allowed The script wrote outside the allowed folders. Write temporary files under /tmp or /home/workspace. Use S3 or a lakehouse table for anything that must outlive the run.
ImportError: Direct access to 'boto3' is restricted A job script created a boto3 client. Use spark.readS3, spark.writeS3 or getClient().
ValueError: No executable code found. The job has no code. Save the script and run again.
ValueError: siteName is required for GZLAKEHOUSE connection 'x'. Groundzero could not work out the site. Pass siteName='<site>' to the method or to sparkSession.
ValueError: REST catalog writes only support mode='append' or mode='overwrite'; got 'x'. The write mode is not allowed for lakehouse tables. Change mode to append or overwrite.
ValueError: database is required for REST catalog writes No database was given. Pass database= or set a default database on the connection.
PermissionError: GZLAKEHOUSE connection 'x' is external and read-only; ... External lakehouse connections only allow SELECT, SHOW, DESCRIBE and EXPLAIN. Write to an internal connection.
ValueError: partitionBy is not supported for streaming GZLAKEHOUSE writes; ... partitionBy was passed to a streaming write. Create the table with its partition spec, then stream into it.
RuntimeError: GZLAKEHOUSE catalog 'x' belongs to another execution. You used a catalog name saved from an earlier run. Get the current one with spark.getLakehouseCatalog(...) or use executeQuery.
ValueError: Connection x not found or is not a JDBC type. The name is wrong or the connection is not a JDBC type. Check the connection name and type.
TypeError: Use writeSnowflake() for connection x. writeJDBC was used on a Snowflake connection. Call writeSnowflake.
Exception: Error reading file from S3: ... The text after the colon is the cause (missing key, permission, malformed file). Check the path and the connection's bucket.
ValueError: Missing columns: [...]. Available: [...] A column named in promptColumn, promptTemplate or systemPromptColumn is not in the DataFrame. Fix the column name.
ValueError: AWS Bedrock model must be set in the connection or call. No model was given. Pass model= (the model ID) or set a model on the connection.
The dataset session stopped responding before it took the run. Run the dataset again to start a new session. The session ended before your run started. Run the dataset again. A new session starts.
TimeoutError from invokeAgent The wait for the Agent ended after 15 minutes. The Agent run is not cancelled. Look up the run ID in the error and inspect that run before you submit again.
ErrorType: message at line N An error in your script. N is the line in your code, and the failing line is printed below. Fix that line.
A job is slow to start A new session starts a driver and at least one worker. Keep a notebook or dataset warm, raise the minimum workers for large jobs, or schedule heavy work ahead of time.

FAQ#

Do I need to create the SparkSession myself? Call sparkSession(appName). It returns the shared session with all connectors attached. A bare PySpark session has no connectors, credentials or governance.

How do I see the result of my job? Assign a DataFrame to outputDF. The preview and its schema appear in the UI. Anything you print appears in the log.

Can I use pandas? Yes. Assign a pandas DataFrame to outputDF. toPandas() works for small results. For large data, stay in Spark.

Where do my credentials come from? From the connection. Code uses only the connection name, and secret values are hidden from your script.

How do I choose how many workers I get? Set Minimum Workers in the runtime picker. Groundzero adds workers, up to 10, when CPU or memory use passes 70 percent.

Why did my Spark settings not apply? The session already existed. Settings passed to sparkSession are used only when the session is created.

Can two users share a dataset session? Yes. Runs on the same dataset share a pool of sessions, one run per session at a time. Lakehouse permissions apply to each user, and the session clears the previous user's views.

How do I add a library? Use %pip install in a notebook for a trial. For permanent packages, ask an administrator to create a custom runtime based on a Spark runtime.

Which variant do I need for machine learning? For scikit-learn or boosting libraries, the scikit-learn variant. For deep learning with PyTorch, the PyTorch variant. For TensorFlow or spaCy, the TensorFlow variant.

Can I read a table I cannot write? Yes. External lakehouse connections are read-only, and per-table permissions decide who can query or write a table.

What happens to my notebook files? Your notebook is saved each time you save it.

How are runs recorded? Each run records status, logs, Spark metrics, audit entries for lakehouse access and lineage from every connector read and write.