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

Set collection name to OcrdJob, fix test and update dependencies #38

Merged
merged 25 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
394438c
Set collection name to OcrdJob
markusweigelt Aug 24, 2023
ead77c4
Increasing the connection default timeout
markusweigelt Aug 25, 2023
b37b032
Increase connection timeout
markusweigelt Aug 25, 2023
a101d31
Update dependencies
markusweigelt Aug 25, 2023
398ea1b
Remove timeout parameter
markusweigelt Aug 25, 2023
b55d29e
Handle remote protokoll error
markusweigelt Aug 25, 2023
ff9c9ff
Ignore type exceptions
markusweigelt Aug 25, 2023
2c04de7
Reactor exception handling, using asyncio instead of time and change …
markusweigelt Aug 29, 2023
53de66d
Update test-ci.yml
markusweigelt Aug 29, 2023
d0507d4
Update _client.py
markusweigelt Aug 29, 2023
fa08c25
Update test-ci.yml
markusweigelt Aug 29, 2023
7a2ce0e
Cache workspaces based on last write time
SvenMarcus Aug 10, 2023
0c47fc6
Attempt to work with system time
SvenMarcus Aug 17, 2023
6c63a1f
Improved implementation to kill a job
markusweigelt Aug 17, 2023
e7939e5
Update jobs.html.j2
markusweigelt Aug 17, 2023
5de7c2f
Change error class
markusweigelt Aug 17, 2023
0251b60
Add OCR-D Manager settings to test settings
markusweigelt Aug 17, 2023
8208a91
Add ocrd manager to the test setting
markusweigelt Aug 17, 2023
3428270
Add ocrd manager to expected envs
markusweigelt Aug 17, 2023
5010d07
Remove unnecessary import
markusweigelt Aug 17, 2023
0199f28
merge main into branch
markusweigelt Aug 29, 2023
dd9e49e
Rename generic function to specific
markusweigelt Aug 24, 2023
24e4aa5
Fix mypy bugs
markusweigelt Aug 24, 2023
e8dda2c
resolve conflicts
markusweigelt Aug 29, 2023
c48156c
Merge branch 'main' into fix-ocrdjob
markusweigelt Aug 29, 2023
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
4 changes: 4 additions & 0 deletions .github/workflows/test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@ jobs:

- name: Testing using pytest
run: pdm run pytest tests

- name: Setup upterm session when failure
if: ${{ failure() }}
uses: lhotari/action-upterm@v1
12 changes: 10 additions & 2 deletions ocrdbrowser/_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import asyncio
import logging

from types import TracebackType
Expand Down Expand Up @@ -67,12 +68,19 @@ class HttpBrowserClient:
def __init__(self, address: str) -> None:
self.address = address

async def get(self, resource: str) -> bytes:
async def get(self, resource: str, retry: bool=True) -> bytes:
try:
async with httpx.AsyncClient(base_url=self.address) as client:

async with httpx.AsyncClient(
base_url=self.address
) as client:
response = await client.get(resource)
return response.content
except Exception as ex:
if isinstance(ex, httpx.RemoteProtocolError) and retry :
await asyncio.sleep(10)
return await self.get(resource, False)

logging.error(f"Tried to connect to {self.address}")
logging.error(f"Requested resource {resource}")
raise ConnectionError from ex
Expand Down
6 changes: 3 additions & 3 deletions ocrdmonitor/database/_initdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ async def init(connection_str: str, force_initialize: bool = False) -> None:

__initialized = True
connection_str = rebuild_connection_string(connection_str)
client: AsyncIOMotorClient = AsyncIOMotorClient(connection_str)
client.get_io_loop = asyncio.get_event_loop
client: AsyncIOMotorClient = AsyncIOMotorClient(connection_str) # type: ignore
client.get_io_loop = asyncio.get_event_loop # type: ignore
await init_beanie(
database=client.ocrd,
database=client.ocrd, # type: ignore
document_models=[BrowserProcess, MongoOcrdJob], # type: ignore
)

Expand Down
1 change: 1 addition & 0 deletions ocrdmonitor/database/_ocrdjobrepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class MongoOcrdJob(Document):
controller_address: str

class Settings:
name = "OcrdJob"
indexes = [
pymongo.IndexModel(
[
Expand Down
Loading