Skip to content

Commit 204bcf8

Browse files
authored
Merge pull request #3776 from camptocamp/revert-3767-renovate/master-own-packages
Revert "Update dependency c2casgiutils to v0.14.0 (master)"
2 parents bdbac31 + 7c1a6fe commit 204bcf8

9 files changed

Lines changed: 105 additions & 62 deletions

File tree

.github/workflows/main.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ jobs:
2828
with:
2929
fetch-depth: 0
3030

31-
- uses: camptocamp/initialise-gopass-summon-action@17703c87720ba3766abc90da60b437783b530d93 # v2.0.1
32-
with:
33-
ci-gpg-private-key: ${{secrets.CI_GPG_PRIVATE_KEY}}
34-
github-gopass-ci-token: ${{secrets.GOPASS_CI_GITHUB_TOKEN}}
35-
patterns: pypi docker
36-
if: env.HAS_SECRETS == 'HAS_SECRETS'
37-
3831
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
3932
- run: python3 -m pip install --requirement=ci/requirements.txt
4033

.github/workflows/rebuild.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
schedule:
55
- cron: 30 2 * * *
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
rebuild:
912
name: Rebuild

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ repos:
104104
hooks:
105105
- id: shellcheck
106106
- repo: https://github.com/python-jsonschema/check-jsonschema
107-
rev: 0.37.4
107+
rev: 0.38.0
108108
hooks:
109109
- id: check-github-actions
110110
- id: check-github-workflows
@@ -121,7 +121,7 @@ repos:
121121
hooks:
122122
- id: ripsecrets
123123
- repo: https://github.com/astral-sh/ruff-pre-commit
124-
rev: v0.16.1
124+
rev: v0.16.2
125125
hooks:
126126
- id: ruff-format
127127
- repo: https://github.com/prospector-dev/prospector
@@ -140,8 +140,8 @@ repos:
140140
additional_dependencies:
141141
- prospector-profile-duplicated==1.12.0 # pypi
142142
- prospector-profile-utils==1.27.0 # pypi
143-
- pylint[spelling]==4.0.6 # pypi
144-
- ruff==0.16.1 # pypi
143+
- pylint[spelling]==4.0.7 # pypi
144+
- ruff==0.16.2 # pypi
145145
- id: prospector
146146
args:
147147
- --die-on-tool-error
@@ -150,8 +150,8 @@ repos:
150150
- --profile=utils:pre-commit
151151
additional_dependencies:
152152
- prospector-profile-utils==1.27.0 # pypi
153-
- ruff==0.16.1 # pypi
154-
- pylint[spelling]==4.0.6 # pypi
153+
- ruff==0.16.2 # pypi
154+
- pylint[spelling]==4.0.7 # pypi
155155
- repo: https://github.com/sbrunner/jsonschema-validator
156156
rev: 1.0.0
157157
hooks:
@@ -163,7 +163,7 @@ repos:
163163
|jsonschema\-gentypes\.yaml
164164
)$
165165
- repo: https://github.com/renovatebot/pre-commit-hooks
166-
rev: 44.14.3
166+
rev: 44.17.2
167167
hooks:
168168
- id: renovate-config-validator
169169
- repo: https://github.com/sbrunner/python-versions-hook

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
- Fix PostgreSQL admin retry action so it requeues only errored meta tiles instead of restarting full queue seeding for the whole job.
3939
- Add Python 3.14 support and use the PyPI Mapnik bindings instead of the removed Ubuntu `python3-mapnik` package.
4040
- Mark PostgreSQL metatile queue entries as `error` (instead of deleting them) when a child tile fails during write/store, so generation failures are visible in job status.
41+
- Allow PostgreSQL queue workers to pick meta-tiles from any started job when the current job has only pending meta-tiles, so workers are not blocked waiting for other workers to finish.
4142

4243
Environment variable migration (legacy -> new)
4344

poetry.lock

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ version = "0.0.0"
2323
[tool.poetry.dependencies]
2424
# Minimal version should also be set in the jsonschema-gentypes.yaml file
2525
python = ">=3.12,<3.15"
26-
c2casgiutils = { version = "0.14.0", extras = ["all"] }
26+
c2casgiutils = { version = "0.13.4", extras = ["all"] }
2727
fastapi = {extras = ["standard"], version = "0.141.1"}
2828
python-dateutil = "2.9.0.post0"
2929
tilecloud = { version = "1.13.5", extras = ["azure", "aws", "redis", "wsgi"] }
@@ -43,7 +43,7 @@ sqlalchemy = { version = "2.0.51", extras = ["asyncio"] }
4343
anyio = "4.14.2"
4444
asyncpg = "0.31.0"
4545
html-sanitizer = "2.6.0"
46-
pydantic-settings = "2.14.2"
46+
pydantic-settings = "2.15.0"
4747
mapnik = "4.3.0"
4848
prometheus-fastapi-instrumentator = "8.1.0"
4949

@@ -61,8 +61,8 @@ types-requests = "2.33.0.20260712"
6161
pytest-asyncio = "1.4.0"
6262
pytest-check = "2.9.1"
6363
types-pyyaml = "6.0.12.20260724"
64-
ruff = "0.16.1"
65-
pylint = "4.0.6"
64+
ruff = "0.16.2"
65+
pylint = "4.0.7"
6666

6767
[tool.poetry-dynamic-versioning]
6868
enable = true

tilecloud_chain/store/postgresql.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -729,14 +729,7 @@ async def list(self) -> AsyncIterator[Tile]:
729729

