15
0
forked from pool/python-flower

Accepting request 1137292 from devel:languages:python

- update to 2.0.1:
  * Ask for safe args strings when calling inspect.active
  * Enable basic auth for api, fixes
  * Allow non integer rate limits like 3/m
  * Provide support for Python 3.10 and 3.11
  * Drop python 3.6 support
  * Improve error message
- drop remove-mock.patch: upstream
- drop backport_run_in_executor.patch: obsolete

- add python-rpm-macros dependency
  * Fixing GitHub OAuth callback handling
  * Switch away from Google+ OAuth2
  * Fix a bug in humanizing timestamps on the tasks page
  * Removed 500px height limitation
  * Fixed Python 3 mistake in Github Login Handler
  * Support environment variables in tornado 4.2.0 and >=4.3
  * Fix XSS on tasks page
  * Replace websokets with ajax
  * Fix bug in tasks page template
  * Fix celery version comparsion
  * Refactor version comparision
  * Use redis as default broker
  * Update dashboard counters on worker table updates
  * Move shut down group button to worker page
  * Update navbar title
  * Add a script for calling tasks
  * Add a link to worker name
  * Remove active task start time from worker page
  * Fix py3 json serialization

OBS-URL: https://build.opensuse.org/request/show/1137292
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-flower?expand=0&rev=9
This commit is contained in:
2024-01-07 20:39:43 +00:00
committed by Git OBS Bridge
6 changed files with 52 additions and 216 deletions

View File

@@ -1,48 +0,0 @@
From 5741cbcbc5c2a75c2552326018ee97b8fe5f257f Mon Sep 17 00:00:00 2001
From: John Vandenberg <jayvdb@gmail.com>
Date: Fri, 22 Mar 2019 08:28:34 +0700
Subject: [PATCH] Backport run_in_executor
---
flower/api/tasks.py | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
Index: flower-1.0.0/flower/api/tasks.py
===================================================================
--- flower-1.0.0.orig/flower/api/tasks.py
+++ flower-1.0.0/flower/api/tasks.py
@@ -83,6 +83,24 @@ class BaseTaskHandler(BaseHandler):
return result
+def inline_run_in_executor(func, *args):
+ from tornado.concurrent import Future, chain_future
+
+ io_loop = IOLoop.current()
+ if not hasattr(io_loop, "_executor"):
+ import concurrent.futures
+ from tornado.process import cpu_count
+
+ io_loop._executor = concurrent.futures.ThreadPoolExecutor(
+ max_workers=(cpu_count() * 5)
+ )
+ executor = io_loop._executor
+ c_future = executor.submit(func, *args)
+ t_future = Future()
+ io_loop.add_future(c_future, lambda f: chain_future(f, t_future))
+ return t_future
+
+
class TaskApply(BaseTaskHandler):
@web.authenticated
@gen.coroutine
@@ -143,8 +161,7 @@ Execute a task by name and wait results
result = task.apply_async(args=args, kwargs=kwargs, **options)
response = {'task-id': result.task_id}
- response = yield IOLoop.current().run_in_executor(
- None, self.wait_results, result, response)
+ response = yield inline_run_in_executor(self.wait_results, result, response)
self.write(response)
def wait_results(self, result, response):

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f920ca2902d7539fc180ab15e51f1d918355e5cc23da854ff9d59c6e5a1725b6
size 1974126

3
flower-2.0.1.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5ab717b979530770c16afb48b50d2a98d23c3e9fe39851dcf6bc4d01845a02a0
size 3220408

View File

