Skip to content
Back to skills

Tensorflow On Spark

ASecurity

"Operate TensorFlowOnSpark workflows that combine TensorFlow

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
devopspythonjavabashsqlnodedockerkubernetesapi

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 20 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill tensorflow-on-spark --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tensorflow On Spark?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tensorflow On Spark
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-tensorflow-on-spark/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-tensorflow-on-spark)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tensorflow-on-spark
description: "Operate TensorFlowOnSpark workflows that combine TensorFlow
  training, inference, TFRecords, and Spark clusters or Spark ML pipelines."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# TensorFlowOnSpark

Use this repo skill when a task involves the `tensorflowonspark` package, Yahoo TensorFlowOnSpark, distributed TensorFlow on Apache Spark, `TFCluster`, `TFNode.DataFeed`, Spark ML `TFEstimator` / `TFModel`, TFRecord DataFrame conversion, or converting TensorFlow examples to `spark-submit` workflows.

TensorFlowOnSpark lets a Spark application start TensorFlow functions on executors, coordinate node reservations, feed Spark RDD or DataFrame data into TensorFlow workers, and shut the cluster down after training or inference. Most practical tasks need both Python-package checks and Spark runtime checks.

## Install and first checks

For a normal Python environment, install the public package and the runtime dependencies needed by the workflow:

```bash
pip install tensorflowonspark
# Add TensorFlow, PySpark, NumPy/SciPy/HDF5, and Spark/Java according to your cluster policy.
# For current TensorFlow 2.x CPU-only inspection, a package such as tensorflow-cpu can be sufficient.
```

For a repository development checkout, use an editable install only in a private development environment. TensorFlowOnSpark 2.2.5 uses legacy packaging and `pkg_resources`; if modern packaging tools reject its metadata or remove `pkg_resources`, apply that repair in the development environment rather than baking local paths into runtime instructions.

1. Confirm the package imports:

   ```bash
   python - <<'PY'
   import tensorflowonspark
   from tensorflowonspark import TFCluster, TFNode, TFParallel, dfutil
   from tensorflowonspark.pipeline import TFEstimator, TFModel
   print(tensorflowonspark.__version__)
   PY
   ```

2. Confirm Spark and Java before running native Spark jobs:

   ```bash
   python scripts/check_environment.py --json
   ```

3. For Spark-fed training/inference, confirm the Spark application has one task per executor, enough executor slots for the TensorFlow cluster, `spark.python.worker.reuse` for background mode, and the TensorFlow Hadoop jar on the Spark classpath when TFRecords are used.

## Route by task

| User task | Read |
|---|---|
| Start, stop, or debug a `TFCluster.run(...)` job; reservation waits; TensorBoard URL; TF_CONFIG; GPU allocation; `TFParallel.run(...)` | [cluster-lifecycle](sub-skills/cluster-lifecycle/SKILL.md) |
| Write a `map_fun(args, ctx)` using `InputMode.SPARK`; feed RDD/DStream rows; return inference results; handle `DataFeed` timeouts or early termination | [datafeed-inputmode](sub-skills/datafeed-inputmode/SKILL.md) |
| Train or infer with Spark ML DataFrames using `TFEstimator` or `TFModel`; map DataFrame columns to TensorFlow tensors; load SavedModels | [spark-ml-pipelines](sub-skills/spark-ml-pipelines/SKILL.md) |
| Save/load TFRecords as Spark DataFrames; reason about `tf.train.Example` schemas; handle `binary_features`; prepare MNIST-shaped rows | [dataframes-tfrecords](sub-skills/dataframes-tfrecords/SKILL.md) |
| Convert TensorFlow/Keras/Estimator examples to TensorFlowOnSpark; build `spark-submit` command plans for MNIST, ResNet, segmentation, serving, or batch inference | [examples-conversion](sub-skills/examples-conversion/SKILL.md) |

## Shared references and scripts

- [Repository provenance](references/repo-provenance.md) records the source commit, package version, evidence paths, and refresh baseline.
- [API map](references/api-map.md) shows which sub-skill owns each public module and workflow family.
- [Troubleshooting](references/troubleshooting.md) covers cross-cutting install/import, Java/Spark, TensorFlow/PySpark, Hadoop jar, Python metadata, and GPU issues.
- [check_environment.py](scripts/check_environment.py) is a safe diagnostic helper; it does not start training, download datasets, mutate clusters, or allocate GPUs.

## Operating rules

- Do not run long training examples, TF Serving Docker containers, cloud installers, or dataset downloads unless the user explicitly asks and the runtime is suitable.
- Do not assume Spark local mode is equivalent to TensorFlowOnSpark's distributed executor behavior. For cluster semantics, prefer Spark Standalone, YARN, Kubernetes, or `local-cluster[...]` style tests that isolate executor processes.
- For `InputMode.SPARK`, the TensorFlow function must consume rows from `TFNode.DataFeed`; Spark actions are still required to trigger lazy RDD inference.
- For Spark ML Pipelines, the DataFrame API is Spark-fed (`InputMode.SPARK`); route TensorFlow-native file-reading workflows to `examples-conversion` or `cluster-lifecycle` instead.
- For TFRecords, keep records flat enough for Spark SQL types and supply `binary_features` for raw bytes.
- Treat GPU use as optional unless the user explicitly requires it. CPU can validate many workflows, but it does not prove CUDA allocation, driver compatibility, or GPU TensorFlow execution.

## Common validation signals

- `TFCluster.run(...)` returns a cluster object after every executor reserves a node.
- `cluster.train(...)`, `cluster.inference(...)`, and `cluster.shutdown(...)` finish without late worker exceptions.
- Spark ML `TFEstimator.fit(...)` writes the expected checkpoint or SavedModel artifact, and `TFModel.transform(...)` returns a DataFrame with the requested output columns.
- TFRecord conversion preserves simple scalar/array fields and treats string versus binary features as intended.
- Render-only helper scripts output reviewable commands/templates without running Spark, Docker, downloads, or destructive cleanup.

Files in this skill

  • SKILL.md5.6 KB
  • references/api-map.md2.8 KB
  • references/repo-provenance.md2.1 KB
  • references/repo-routing-metadata.json354 B
  • references/troubleshooting.md5 KB
  • scripts/check_environment.py6.6 KB
  • sub-skills/cluster-lifecycle/SKILL.md3.7 KB
  • sub-skills/cluster-lifecycle/references/api-reference.md9.1 KB
  • sub-skills/cluster-lifecycle/references/cluster-workflows.md6.5 KB
  • sub-skills/cluster-lifecycle/references/troubleshooting.md6.4 KB
  • sub-skills/cluster-lifecycle/scripts/request_streaming_stop.py3.8 KB
  • sub-skills/cluster-lifecycle/scripts/tfos_cluster_env_check.py10.8 KB
  • sub-skills/datafeed-inputmode/SKILL.md3.6 KB
  • sub-skills/datafeed-inputmode/references/api-reference.md7.4 KB
  • sub-skills/datafeed-inputmode/references/datafeed-patterns.md10.1 KB
  • sub-skills/datafeed-inputmode/references/troubleshooting.md8 KB
  • sub-skills/datafeed-inputmode/scripts/render_datafeed_template.py8.6 KB
  • sub-skills/dataframes-tfrecords/SKILL.md2.2 KB
  • sub-skills/dataframes-tfrecords/references/api-reference.md2.8 KB
  • sub-skills/dataframes-tfrecords/references/data-formats.md2.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.