Skip to content

Commit

Permalink
refactor Job
Browse files Browse the repository at this point in the history
move fail_reason into Job definition

Bump aiohttp from 3.9.4 to 3.10.2

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.4 to 3.10.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.4...v3.10.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

Convert min_confidence param to string to appease mypy

docker-compose 'version' has been deprecated

remove unused TextField import
  • Loading branch information
hughrun committed Oct 20, 2024
1 parent b109258 commit d3b689b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bookwyrm/connectors/abstract_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def get_results(
),
"User-Agent": USER_AGENT,
}
params = {"min_confidence": min_confidence}
params = {"min_confidence": str(min_confidence)}
try:
async with session.get(url, headers=headers, params=params) as response:
if not response.ok:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 4.2.15 on 2024-10-20 22:29

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0210_userrelationshipimport_and_more"),
]

operations = [
migrations.RemoveField(
model_name="userimportbook",
name="fail_reason",
),
migrations.RemoveField(
model_name="userimportpost",
name="fail_reason",
),
migrations.RemoveField(
model_name="userrelationshipimport",
name="fail_reason",
),
migrations.AddField(
model_name="childjob",
name="fail_reason",
field=models.TextField(null=True),
),
migrations.AddField(
model_name="parentjob",
name="fail_reason",
field=models.TextField(null=True),
),
]
4 changes: 0 additions & 4 deletions bookwyrm/models/bookwyrm_import_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
ForeignKey,
FileField,
JSONField,
TextField,
TextChoices,
PROTECT,
SET_NULL,
Expand Down Expand Up @@ -95,7 +94,6 @@ class UserImportBook(ChildJob):

book = ForeignKey(models.Book, on_delete=SET_NULL, null=True, blank=True)
book_data = JSONField(null=False)
fail_reason = TextField(null=True)

def start_job(self):
"""Start the job"""
Expand All @@ -119,7 +117,6 @@ class StatusType(TextChoices):
status_type = models.fields.CharField(
max_length=10, choices=StatusType.choices, default=StatusType.COMMENT, null=True
)
fail_reason = TextField(null=True)

def start_job(self):
"""Start the job"""
Expand All @@ -139,7 +136,6 @@ class RelationshipType(TextChoices):
max_length=10, choices=RelationshipType.choices, null=True
)
remote_id = models.fields.RemoteIdField(null=True, unique=False)
fail_reason = TextField(null=True)

def start_job(self):
"""Start the job"""
Expand Down
1 change: 1 addition & 0 deletions bookwyrm/models/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Status(models.TextChoices):
status = models.CharField(
max_length=50, choices=Status.choices, default=Status.PENDING, null=True
)
fail_reason = models.TextField(null=True)

class Meta:
"""Make it abstract"""
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
nginx:
image: nginx:1.25.2
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp==3.9.4
aiohttp==3.10.2
bleach==6.1.0
boto3==1.34.74
bw-file-resubmit==0.6.0rc2
Expand Down

0 comments on commit d3b689b

Please sign in to comment.