Skip to content

Commit

Permalink
run: serialize arguments for celery task
Browse files Browse the repository at this point in the history
  • Loading branch information
kpsherva committed Aug 27, 2024
1 parent 85d54b8 commit 5eb1349
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion invenio_jobs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class Job(db.Model, Timestamp):
active = db.Column(db.Boolean, default=True, nullable=False)
title = db.Column(db.String(255), nullable=False)
description = db.Column(db.Text)
# default_args = db.Column(JSON, default=lambda: dict(), nullable=True)
task = db.Column(db.String(255))
default_queue = db.Column(db.String(64))
schedule = db.Column(JSON, nullable=True)
Expand Down Expand Up @@ -208,3 +207,4 @@ def all(cls):
def get(cls, id_):
"""Get registered task by id."""
return cls(current_jobs.registry.get(id_))

3 changes: 2 additions & 1 deletion invenio_jobs/services/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""Service schemas."""

import inspect
import json
from copy import deepcopy
from datetime import timezone

Expand Down Expand Up @@ -248,5 +249,5 @@ def pick_args(self, obj, many, **kwargs):
"""Choose custom or default args."""
custom_args = obj.pop("custom_args")
if custom_args:
obj["args"] = custom_args
obj["args"] = json.loads(custom_args)
return obj

0 comments on commit 5eb1349

Please sign in to comment.