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

fix: avoid error message on graceful shutdown #1217

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ jobs:

validate-release-tag:

if: github.repository == 'circus-tent/circus'
if: github.repository == 'bentoml/kantoku'
runs-on: ubuntu-20.04

steps:
@@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9']

steps:
- uses: actions/checkout@v3
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9']
python-version: ['3.9', '3.13', 'pypy-3.9']

steps:
- uses: actions/checkout@v3
@@ -42,7 +42,7 @@ jobs:

strategy:
matrix:
os: ['macos-12']
os: ['macos-15']
skip-tests: [false]
include:
- os: windows-2019
2 changes: 2 additions & 0 deletions circus/arbiter.py
Original file line number Diff line number Diff line change
@@ -581,6 +581,8 @@ def start_io_loop(self):
def stop(self):
logger.info('Arbiter exiting')
self._stopping = True
if self.ctrl.caller is not None:
self.ctrl.caller.stop()
yield self._stop_watchers(close_output_streams=True)
if self._provided_loop:
cb = self.stop_controller_and_close_sockets
11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -3,10 +3,11 @@ requires = ['flit_core>=3.4,<4']
build-backend = 'flit_core.buildapi'

[project]
name = 'circus'
name = 'kantoku'
dynamic = ['description', 'version']
authors = [
{name = 'Mozilla Foundation & contributors', email = 'services-dev@lists.mozila.org'}
{name = 'Mozilla Foundation & contributors', email = 'services-dev@lists.mozila.org'},
{name = 'BentoML Team', email = 'team@bentoml.com'}
]
readme = 'README.md'
license = {file = 'LICENSE'}
@@ -22,6 +23,8 @@ classifiers = [
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
]
requires-python = '>=3.7'
dependencies = [
@@ -31,7 +34,7 @@ dependencies = [
]

[project.urls]
Source = 'https://github.com/circus-tent/circus'
Source = 'https://github.com/bentoml/kantoku'
Documentation = 'https://circus.readthedocs.io'

[project.optional-dependencies]
@@ -75,7 +78,7 @@ testpaths = [
legacy_tox_ini = """
[tox]
isolated_build = True
envlist = py37,py38,py39,py310,py311,pypy37,pypy38,pypy39,flake8,docs
envlist = py39,py310,py311,py312,py313,pypy39,flake8,docs

[testenv]
passenv = PWD
15 changes: 13 additions & 2 deletions tests/support.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
import sysconfig
import concurrent

from unittest import skip, skipIf, TestCase, TestSuite, findTestCases # noqa: F401
from unittest import skip, skipIf, TestCase, TestSuite

from tornado.testing import AsyncTestCase
from unittest import mock
@@ -100,7 +100,11 @@ def _stop_clients(self):
self._clients.clear()

def get_new_ioloop(self):
return get_ioloop()
# Create a new event loop instead of using the current one
from tornado.platform.asyncio import AsyncIOLoop
import asyncio
asyncio.set_event_loop(asyncio.new_event_loop())
return AsyncIOLoop()

def tearDown(self):
for file in self.files + self.tmpfiles:
@@ -128,6 +132,13 @@ def tearDown(self):

self.arbiters = []
super(TestCircus, self).tearDown()
# Clean up the event loop
loop = self.io_loop
if loop is not None:
try:
loop.close(all_fds=True)
except Exception:
pass

def make_plugin(self, klass, endpoint=DEFAULT_ENDPOINT_DEALER,
sub=DEFAULT_ENDPOINT_SUB, check_delay=1,
Empty file.
1 change: 1 addition & 0 deletions tests/venv/lib/python3.12/orig-prefix.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Library/Frameworks/Python.framework/Versions/3.12
3 changes: 3 additions & 0 deletions tests/venv/lib/python3.12/site-packages/easy-install.pth
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import sys; sys.__plen = len(sys.path)
./pip-7.7-py3.12.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)
Empty file.
1 change: 1 addition & 0 deletions tests/venv/lib/python3.13/orig-prefix.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Library/Frameworks/Python.framework/Versions/3.13
3 changes: 3 additions & 0 deletions tests/venv/lib/python3.13/site-packages/easy-install.pth
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import sys; sys.__plen = len(sys.path)
./pip-7.7-py3.13.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)