Compare commits
14 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3afa94f5a | ||
|
|
a6c56914a8 | ||
|
|
bbc55ec9b2 | ||
|
|
1db6d59dd2 | ||
|
|
c0383cc868 | ||
|
|
a91ec8ec4b | ||
|
|
52c2b70a3d | ||
|
|
810a5c2dde | ||
|
|
ae13079cc5 | ||
|
|
d07cd02799 | ||
|
|
abf407bbfc | ||
|
|
b5997cb342 | ||
|
|
24464f016a | ||
|
|
1aa35ebf3a |
6 changed files with 119 additions and 19 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,3 +4,4 @@
|
||||||
/APScheduler-3.7.0.tar.gz
|
/APScheduler-3.7.0.tar.gz
|
||||||
/APScheduler-3.8.0.tar.gz
|
/APScheduler-3.8.0.tar.gz
|
||||||
/APScheduler-3.10.4.tar.gz
|
/APScheduler-3.10.4.tar.gz
|
||||||
|
/apscheduler-3.11.0.tar.gz
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@ specfile_path: python-APScheduler.spec
|
||||||
upstream_package_name: APScheduler
|
upstream_package_name: APScheduler
|
||||||
downstream_package_name: python-APScheduler
|
downstream_package_name: python-APScheduler
|
||||||
upstream_project_url: https://github.com/agronholm/apscheduler
|
upstream_project_url: https://github.com/agronholm/apscheduler
|
||||||
|
version_update_mask: '\d+\.'
|
||||||
upstream_tag_exclude: "^4.[0-9].[0-9]a" # exclude version 4 alpha releases
|
upstream_tag_exclude: "^4.[0-9].[0-9]a" # exclude version 4 alpha releases
|
||||||
|
|
||||||
|
packit_instances: ["stg"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- job: copr_build
|
- job: copr_build
|
||||||
|
|
@ -19,7 +21,6 @@ jobs:
|
||||||
|
|
||||||
- job: pull_from_upstream
|
- job: pull_from_upstream
|
||||||
trigger: release
|
trigger: release
|
||||||
packit_instances: ["prod", "stg"]
|
|
||||||
dist_git_branches:
|
dist_git_branches:
|
||||||
- fedora-all
|
- fedora-all
|
||||||
|
|
||||||
|
|
|
||||||
102
01-test-executors.patch
Normal file
102
01-test-executors.patch
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
diff --git a/setup.cfg b/setup.cfg
|
||||||
|
index 002111f..012cff4 100644
|
||||||
|
--- a/setup.cfg
|
||||||
|
+++ b/setup.cfg
|
||||||
|
@@ -7,7 +7,7 @@ upload-dir = docs/_build/html
|
||||||
|
|
||||||
|
[tool:pytest]
|
||||||
|
asyncio_mode = strict
|
||||||
|
-addopts = -rsx --cov --tb=short
|
||||||
|
+addopts = -rsx --tb=short
|
||||||
|
testpaths = tests
|
||||||
|
|
||||||
|
[coverage:run]
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index cd93e10..59f5a80 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -56,7 +56,6 @@ setup(
|
||||||
|
'testing': [
|
||||||
|
'pytest',
|
||||||
|
'pytest_asyncio',
|
||||||
|
- 'pytest-cov',
|
||||||
|
'pytest-tornado5'
|
||||||
|
],
|
||||||
|
'doc': [
|
||||||
|
diff --git a/tests/test_executors.py b/tests/test_executors.py
|
||||||
|
index d67e187..0140dbe 100644
|
||||||
|
--- a/tests/test_executors.py
|
||||||
|
+++ b/tests/test_executors.py
|
||||||
|
@@ -5,6 +5,7 @@ import gc
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
import time
|
||||||
|
+from time import sleep
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from pytz import UTC
|
||||||
|
@@ -36,11 +37,11 @@ def executor(request, mock_scheduler):
|
||||||
|
executor_ = ThreadPoolExecutor()
|
||||||
|
else:
|
||||||
|
from apscheduler.executors.pool import ProcessPoolExecutor
|
||||||
|
- executor_ = ProcessPoolExecutor()
|
||||||
|
+ executor_ = ProcessPoolExecutor(4, {"max_tasks_per_child": 1})
|
||||||
|
|
||||||
|
executor_.start(mock_scheduler, 'dummy')
|
||||||
|
yield executor_
|
||||||
|
- executor_.shutdown()
|
||||||
|
+ executor_.shutdown(True)
|
||||||
|
|
||||||
|
|
||||||
|
def wait_event():
|
||||||
|
@@ -60,12 +61,12 @@ def test_max_instances(mock_scheduler, executor, create_job, freeze_time):
|
||||||
|
"""Tests that the maximum instance limit on a job is respected."""
|
||||||
|
events = []
|
||||||
|
mock_scheduler._dispatch_event = lambda event: events.append(event)
|
||||||
|
- job = create_job(func=wait_event, max_instances=2, next_run_time=None)
|
||||||
|
+ job = create_job(func=wait_event, max_instances=2, next_run_time=None, misfire_grace_time = None)
|
||||||
|
executor.submit_job(job, [freeze_time.current])
|
||||||
|
executor.submit_job(job, [freeze_time.current])
|
||||||
|
|
||||||
|
pytest.raises(MaxInstancesReachedError, executor.submit_job, job, [freeze_time.current])
|
||||||
|
- executor.shutdown()
|
||||||
|
+ executor.shutdown(True)
|
||||||
|
assert len(events) == 2
|
||||||
|
assert events[0].retval == 'test'
|
||||||
|
assert events[1].retval == 'test'
|
||||||
|
@@ -83,12 +84,13 @@ def test_submit_job(mock_scheduler, executor, create_job, freeze_time, timezone,
|
||||||
|
|
||||||
|
"""
|
||||||
|
mock_scheduler._dispatch_event = MagicMock()
|
||||||
|
- job = create_job(func=func, id='foo')
|
||||||
|
+ misfire_grace_time = 1 if event_code == EVENT_JOB_MISSED else None
|
||||||
|
+ job = create_job(func=func, id='foo', misfire_grace_time=misfire_grace_time)
|
||||||
|
job._jobstore_alias = 'test_jobstore'
|
||||||
|
run_time = (timezone.localize(datetime(1970, 1, 1)) if event_code == EVENT_JOB_MISSED else
|
||||||
|
freeze_time.current)
|
||||||
|
executor.submit_job(job, [run_time])
|
||||||
|
- executor.shutdown()
|
||||||
|
+ executor.shutdown(True)
|
||||||
|
|
||||||
|
assert mock_scheduler._dispatch_event.call_count == 1
|
||||||
|
event = mock_scheduler._dispatch_event.call_args[0][0]
|
||||||
|
@@ -157,18 +159,13 @@ def test_broken_pool():
|
||||||
|
|
||||||
|
pid = [None]
|
||||||
|
event = Event()
|
||||||
|
- scheduler = BackgroundScheduler(executors={'default': ProcessPoolExecutor(1)})
|
||||||
|
+ scheduler = BackgroundScheduler(executors={'default': ProcessPoolExecutor(1, {"max_tasks_per_child": 1})})
|
||||||
|
scheduler.add_listener(listener, EVENT_JOB_EXECUTED)
|
||||||
|
scheduler.add_job(os.getpid, 'date', run_date=datetime.now(UTC))
|
||||||
|
scheduler.start()
|
||||||
|
|
||||||
|
event.wait(3)
|
||||||
|
killed_pid = pid[0]
|
||||||
|
- os.kill(pid[0], signal.SIGTERM)
|
||||||
|
- try:
|
||||||
|
- os.waitpid(pid[0], 0)
|
||||||
|
- except OSError:
|
||||||
|
- pass
|
||||||
|
|
||||||
|
event.clear()
|
||||||
|
scheduler.add_job(os.getpid, 'date', run_date=datetime.now(UTC))
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
This repository is maintained by packit.
|
This repository is maintained by packit.
|
||||||
https://packit.dev/
|
https://packit.dev/
|
||||||
The file was generated using packit 0.83.0.post1.dev4+g46d87465.d20231011.
|
The file was generated using packit 0.104.1.post1.dev0+g23aec6b3.d20241128.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
%global srcname APScheduler
|
|
||||||
%global _description %{expand:
|
%global _description %{expand:
|
||||||
Advanced Python Scheduler (APScheduler) is a Python library that lets you
|
Advanced Python Scheduler (APScheduler) is a Python library that lets you
|
||||||
schedule your Python code to be executed later, either just once or
|
schedule your Python code to be executed later, either just once or
|
||||||
|
|
@ -8,39 +7,36 @@ scheduler restarts and maintain their state. When the scheduler is
|
||||||
restarted, it will then run all the jobs it should have run while it was
|
restarted, it will then run all the jobs it should have run while it was
|
||||||
offline.}
|
offline.}
|
||||||
|
|
||||||
Name: python-%{srcname}
|
Name: python-APScheduler
|
||||||
Version: 3.10.4
|
Version: 3.11.0
|
||||||
Release: %autorelease
|
Release: %autorelease
|
||||||
Summary: In-process task scheduler with Cron-like capabilities
|
Summary: In-process task scheduler with Cron-like capabilities
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://pypi.org/project/APScheduler/
|
URL: https://pypi.org/project/APScheduler/
|
||||||
Source0: %{pypi_source %{srcname}}
|
Source0: %{pypi_source apscheduler}
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%description %_description
|
%description %_description
|
||||||
|
|
||||||
%package -n python3-%{srcname}
|
%package -n python3-APScheduler
|
||||||
Summary: %{summary}
|
Summary: %{summary}
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
|
|
||||||
%description -n python3-%{srcname} %_description
|
%description -n python3-APScheduler %_description
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{srcname}-%{version} -p1
|
%autosetup -n apscheduler-%{version} -p1
|
||||||
# Remove that test as it require services (redis, zookeeper, ...)
|
# Remove that test as it require services (redis, zookeeper, ...)
|
||||||
# up and running. Upstream provides a docker compose to spawn
|
# up and running. Upstream provides a docker compose to spawn
|
||||||
# services before running these tests.
|
# services before running these tests.
|
||||||
rm tests/test_jobstores.py
|
rm tests/test_jobstores.py
|
||||||
sed -i 's/pytest-tornado5/pytest-tornado/' setup.py
|
# Skip missing dependencies in Fedora 42
|
||||||
# Remove coverage
|
sed -i 's/ "anyio >= 4.5.2",//' pyproject.toml
|
||||||
sed -i 's/addopts = -rsx --cov/addopts = -rsx/' setup.cfg
|
sed -i 's/,rethinkdb//' pyproject.toml
|
||||||
sed -i '/pytest-cov/d' setup.py
|
|
||||||
# It is in the tarball and is not used
|
|
||||||
rm -r APScheduler.egg-info
|
|
||||||
|
|
||||||
%generate_buildrequires
|
%generate_buildrequires
|
||||||
%pyproject_buildrequires -x testing -x tornado
|
%pyproject_buildrequires -x test -x tornado
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%pyproject_wheel
|
%pyproject_wheel
|
||||||
|
|
@ -54,7 +50,7 @@ rm -r APScheduler.egg-info
|
||||||
export TZ=UTC
|
export TZ=UTC
|
||||||
%pytest
|
%pytest
|
||||||
|
|
||||||
%files -n python3-%{srcname} -f %{pyproject_files}
|
%files -n python3-APScheduler -f %{pyproject_files}
|
||||||
%doc README.rst
|
%doc README.rst
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|
|
||||||
2
sources
2
sources
|
|
@ -1 +1 @@
|
||||||
SHA512 (APScheduler-3.10.4.tar.gz) = 44b78e60b7349437fb8d6e5ad3bbd764cfa653fdd65685b586119225e8daaff9b150871887812a1f3d4cd67b942c70e99d1606d38b83685953fb1bb1a82742fe
|
SHA512 (apscheduler-3.11.0.tar.gz) = c66d87773d3fe353e5f0bbc4bc9ba05337b555db0810e42e2e384fd9717438fda501d0c724cd7180010b11e5d8db901922b79a163aec3a420a6a65eafb6f39f6
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue