Title: spark_application engine reports successful single-feature-view materializations as failure · Issue #6673 · feast-dev/feast · GitHub
Open Graph Title: spark_application engine reports successful single-feature-view materializations as failure · Issue #6673 · feast-dev/feast
X Title: spark_application engine reports successful single-feature-view materializations as failure · Issue #6673 · feast-dev/feast
Description: Expected Behavior When a SparkApplication reaches COMPLETED, Feast should report the materialization as successful. Current Behavior Every successful single-feature-view materialization using the spark_application batch engine is reporte...
Open Graph Description: Expected Behavior When a SparkApplication reaches COMPLETED, Feast should report the materialization as successful. Current Behavior Every successful single-feature-view materialization using the s...
X Description: Expected Behavior When a SparkApplication reaches COMPLETED, Feast should report the materialization as successful. Current Behavior Every successful single-feature-view materialization using the s...
Opengraph URL: https://github.com/feast-dev/feast/issues/6673
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"spark_application engine reports successful single-feature-view materializations as failure","articleBody":"## Expected Behavior\n\nWhen a SparkApplication reaches `COMPLETED`, Feast should report the materialization as successful.\n\n## Current Behavior\n\nEvery successful single-feature-view materialization using the `spark_application` batch engine is reported as a failure:\n\n```text\nException: SparkApplication feast-sa-\u003cjob-id> not found\n```\n\nThis is deterministic: Feast deletes the SparkApplication CR before performing the status check that fails.\n\n`SparkApplicationComputeEngine.materialize()` waits for the job to reach a terminal status and then unconditionally deletes the CR:\n\n```python\ntry:\n self._wait_for_completion(job)\n return self._build_per_fv_jobs(registry, tasks, job_id, job)\nfinally:\n self._cleanup(job_id)\n```\n\nAfter `materialize()` returns, `FeatureStore._submit_and_process_materialization_jobs()` calls `job.status()` again. For a single feature view, `_build_per_fv_jobs()` returns the live polling job:\n\n```python\nif len(tasks) \u003c= 1:\n return [job for _ in tasks]\n```\n\nThe second status check therefore queries the CR that `_cleanup()` just deleted. The resulting 404 sets `_error`, changes the status to `ERROR`, and is subsequently raised by `FeatureStore`.\n\nBy this point, the Spark driver has already materialized the features and updated the registry. Automation calling `feast materialize` or the feature server's `/materialize` endpoint therefore sees a failure and may retry work that already succeeded.\n\nThis is not caused by the Spark Operator's `timeToLiveSeconds`; Feast explicitly deletes the CR immediately after `_wait_for_completion()` returns.\n\nThe relevant flow is still present on `master`:\n\n- [Cleanup after completion](https://github.com/feast-dev/feast/blob/ca355cb73fdd2e8d955274b9e7e65ada060ddfe3/sdk/python/feast/infra/compute_engines/spark_application/compute.py#L224-L228)\n- [Single-FV path returns the polling job](https://github.com/feast-dev/feast/blob/ca355cb73fdd2e8d955274b9e7e65ada060ddfe3/sdk/python/feast/infra/compute_engines/spark_application/compute.py#L266-L267)\n- [Status re-queries the Kubernetes API](https://github.com/feast-dev/feast/blob/ca355cb73fdd2e8d955274b9e7e65ada060ddfe3/sdk/python/feast/infra/compute_engines/spark_application/job.py#L94-L115)\n- [404 changes the job to an error](https://github.com/feast-dev/feast/blob/ca355cb73fdd2e8d955274b9e7e65ada060ddfe3/sdk/python/feast/infra/compute_engines/spark_application/job.py#L129-L134)\n- [FeatureStore performs the second status check](https://github.com/feast-dev/feast/blob/ca355cb73fdd2e8d955274b9e7e65ada060ddfe3/sdk/python/feast/feature_store.py#L563-L569)\n\n## Steps to reproduce\n\n1. Configure a Feast project with `batch_engine.type: spark_application`.\n2. Apply the feature definitions.\n3. Materialize exactly one feature view.\n4. Wait for the SparkApplication to reach `COMPLETED`.\n5. Observe Feast delete the CR and report:\n\n ```text\n SparkApplication feast-sa-\u003cjob-id> not found\n ```\n\nThe feature-view count matters. For multiple feature views, `_build_per_fv_jobs()` returns `CompletedMaterializationJob` instances for successful views. Their `status()` method returns `SUCCEEDED` without querying Kubernetes, so the successful multi-FV path does not exhibit this bug.\n\nThe failure can also be reproduced without a cluster:\n\n```python\nfrom kubernetes.client.exceptions import ApiException\n\nfrom feast.infra.compute_engines.spark_application.job import (\n SparkApplicationMaterializationJob,\n)\n\n\nclass Api:\n \"\"\"Return COMPLETED once, then simulate the CR having been deleted.\"\"\"\n\n def __init__(self):\n self.calls = 0\n\n def get_namespaced_custom_object(self, **kwargs):\n self.calls += 1\n if self.calls == 1:\n return {\n \"status\": {\n \"applicationState\": {\n \"state\": \"COMPLETED\",\n }\n }\n }\n raise ApiException(status=404, reason=\"Not Found\")\n\n\njob = SparkApplicationMaterializationJob(\"abc123\", \"default\", Api())\n\nprint(job.status()) # SUCCEEDED: observed by _wait_for_completion\nprint(job.status()) # ERROR: observed by FeatureStore after cleanup\nprint(job.error()) # SparkApplication feast-sa-abc123 not found\n```\n\n### Specifications\n\n- Version: Feast v0.65.0; also present on `master` at `ca355cb`\n- Platform: Kubernetes/EKS with the Kubeflow Spark Operator (`sparkoperator.k8s.io/v1beta2`)\n- Subsystem: `spark_application` batch compute engine and materialization\n\n## Possible Solution\n\nCache the first terminal status (`SUCCEEDED` or `ERROR`) in `SparkApplicationMaterializationJob` and return it on subsequent calls instead of polling Kubernetes again. Non-terminal states should continue polling normally.\n\nAn alternative is to return a `CompletedMaterializationJob` from the successful single-FV path, matching the existing multi-FV behavior. However, caching terminal state is more robust because it prevents any future caller from losing a known result after cleanup.\n\nRegression tests should verify that:\n\n- `COMPLETED` followed by a 404 remains `SUCCEEDED`, with `error()` returning `None`.\n- `FAILED` remains `ERROR` and preserves its `errorMessage`.\n- Non-terminal states continue polling.\n\nI have the terminal-status caching fix and regression tests working locally and can open a PR","author":{"url":"https://github.com/dbbvitor","@type":"Person","name":"dbbvitor"},"datePublished":"2026-07-30T14:33:43Z","url":"https://github.com/feast-dev/feast/issues/6673"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:04ecce1d-1711-f873-9bbc-a48b8cc01605 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D8C:E40BB:EE686B:145E4F2:6AFE9812 |
| html-safe-nonce | a5224567513d9cb1be83b15658d530cd3816d1df86807692bb347e63e85590e5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDhDOkU0MEJCOkVFNjg2QjoxNDVFNEYyOjZBRkU5ODEyIiwidmlzaXRvcl9pZCI6IjMyNjQ1NTkyMTEzMjA2MTI4ODIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6040fbd6cad5bc7f8a452c998de3838cf32c32d3f78ee767f2d3f0465ae4fa7a |
| hovercard-subject-tag | issue:5020832465 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/feast-dev/feast/6673/issue_layout |
| twitter:image | https://opengraph.githubassets.com/62059d8982f0452336f503c90943bd449172bd6e3113d540b4d61f330c9b8812/feast-dev/feast/issues/6673 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/62059d8982f0452336f503c90943bd449172bd6e3113d540b4d61f330c9b8812/feast-dev/feast/issues/6673 |
| og:image:alt | Expected Behavior When a SparkApplication reaches COMPLETED, Feast should report the materialization as successful. Current Behavior Every successful single-feature-view materialization using the s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dbbvitor |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/feast-dev/feast git https://github.com/feast-dev/feast.git |
| octolytics-dimension-user_id | 57027613 |
| octolytics-dimension-user_login | feast-dev |
| octolytics-dimension-repository_id | 161133770 |
| octolytics-dimension-repository_nwo | feast-dev/feast |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 161133770 |
| octolytics-dimension-repository_network_root_nwo | feast-dev/feast |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width