diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ # SWH Tarball Loader -The Software Heritage Tarball Loader is in charge of ingesting the -directory representation of the tarball into the Software Heritage -archive. +The Software Heritage Tarball Loader is in charge of ingesting the directory +representation of the tarball into the Software Heritage archive. -## Configuration +## Sample configuration -This is the loader's (or task's) configuration file. +The loader's configuration will be taken from the default configuration file: +`~/.config/swh/loader/tar.yml` (you can choose a different path by setting the +`SWH_CONFIG_FILENAME` environment variable). -*`{/etc/softwareheritage | ~/.config/swh | ~/.swh}`/loader/tar.yml*: +This file holds information for the loader to work, including celery +configuration: ```YAML working_dir: /home/storage/tmp/ @@ -16,11 +18,14 @@ cls: remote args: url: http://localhost:5002/ +celery: +task_modules: + - swh.loader.tar.tasks +task_queues: + - swh.loader.tar.tasks.LoadTarRepository ``` -## API - -### local +### Local Load local tarball directly from code or python3's toplevel: @@ -34,15 +39,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 +### 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 +56,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) ```