From e787d2a2be964e3a1923b7964242c413535a73ec Mon Sep 17 00:00:00 2001 From: Mark Jacobson <52427991+marksparkza@users.noreply.github.com> Date: Tue, 25 Oct 2022 17:51:43 +0200 Subject: [PATCH] Create a command line script for the publishing job --- bin/publish | 12 ++++++++++++ odp/catalog/main.py | 13 +------------ 2 files changed, 13 insertions(+), 12 deletions(-) create mode 100755 bin/publish diff --git a/bin/publish b/bin/publish new file mode 100755 index 0000000..17b13e7 --- /dev/null +++ b/bin/publish @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +import pathlib +import sys + +rootdir = pathlib.Path(__file__).parent.parent +sys.path.append(str(rootdir)) + +import odp.catalog.main + +if __name__ == '__main__': + odp.catalog.main.publish() diff --git a/odp/catalog/main.py b/odp/catalog/main.py index cade862..7160e68 100644 --- a/odp/catalog/main.py +++ b/odp/catalog/main.py @@ -1,14 +1,7 @@ -#!/usr/bin/env python - import logging -import pathlib -import sys from sqlalchemy import select -rootdir = pathlib.Path(__file__).parent.parent.parent.parent -sys.path.append(str(rootdir)) - from odp.catalog.datacite import DataCitePublisher from odp.catalog.saeon import SAEONPublisher from odp.const import ODPCatalog @@ -26,7 +19,7 @@ } -def main(): +def publish(): logger.info('PUBLISHING STARTED') try: for catalog_id in Session.execute(select(Catalog.id)).scalars(): @@ -37,7 +30,3 @@ def main(): except Exception as e: logger.critical(f'PUBLISHING ABORTED: {str(e)}') - - -if __name__ == '__main__': - main()