# Copyright (C) 2014 Linaro Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""Tasks that should be run via Celery."""

from taskqueue.celery import app
from utils.subscription import send


@app.task(name='send-emails')
def send_emails(job_id):
    """Just a wrapper around the real `send` function.

    This is used to provide a Celery-task access to the underlying function.

    :param job_id: The job ID to trigger notifications for.
    """
    send(job_id)

@@ -797,16 +797,60 @@
 rt send%0A
+from utils.docimport import import_and_save%0A
 %0A%0A@app.t
@@ -1117,8 +1117,343 @@
 job_id)%0A
+%0A%0A@app.task(name='import-job')%0Adef import_job(json_obj):%0A    %22%22%22Just a wrapper around the real import function.%0A%0A    This is used to provide a Celery-task access to the import function.%0A%0A    :param json_obj: The JSON object with the values necessary to import the%0A                     job.%0A    %22%22%22%0A    return import_and_save(json_obj)%0A

Add new import task.