convalesce-emit-pyspark
Report a PySpark driver to Convalesce: the script it ran, what it was called with, and whether it failed in Python.
A driver can fail before Spark runs anything, say by reading a table that is
not there. Spark still ends the application normally, so the listener that
convalesce-emit-spark installs reports a success. This package hooks the
driver's own Python and sends one driver_failure observation, which marks
the application's run failed, with the Python exception and its traceback.
Whether it failed or not, it also sends one driver_script observation as
the driver exits: the script's text and the arguments it was given. What ran
is the file on the machine that ran it, which a repository can only suggest.
Install
Into the Python the driver runs on:
pip install convalesce-emit-pyspark
Turn it on
With no code change, set this where spark-submit runs:
export CONVALESCE_PYSPARK_DRIVER_HOOK=true
The package ships a .pth file, which Python runs at start-up. It reads that
one variable and does nothing else unless it is true, so installing the
package changes nothing until you set it.
Or in the driver, before anything can fail:
import convalesce_emit_pyspark
convalesce_emit_pyspark.install()
Either way, set CONVALESCE_INGEST_KEY too; without it nothing is hooked.
Run it beside convalesce-emit-spark, which reports the application itself.
What is reported
driver_script, once per driver
Sent as the interpreter exits, after a run that succeeded and after one that failed, for a driver that started a Spark application:
- the application's id and name
argv: the script and its arguments, with credentials masked (--password hunter2and--url=postgresql://etl:hunter2@db/shopboth lose the password)source: the script's path, its text with credentials masked the same way, and the sha256 of the file as it is on the driver's machine. Text over 60,000 characters is cut from the end and markedtruncated; the hash is always of the whole file- the Python and PySpark versions
Two settings, both on unless set to false, 0, no or off:
| Variable | Off means |
|---|---|
CONVALESCE_SEND_SOURCE |
no source |
CONVALESCE_SEND_ARGUMENTS |
argv holds the script's path only, here and in driver_failure |
driver_failure, at most once per driver
For whichever comes first:
- an exception nobody caught, in the main thread or another thread
sys.exit(n)withnnot zero, sent as aSystemExit
It carries the application's id and name, the exception (type, message,
traceback, and its cause), argv as above, and the Python and PySpark
versions.
Both are sent before the driver exits, which delays that exit by at most
CONVALESCE_TIMEOUT per attempt. The hook never raises and never changes
the exit code; the exception still prints as it would have.
A driver usually stops its SparkSession before it exits, and a stopped
session no longer names its application. The hook wraps SparkContext.stop
to read the application's id and name first, and changes nothing else about
it.
Limits:
raise SystemExit(n)is not seen, onlysys.exit(n)- a
sys.exit(n)whoseSystemExitthe driver catches and swallows is still reported sourceis the script the driver was started with (spark-submit job.py), not the modules it imports
Supported
PySpark 3.3 to 4.0, on Python 3.9 and later.
Configure
Read from the environment: see convalesce-emit.
Metadata
Release files for convalesce-emit-pyspark 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| convalesce_emit_pyspark-0.2.0.tar.gz | 17.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| convalesce_emit_pyspark-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.9 kB
Release files / convalesce_emit_pyspark-0.2.0.tar.gz
| Download URL | convalesce_emit_pyspark-0.2.0.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3dca02a0c9321114e0fbad7fc216f5753a2267686ed8638379b556440e3a7d7
|
|
BLAKE2b-256 checksum How to use checksums |
90e8d7a7ea275c7fbab92a1eea08ac2d40d421024de3dacc7589eee7c32c5735
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logRelease files / convalesce_emit_pyspark-0.2.0-py3-none-any.whl
| Download URL | convalesce_emit_pyspark-0.2.0-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d87138fecc2fb8b94189ec482888b500e93c14791a4939bcd2538830591f0914
|
|
BLAKE2b-256 checksum How to use checksums |
8f8ad3c9183be59513020c03eb463eb21a73965026b8830201123f63c2bc0cac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency log