Skip to content

Commit

Permalink
Merge pull request #156 from SubstraFoundation/fix-celery-scheduler
Browse files Browse the repository at this point in the history
fix celery scheduler
  • Loading branch information
Kelvin-M authored Feb 18, 2020
2 parents 8cb2234 + 9c34449 commit 94c7778
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/backend/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@

@app.on_after_configure.connect
def setup_periodic_tasks(sender, **kwargs):
from substrapp.tasks.tasks import prepare_training_task, prepare_testing_task
from substrapp.tasks.tasks import (prepare_training_task,
prepare_testing_task,
prepare_aggregate_task,
prepare_composite_training_task)

period = int(os.environ.get('SCHEDULE_TASK_PERIOD', 3 * 3600))
sender.add_periodic_task(period, prepare_training_task.s(), queue='scheduler',
name='query Traintuples to prepare train task on todo traintuples')
sender.add_periodic_task(period, prepare_testing_task.s(), queue='scheduler',
name='query Testuples to prepare test task on todo testuples')
sender.add_periodic_task(period, prepare_aggregate_task.s(), queue='scheduler',
name='query Aggregatetuples to prepare task on todo aggregatetuples')
sender.add_periodic_task(period, prepare_composite_training_task.s(), queue='scheduler',
name='query CompositeTraintuples to prepare task on todo composite_traintuples')


@after_task_publish.connect
Expand Down
5 changes: 5 additions & 0 deletions backend/substrapp/tasks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ def prepare_testing_task():
prepare_task(TESTTUPLE_TYPE)


@app.task(ignore_result=True)
def prepare_composite_training_task():
prepare_task(COMPOSITE_TRAINTUPLE_TYPE)


@app.task(ignore_result=True)
def prepare_aggregate_task():
prepare_task(AGGREGATETUPLE_TYPE)
Expand Down

0 comments on commit 94c7778

Please sign in to comment.