[ckan-dev] Adding a resource using a background task

Adrià Mercader adria.mercader at okfn.org
Mon Sep 9 09:23:38 UTC 2013


Hi Pabitra,

Although I vaguely remember finding this error a while ago and that
there was a workaround for fixing it, I think you will be better of if
instead of calling the action directly from your background task (ie
with get_action) you call your CKAN instance api (ie POST
http://ckaninstance.com/api/action/resource_create). At least that's
the way the celery processes I'm aware of work. See eg ckanext-qa and
ckanext-archiver:

https://github.com/okfn/ckanext-qa/blob/master/ckanext/qa/tasks.py
https://github.com/okfn/ckanext-archiver/blob/master/ckanext/archiver/tasks.py


Adrià

On 6 September 2013 00:22, Pabitra Dash <pkdash_reena at hotmail.com> wrote:
> Hi  all,
>
> I am trying to add a resource (a file) using the action method
> "resource_create" in a celery based background task. I am getting the
> following error:
>
> TypeError: No object (name:translator) has not been registered for this
> thread.
>
> Not sure how to resolve this error. Any help would be appreciated.
>
> Pabitra
>
>
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>




More information about the ckan-dev mailing list