Framework
yahoo/TensorFlowOnSpark avatar
yahoo/TensorFlowOnSpark

TensorFlowOnSpark: running one TensorFlow main function across a Spark cluster

A framework for running distributed TensorFlow workloads on Apache Spark clusters.

3,848 stars933 forksPythonApache-2.0

At a glance

What is it?
TensorFlowOnSpark brackets an existing TensorFlow program with startup and shutdown steps and picks between two data paths, TENSORFLOW reading HDFS itself or SPARK feeding RDD records. It covers the training, model parallelism and TensorBoard paths a shared grid needs, and its own limits are sharper than its claims: two TensorFlow generations served by two tags, wiki hosted cluster recipes, no Windows, and a last commit in July 2023.
Who is it for?
Pick TensorFlowOnSpark when you already have a working single machine TensorFlow program, run Spark, and need training or inference on a cluster of CPU or GPU servers with data already in HDFS, because the stated cost of moving over is fewer than ten lines of change. Keep your single node path if you can, and do not plan around new upstream work: the last release was v2.2.5 in April 2022 and the last commit to master is dated 2023-07-10.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Probably not. The repository last received commits 41 months ago, on July 10, 2023.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • yahoo/TensorFlowOnSpark3,848 ★ · +2
Star history
Repository2026-08-132026-11-25
yahoo/TensorFlowOnSpark3.8k3.8k

2 Stars in the last 104 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Three cluster phases wrap one unchanged TensorFlow program

TensorFlowOnSpark does not ask you to write a Spark job. It brackets an existing TensorFlow main function with a startup step that launches that function on the executors plus listeners for data and control messages, and a shutdown step that tears down the TensorFlow workers and the PS nodes on those executors. What sits between the two brackets is your own code. The stated goal is to minimize the amount of code change required to run existing TensorFlow programs on a shared grid, and the background section quantifies that goal as migrating an existing program with fewer than ten lines of change. Because the wrapper manages only the cluster lifecycle, anything that does not involve reading input or writing output stays exactly as it was in a single machine script. The advertised benefits are also explicit about scope: all TensorFlow functionalities are said to be supported, covering synchronous and asynchronous training, model and data parallelism, inference and TensorBoard, and server to server direct communication is claimed to learn faster where it is available.

InputMode.TENSORFLOW and InputMode.SPARK move bytes differently

The one genuine fork in the design is how data reaches the training process. Under InputMode.TENSORFLOW the library leans on TensorFlow's own APIs to read data files straight from HDFS, so the data path never passes through a Spark task. Under InputMode.SPARK the RDD is shipped to the TensorFlow nodes through a class called TFNode.DataFeed, and reaching TFRecords still depends on the Hadoop Input/Output Format. The choice is therefore not purely about performance: the TENSORFLOW mode keeps the familiar TensorFlow input pipeline, while the SPARK mode is what lets a Spark data processing pipeline feed training directly. Choosing between them changes which code reads the records and where the record parsing lives, and the README does not document when one is required over the other.

TensorFlow 1.x and 2.x users need different repositories

The package is published twice over, and the split is a hard boundary rather than a preference. The current install targets TensorFlow 2.x:

code
# for tensorflow>=2.0.0
pip install tensorflowonspark

# for tensorflow<2.0.0
pip install tensorflowonspark==1.4.4

The reason for the older line is stated in the usage section rather than in the install section: since TensorFlow 2.x breaks API compatibility with TensorFlow 1.x, the examples were updated accordingly, and anyone on TensorFlow 1.x is told to check out the v1.4.4 tag for compatible examples and instructions. That tag is a different tree, not a different flag. requirements.txt itself carries only unbounded names, among them tensorflow, pyspark, py4j, numpy, scipy, h5py, packaging and setuptools, so nothing in the dependency file encodes which TensorFlow generation you are meant to be on.

pip installs only the library, cluster recipes live in the wiki

Everything a single machine run needs comes from pip, but the distributed half is documented somewhere else entirely. Getting started guides for single node Spark Standalone, YARN clusters and AWS EC2 all sit on the project wiki, referenced rather than reproduced in the README, and the conversion guide that describes the required changes to an existing TensorFlow application lives there too. Two consequences follow. First, a reader working only from the repository text can install the package but has no cluster procedure written locally. Second, the named environments are the practical support matrix: Standalone, YARN and EC2 are the paths with guides, and anything else is undocumented territory.

