Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - record / persist only failed tasks #1335

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -540,3 +540,14 @@ Default: None
Sets the URI to which an OAuth 2.0 server redirects the user after successful authentication and authorization.

`oauth2_redirect_uri` option should be used with :ref:`auth`, :ref:`auth_provider`, :ref:`oauth2_key` and :ref:`oauth2_secret` options.

.. _persist_only_failed_tasks:

persist_only_failed_tasks
~~~~~~~~~~~~~~~~~~~

Default: False

Config to persist only failed tasks

.. Note:: When persist_only_failed_tasks mode is enabled, Flower only show failed tasks, but still count number of other tasks.
5 changes: 5 additions & 0 deletions flower/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ def event(self, event):
if event_type in ['task-succeeded', 'task-failed'] and not task.eta and task_started and task_received:
self.metrics.prefetch_time.labels(worker_name, task_name).set(0)

if options.persist_only_failed_tasks:
if event_type in ['task-succeeded', 'task-revoked']:
del self.tasks[task_id]
self.rebuild_taskheap()

if event_type == 'worker-online':
self.metrics.worker_online.labels(worker_name).set(1)

Expand Down
2 changes: 1 addition & 1 deletion flower/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
define("url_prefix", type=str, help="base url prefix")
define("task_runtime_metric_buckets", type=float, default=Histogram.DEFAULT_BUCKETS,
multiple=True, help="histogram latency bucket value")

define("persist_only_failed_tasks", type=bool, help="Persist only failed tasks", default=False)

default_options = options