Skip to content

Commit

Permalink
Create a command line script for the publishing job
Browse files Browse the repository at this point in the history
  • Loading branch information
marksparkza committed Oct 25, 2022
1 parent d74df30 commit e787d2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
12 changes: 12 additions & 0 deletions bin/publish
Original file line number Diff line number Diff line change
@@ -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()
13 changes: 1 addition & 12 deletions odp/catalog/main.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -26,7 +19,7 @@
}


def main():
def publish():
logger.info('PUBLISHING STARTED')
try:
for catalog_id in Session.execute(select(Catalog.id)).scalars():
Expand All @@ -37,7 +30,3 @@ def main():

except Exception as e:
logger.critical(f'PUBLISHING ABORTED: {str(e)}')


if __name__ == '__main__':
main()

0 comments on commit e787d2a

Please sign in to comment.