@@ -1,3 +1,16 @@
-------------------------------------------------------------------
Sat Jan 6 20:11:53 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 2.0.1:
* Ask for safe args strings when calling inspect.active
* Enable basic auth for api, fixes
* Allow non integer rate limits like 3/m
* Provide support for Python 3.10 and 3.11
* Drop python 3.6 support
* Improve error message
- drop remove-mock.patch: upstream
- drop backport_run_in_executor.patch: obsolete
-------------------------------------------------------------------
Wed Jul 13 01:41:44 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
@@ -35,7 +48,7 @@ Tue May 17 12:28:23 UTC 2022 - pgajdos@suse.com
-------------------------------------------------------------------
Tue Jan 11 20:58:26 UTC 2022 - Dirk Müller <dmueller@suse.com>
- add python-rpm-macros dependency
- add python-rpm-macros dependency
-------------------------------------------------------------------
Tue Feb 2 00:18:01 UTC 2021 - John Vandenberg <jayvdb@gmail.com>
@@ -82,57 +95,57 @@ Fri Mar 22 01:59:49 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
* Upgrade tornado
* Fix the out-dated doc link in Worker.html
* Declare futures dependency using environment markers
* Fixing GitHub OAuth callback handling
* Fixing GitHub OAuth callback handling
* Correct spelling error
* Correct spelling and grammatical errors
* Switch away from Google+ OAuth2
* Switch away from Google+ OAuth2
* restrict release dependencies with version upper-bound
- from v0.9.2
* Add logout button
* Fix a bug in humanizing timestamps on the tasks page
* Fix a bug in humanizing timestamps on the tasks page
* Handle errors in custom format_task functions
* Pending tasks don't have a worker
* Fix result encoding
* Removed 500px height limitation
* Removed 500px height limitation
* Do not show debug information on 500 error
* Fixed Python 3 mistake in Github Login Handler
* Support environment variables in tornado 4.2.0 and >=4.3
* Fix XSS on tasks page
* Fixed Python 3 mistake in Github Login Handler
* Support environment variables in tornado 4.2.0 and >=4.3
* Fix XSS on tasks page
* Enable cross-origin websockets
* Fix bugreport
* Resolve relative config file names
* Fix broker api validation
* Loosen broker api validation
* Replace websokets with ajax
* Fix bug in tasks page template
* Fix celery version comparsion
* Refactor version comparision
* Replace websokets with ajax
* Fix bug in tasks page template
* Fix celery version comparsion
* Refactor version comparision
* Fixes in config documents
* Fix invalid URL used for datatable query
* Use redis as default broker
* Update dashboard counters on worker table updates
* Move shut down group button to worker page
* Update navbar title
* Add a script for calling tasks
* Add a link to worker name
* Remove active task start time from worker page
* Fix py3 json serialization
* Use redis as default broker
* Update dashboard counters on worker table updates
* Move shut down group button to worker page
* Update navbar title
* Add a script for calling tasks
* Add a link to worker name
* Remove active task start time from worker page
* Fix py3 json serialization
* Fix Error 500 because task.worker is None
* HTML escape task args
* Disable broker cert verification
* Enable all tasks columns with --tasks-options=all
* Add runtime to default tasks columns
* Document --tasks-columns=all
* Refactor redis broker
* Enable all tasks columns with --tasks-options=all
* Add runtime to default tasks columns
* Document --tasks-columns=all
* Refactor redis broker
* Support CELERY_QUEUES option
* Remove rabbitmq-plugins enable warning
* Remove rabbitmq-plugins enable warning
* Fix broken link to celery configuration document
- from v0.9.1
* Improve envvar handling
* By default update worker cache
* Fix task sorting for py3
* Fix missing workername
* Fix monitor tab problem of missing graphs
* Fix missing workername
* Fix monitor tab problem of missing graphs
- from v0.9.0
* workers can be sorted and filtered
* tasks can be sorted, filtered by name, state, worker, runtime, etc.
@@ -168,7 +181,7 @@ Wed Feb 20 08:09:01 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
* Fix bug, `events.Task.as_dict` is new in `Celery 3.1.7`
* events.Task.as_dict is new in Celery 3.1.7
* Refactor /api/tasks/ #515
* Use pprint instead of ast #491
* Use pprint instead of ast #491
* Define CELERY_ACCEPT_CONTENT for examples
* Fix task searching #480

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-flower
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,31 +17,25 @@
Name: python-flower
Version: 1.1.0
Version: 2.0.1
Release: 0
Summary: A web frontend for monitoring and administrating Celery clusters
License: BSD-3-Clause
URL: https://github.com/mher/flower
Source: https://files.pythonhosted.org/packages/source/f/flower/flower-%{version}.tar.gz
# Tornado 5+ update blocked by salt, so backport the missing piece
Patch0: backport_run_in_executor.patch
# PATCH-FIX-UPSTREAM gh#mher/flower#1228
Patch1: remove-mock.patch
BuildRequires: %{python_module Babel >= 1.0}
BuildRequires: %{python_module celery >= 5.0.0}
BuildRequires: %{python_module certifi}
BuildRequires: %{python_module humanize}
BuildRequires: %{python_module kombu}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module prometheus_client >= 0.8.0}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module pytz}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module tornado >= 5.0.0}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-Babel >= 1.0
Requires: python-celery >= 5.0.0
Requires: python-certifi
Requires: python-humanize
Requires: python-prometheus_client >= 0.8.0
Requires: python-pytz
@@ -58,10 +52,10 @@ Flower is a web based tool for monitoring and administrating Celery clusters.
%autosetup -p1 -n flower-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
@@ -70,6 +64,7 @@ Flower is a web based tool for monitoring and administrating Celery clusters.
%files %{python_files}
%license LICENSE
%doc README.rst
%{python_sitelib}/*
%{python_sitelib}/flower
%{python_sitelib}/flower-%{version}.dist-info
%changelog

View File

@@ -1,124 +0,0 @@
Index: flower-1.1.0/tests/unit/__init__.py
===================================================================
--- flower-1.1.0.orig/tests/unit/__init__.py
+++ flower-1.1.0/tests/unit/__init__.py
@@ -1,3 +1,4 @@
+from unittest import mock
from urllib.parse import urlencode
import tornado.testing
@@ -6,7 +7,6 @@ from tornado.options import options
from tornado.concurrent import Future
import celery
-import mock
from flower.app import Flower
from flower.urls import handlers
Index: flower-1.1.0/tests/unit/api/test_control.py
===================================================================
--- flower-1.1.0.orig/tests/unit/api/test_control.py
+++ flower-1.1.0/tests/unit/api/test_control.py
@@ -1,5 +1,4 @@
-from mock import MagicMock
-import mock
+from unittest.mock import MagicMock, patch
from flower.api.control import ControlHandler
from tests.unit import AsyncHTTPTestCase
@@ -174,7 +173,7 @@ class TaskControlTests(AsyncHTTPTestCase
class ControlAuthTests(WorkerControlTests):
def test_auth(self):
- with mock.patch.object(options.mockable(), 'basic_auth', ['user1:password1']):
+ with patch.object(options.mockable(), 'basic_auth', ['user1:password1']):
app = self._app.capp
app.control.broadcast = MagicMock()
r = self.post('/api/worker/shutdown/test', body={})
Index: flower-1.1.0/tests/unit/api/test_workers.py
===================================================================
--- flower-1.1.0.orig/tests/unit/api/test_workers.py
+++ flower-1.1.0/tests/unit/api/test_workers.py
@@ -1,6 +1,6 @@
import json
-import mock
+from unittest import mock
from flower.api.control import ControlHandler
from flower.inspector import Inspector
Index: flower-1.1.0/tests/unit/test_command.py
===================================================================
--- flower-1.1.0.orig/tests/unit/test_command.py
+++ flower-1.1.0/tests/unit/test_command.py
@@ -5,7 +5,6 @@ import unittest
import subprocess
from unittest.mock import Mock, patch
-import mock
from prometheus_client import Histogram
from flower.command import apply_options, warn_about_celery_args_used_in_flower_command, apply_env_options
@@ -49,7 +48,7 @@ class TestFlowerCommand(AsyncHTTPTestCas
- create flower command
"""
celery_app = self._get_celery_app()
- with mock.patch.object(celery_app, '_autodiscover_tasks') as autodiscover:
+ with patch.object(celery_app, '_autodiscover_tasks') as autodiscover:
celery_app.autodiscover_tasks()
self.get_app(capp=celery_app)
Index: flower-1.1.0/tests/unit/api/test_tasks.py
===================================================================
--- flower-1.1.0.orig/tests/unit/api/test_tasks.py
+++ flower-1.1.0/tests/unit/api/test_tasks.py
@@ -1,4 +1,4 @@
-from mock import Mock, patch
+from unittest.mock import Mock, patch
from datetime import datetime, timedelta
from celery.result import AsyncResult
@@ -16,7 +16,7 @@ from collections import OrderedDict
class ApplyTests(AsyncHTTPTestCase):
def test_apply(self):
- from mock import patch, PropertyMock
+ from unittest.mock import patch, PropertyMock
import json
result = 'result'
Index: flower-1.1.0/tests/unit/utils/test_broker.py
===================================================================
--- flower-1.1.0.orig/tests/unit/utils/test_broker.py
+++ flower-1.1.0/tests/unit/utils/test_broker.py
@@ -1,6 +1,6 @@
import unittest
-from mock import MagicMock
+from unittest.mock import MagicMock
from flower.utils import broker
from flower.utils.broker import RabbitMQ, Redis, RedisBase, RedisSocket, Broker, RedisSentinel
Index: flower-1.1.0/tests/unit/views/test_dashboard.py
===================================================================
--- flower-1.1.0.orig/tests/unit/views/test_dashboard.py
+++ flower-1.1.0/tests/unit/views/test_dashboard.py
@@ -1,17 +1,11 @@
import time
import unittest
-import sys
+from unittest.mock import patch
from tests.unit import AsyncHTTPTestCase
from tests.unit.utils import task_succeeded_events, task_failed_events
from tests.unit.utils import HtmlTableParser
-if sys.version_info >= (2, 7):
- from mock import patch
-else:
- from unittest.mock import patch
-
-
from celery.events import Event
from celery.utils import uuid