730730
if self.jobs:
731731
config_filename = None
732-
try:
733-
config_filename = next(iter(self.jobs))
734-
except StopIteration:
735-
pass
736-
737-
if config_filename is None:
738-
continue
739-
job_id = self.jobs.pop(config_filename)
732+
job_id = None
740733
try:
741734
if settings.postgresql.objgraph_postgresql:
742735
for generation in range(3):
@@ -753,13 +746,15 @@ async def list(self) -> AsyncIterator[Tile]:
753746
async with self.SessionMaker() as session:
754747
result = await session.execute(
755748
select(Queue)
749+
.join(Job, Queue.job_id == Job.id)
756750
.with_for_update(of=Queue, skip_locked=True)
757-
.order_by(Queue.id.asc())
758-
.where(and_(Queue.status == _STATUS_CREATED, Queue.job_id == job_id)),
751+
.order_by(Job.created_at.asc(), Queue.id.asc())
752+
.where(and_(Queue.status == _STATUS_CREATED, Job.status == _STATUS_STARTED)),
759753
)
760754
sqlalchemy_tile = result.scalar()
761755
if sqlalchemy_tile is None:
762756
continue
757+
job_id = sqlalchemy_tile.job_id
763758
sqlalchemy_tile.status = _STATUS_PENDING
764759
now = datetime.datetime.now(tz=datetime.UTC)
765760
sqlalchemy_tile.started_at = now
@@ -779,10 +774,14 @@ async def list(self) -> AsyncIterator[Tile]:
779774
postgresql_id=sqlalchemy_tile.id,
780775
)
781776
await session.commit()
777+
config_filename = next(
778+
(k for k, v in self.jobs.items() if v == job_id),
779+
None,
780+
)
782781
yield meta_tile
783782
except Exception: # pylint: disable=broad-except
784783
_LOGGER.exception("Error while reading from Postgres")
785-
_READ_ERROR_COUNTER.labels(job_id, config_filename).inc()
784+
_READ_ERROR_COUNTER.labels(job_id or -1, config_filename or "unknown").inc()
786785
await asyncio.sleep(1)
787786

788787
async def put_one(self, tile: Tile) -> Tile:

tilecloud_chain/tests/test_postgresql.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,3 +363,52 @@ async def test_controller_status_postgresql(SessionMaker: sessionmaker) -> None:
363363
session.query(Job).filter(Job.id == job_id).delete()
364364
session.commit()
365365
await gene.close()
366+
367+
368+
@pytest.mark.asyncio
369+
async def test_list_picks_next_job_when_first_job_has_only_pending_metatiles(
370+
SessionMaker: sessionmaker,
371+
tilestore: PostgresqlTileStore,
372+
):
373+
"""When a job has only pending meta-tiles, list() should pick from the next job."""
374+
with SessionMaker() as session:
375+
for job in session.query(Job).filter(Job.name.in_(["test-job-1", "test-job-2"])).all():
376+
session.delete(job)
377+
session.commit()
378+
379+
await tilestore.create_job("test-job-1", "generate-tiles", Path("config.yaml"))
380+
await tilestore.create_job("test-job-2", "generate-tiles", Path("config.yaml"))
381+
382+
with SessionMaker() as session:
383+
job1 = session.query(Job).filter(Job.name == "test-job-1").one()
384+
job2 = session.query(Job).filter(Job.name == "test-job-2").one()
385+
job1.status = _STATUS_STARTED
386+
job2.status = _STATUS_STARTED
387+
job1_id = job1.id
388+
job2_id = job2.id
389+
session.commit()
390+
391+
await tilestore.put_one(
392+
Tile(TileCoord(0, 0, 0), metadata={"job_id": job1_id}),
393+
)
394+
await tilestore.put_one(
395+
Tile(TileCoord(1, 0, 0), metadata={"job_id": job2_id}),
396+
)
397+
await tilestore.close()
398+
399+
with SessionMaker() as session:
400+
session.query(Queue).filter(Queue.job_id == job1_id).update(
401+
{Queue.status: _STATUS_PENDING},
402+
)
403+
session.commit()
404+
405+
await tilestore._maintenance()
406+
407+
tile = await anext(tilestore.list())
408+
assert tile.tilecoord.z == 1
409+
assert tile.metadata["job_id"] == job2_id
410+
411+
with SessionMaker() as session:
412+
session.query(Queue).filter(Queue.job_id.in_([job1_id, job2_id])).delete()
413+
session.query(Job).filter(Job.id.in_([job1_id, job2_id])).delete()
414+
session.commit()

tilecloud_chain/views/admin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import pyproj
4343
from c2casgiutils import auth
4444
from c2casgiutils import config as c2c_config
45-
from c2casgiutils.config import GitHubAccessType
4645
from fastapi import Depends, FastAPI, Form, HTTPException, Query, Request
4746
from fastapi.responses import HTMLResponse
4847
from fastapi.templating import Jinja2Templates
@@ -109,12 +108,11 @@ async def _get_access(
109108
return True
110109

111110
auth_config = config.config.get("authentication", {})
112-
github_access_type = auth_config.get("github_access_type", "pull")
113111
return await auth.check_access_config(
114112
auth_info,
115113
auth.AuthConfig(
116114
github_repository=auth_config.get("github_repository", ""),
117-
github_access_type_admin=GitHubAccessType(github_access_type),
115+
github_access_type=auth_config.get("github_access_type", ""),
118116
),
119117
)
120118

0 commit comments

Comments
 (0)