Windows is excluded by an open issue, not by design

The install section ends with an explicit exclusion: Windows is not currently supported, and the reason is a specific tracked issue, number 36, rather than a general statement about the platform. The library depends on Hadoop and Spark processes launched on executors plus direct server to server communication between them, so it inherits the constraints of that arrangement on every platform, but the only documented support statement covers the operating system question. The same paragraph also claims deployment flexibility, naming cloud or on-premise environments and CPU or GPU servers as supported shapes. Read together, the claim is about where the cluster runs, not about what operating system the client or the workers run on.

The API is generated, so the reference is a site not a file

There is no hand written API reference in the repository. The API section points at a published documentation site that is described as automatically generated from the code, which has a practical consequence: the surface is whatever the current source exposes, and there is no versioned copy of it in the tree. Top level entries show a mixed language layout for a Python package, including lib/, src/, pom.xml, screwdriver.yaml, tox.ini, tests/, doc/ and examples/ next to the tensorflowonspark/ package directory. The examples themselves are grouped by problem, with directories for mnist/, resnet/ and segmentation/ plus a shared utils/, which is the clearest signal of the intended workloads.

Released 2.2.5 in 2022, last commit 2023-07-10

The release history is short and stops well before today. The most recent tag is v2.2.5, dated 2022-04-21, preceded by v2.2.4 on 2021-05-25 and v2.2.3 on 2021-03-23, so the last three releases all landed inside about thirteen months. The last push to the default branch master is dated 2023-07-10, which is more than three years ago, so treat the code as stable but frozen rather than as something receiving ongoing work. Continuous integration is configured through a Screwdriver pipeline and a screwdriver.yaml file, with .tidelift.yml also present, and contributions are handled through a user group on Google Groups plus a Contributing.md guide and a Code-of-Conduct.md.

Editorial conclusion

Pick TensorFlowOnSpark when you already have a working single machine TensorFlow program, run Spark, and need training or inference on a cluster of CPU or GPU servers with data already in HDFS, because the stated cost of moving over is fewer than ten lines of change. Keep your single node path if you can, and do not plan around new upstream work: the last release was v2.2.5 in April 2022 and the last commit to master is dated 2023-07-10. Verify three things before you commit, your TensorFlow generation and whether the matching tag matches your code, that your platform is not Windows, which the project excludes through issue 36, and that cluster steps for your environment actually exist in the wiki, since guides cover Standalone, YARN and EC2 only.

Frequently asked questions

How is TensorFlowOnSpark installed for TensorFlow 2.x?

It ships as the pip package tensorflowonspark. For TensorFlow 2.0.0 and newer you run pip install tensorflowonspark, while projects still on TensorFlow below 2.0.0 pin pip install tensorflowonspark==1.4.4 and check out the v1.4.4 tag for matching examples.

What is the difference between InputMode.TENSORFLOW and InputMode.SPARK?

InputMode.TENSORFLOW uses TensorFlow's built in APIs to read data files directly from HDFS, while InputMode.SPARK sends Spark RDD data to the TensorFlow nodes through a TFNode.DataFeed class and relies on the Hadoop Input/Output Format for TFRecords on HDFS.

Does TensorFlowOnSpark support Windows?

No. The README states that Windows is not currently supported and points to issue 36 in the project tracker as the reason.

How much code change does TensorFlowOnSpark ask for?

The background section claims an existing TensorFlow program can be migrated with fewer than ten lines of change, since startup and shutdown are handled by the library and the rest of the program stays as written.

Where are the cluster setup instructions for TensorFlowOnSpark?

On the project wiki rather than in the repository. Getting started guides exist for single node Spark Standalone, YARN clusters and AWS EC2, and the conversion guide for existing TensorFlow applications is also hosted on the wiki.

Official sources

  1. Official README
  2. Project repository
  3. Release notes
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/yahoo-tensorflowonspark.svg)](https://hysenlabs.com/projects/yahoo-tensorflowonspark)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/yahoo-tensorflowonspark.svg)](https://hysenlabs.com/projects/yahoo-tensorflowonspark)

Was this useful?