Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problems with flask and celery
#1
Question 
def make_celery(app):
    celery = Celery(
        app.import_name,
        backend=app.config['CELERY_RESULT_BACKEND'],
        broker=app.config['CELERY_BROKER_URL']
    )
    celery.conf.update(app.config)

    class ContextTask(celery.Task):
        def __call__(self, *args, **kwargs):
            with app.app_context():
                return self.run(*args, **kwargs)

    celery.Task = ContextTask
    return celery


app = Flask(__name__)
app.config['CELERY_BROKER_URL'] = 'redis://localhost:6379/0'
app.config['CELERY_RESULT_BACKEND'] = 'redis://localhost:6379/0'
app.secret_key = '6969'
api = Api(app)
celery = Celery(app.name, broker=app.config['CELERY_BROKER_URL'])
celery.conf.update(app.config)
@celery.task
def send():
  p = subprocess.run(['python3 calc.py'], cwd=r"/var/www/webApp/webApp/", shell=True,stdin=None, stdout=None, stderr=None, close_fds=True)
  return
my issue and the only error i can see to access: Object of type 'module' is not JSON serializable

anyone help?
Reply
#2
Please show complete and unaltered error traceback (surrounded by bbcode error tags).
This traceback contains important information useful for debugging.
Reply
#3
(Apr-28-2021, 10:26 AM)Larz60+ Wrote: Please show complete and unaltered error traceback (surrounded by bbcode error tags).
This traceback contains important information useful for debugging.

the problem is i cant get a traceback. celery handles the error and outputs the error i stated
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020