diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -18,7 +18,21 @@ url: http://localhost:5002/ ``` -## API +## Celery + +Load tarball using celery. + +Providing you have a properly configured celery up and running, the +celery worker configuration file needs to be updated: + +*`{/etc/softwareheritage | ~/.config/swh | ~/.swh}`/worker.yml*: + +``` YAML +task_modules: + - swh.loader.tar.tasks +task_queues: + - swh_loader_tar +``` ### local @@ -34,15 +48,14 @@ import logging logging.basicConfig(level=logging.DEBUG) -from swh.loader.tar.tasks import LoadTarRepository -l = LoadTarRepository() -l.run_task(origin=origin, visit_date=visit_date, - last_modified=last_modified) +from swh.loader.tar.tasks import load_tar +load_tar(origin=origin, visit_date=visit_date, + last_modified=last_modified) ``` ### remote -Load remote tarball is the same sample +Load remote tarball is the same sample: ```Python url = 'https://ftp.gnu.org/gnu/8sync/8sync-0.1.0.tar.gz' @@ -52,8 +65,7 @@ import logging logging.basicConfig(level=logging.DEBUG) -from swh.loader.tar.tasks import LoadTarRepository -l = LoadTarRepository() -l.run_task(origin=origin, visit_date=visit_date, - last_modified=last_modified) +from swh.loader.tar.tasks import load_tar +load_tar(origin=origin, visit_date=visit_date, + last_modified=last_modified) ```