Ignore:
Timestamp:
16/04/08 10:39:19 (11 years ago)
Author:
selatham
Message:

gather required utilities. improve elementree imports in keywordAdder. put host etc in arguments for oai_ingest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/trunk/ingestAutomation/OAIBatch/oai_ingest.py

    r3777 r3785  
    11#!/usr/bin/env python 
    2 """ Script oai_ingest.py takes parameters <datacentre> <dbinfofile>. 
     2""" Script oai_ingest.py takes parameters <datacentre> <dbinfofile> <existhost> <backupdir>. 
    33The /usr/local/WSClients/OAIBatch directory contains:- 
    44 - this python script, plus some other modules eg ndgUtils for parts of the process. 
     
    3030import string 
    3131import SpaceTimeIngestFromMOLES 
    32 import SpaceTimeIngestPostgisFromMOLES 
    3332import keywordAdder 
    3433from SchemaNameSpace import SchemaNameSpace 
     
    6564NDG_dataProvider = False 
    6665 
    67 if (len(sys.argv) < 3): 
    68     print "ERROR: <datacentre> or <db info file> parameter not supplied." 
     66if (len(sys.argv) < 5): 
     67    print "ERROR: <datacentre> or <db info file> or <existhost> or <backupdir> parameter not supplied." 
    6968    sys.exit() 
    7069else: 
    7170    datacentre = sys.argv[1] 
    7271    dbinfoname = sys.argv[2] 
     72    existhost = sys.argv[3] 
     73    # The directory to put things for a tape backup (should already exist) 
     74    backupdir = sys.argv[4] 
     75    #backupdir = '/disks/glue1/oaiBackup/' 
    7376 
    7477#Change os directory to that with the code in it. 
     
    8487#Xquery settings 
    8588xq=ndgXqueries() 
    86 xmldb=ndg_eXist(db='glue.badc.rl.ac.uk') 
     89xmldb=ndg_eXist(db=existhost) 
    8790 
    8891# Get the harvested records directory and groups for this datacentre from the datacentre specific config file 
     
    136139    sys.exit() 
    137140 
    138 # get the db access info 
    139 host ='glue.badc.rl.ac.uk' 
     141# get the exist db access info 
     142#host ='glue.badc.rl.ac.uk' 
    140143dbaccess={} 
    141144dbinfo_file=open(dbinfoname,"r") 
     
    147150dbinfo_file.close() 
    148151#print dbaccess 
    149 db_admin = dbaccess[(host,'admin')][0] 
     152db_admin = dbaccess[(existhost,'admin')][0] 
    150153#print db_admin 
    151  
    152 # The directory to put things for a tape backup (should already exist) 
    153 backupdir = '/disks/glue1/oaiBackup/' 
    154154 
    155155# Create/clear the 'in' directory pristine copy of the discovery records 
     
    266266targetCollection = "/db/discovery/original/"+datacentre_format+ "/" +datacentre_namespace 
    267267if datacentre_format == 'DIF': 
    268     ndgDir=ndgDirectory(targetCollection,host,docType='DIF') 
     268    ndgDir=ndgDirectory(targetCollection,existhost,docType='DIF') 
    269269    #print ndgDir.members 
    270270else: 
     
    326326SpaceTimeIngestFromMOLES.main("./FINALMOLES") 
    327327 
    328 #Extract the spatiotemporal info and put into NEW postgis tables 
    329 #SpaceTimeIngestPostgisFromMOLES.main("./FINALMOLES") 
    330  
    331328#Make copies of discovery and oai/originals and DIF2MOLES areas to backup area for tape backups 
    332329this_backupdir = backupdir + datacentre + "_" + date_string + "_originals" 
Note: See TracChangeset for help on using the changeset viewer.