Changeset 8269


Ignore:
Timestamp:
20/04/12 10:40:54 (7 years ago)
Author:
mnagni
Message:

Complete - # 22434: CEDA Observation - keywords (following Gemini method)
 http://team.ceda.ac.uk/trac/ceda/ticket/22434

Location:
mauRepo/MolesManager/trunk/src/libs/migration
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/libs/migration/MigrationEPB.py

    r8254 r8269  
    5454    def getAllDeploymentsMigrationByDataEntitySortedByDate(self, dataEntity, deploymentNames, session = None): 
    5555        intSession = MigrationEPB._getSession(session) 
    56         return EPB.getAllObjects(DeploymentsMigration, intSession).filter(*[EPB.buildFilter('doc_owner', dataEntity.doc_owner)]).filter(DeploymentsMigration.doc_name.in_(deploymentNames)).order_by(asc("doc_creation"))         
     56        return EPB.getAllObjects(DeploymentsMigration, intSession).filter(DeploymentsMigration.doc_name.in_(deploymentNames)).order_by(asc("doc_creation"))         
     57        #return EPB.getAllObjects(DeploymentsMigration, intSession).filter(*[EPB.buildFilter('doc_owner', dataEntity.doc_owner)]).filter(DeploymentsMigration.doc_name.in_(deploymentNames)).order_by(asc("doc_creation"))         
    5758        #return EPB.getAllObjects(DeploymentsMigration, intSession).filter(*[EPB.buildFilter('doc_status', dataEntity.doc_status)]).filter(*[EPB.buildFilter('doc_owner', dataEntity.doc_owner)]).filter(DeploymentsMigration.doc_name.in_(deploymentNames)).order_by(asc("doc_creation")) 
    5859 
     
    6061    def _getMigrationObject(self, mo_type, doc_status, doc_owner, doc_name, session = None): 
    6162        intSession = MigrationEPB._getSession(session) 
    62         return intSession.query(mo_type).filter(*[EPB.buildFilter('doc_status', doc_status)]).filter(*[EPB.buildFilter('doc_owner', doc_owner)]).filter(*[EPB.buildFilter('doc_name', doc_name)]).first() 
     63        return intSession.query(mo_type).filter(*[EPB.buildFilter('doc_name', doc_name)]).first() 
     64        #return intSession.query(mo_type).filter(*[EPB.buildFilter('doc_owner', doc_owner)]).filter(*[EPB.buildFilter('doc_name', doc_name)]).first()         
     65        #return intSession.query(mo_type).filter(*[EPB.buildFilter('doc_status', doc_status)]).filter(*[EPB.buildFilter('doc_owner', doc_owner)]).filter(*[EPB.buildFilter('doc_name', doc_name)]).first() 
    6366 
    6467    @classmethod 
  • mauRepo/MolesManager/trunk/src/libs/migration/exception/exceptions.py

    r8258 r8269  
    66 
    77def migrationObjectDescription(migrationObject): 
     8    if migrationObject is None: 
     9        raise Exception("Migration object is None") 
    810    try: 
    911        return "%s %s %s" % (migrationObject.doc_status, migrationObject.doc_owner, migrationObject.doc_name) 
    10     except (Exception, RuntimeError) as ex: 
     12    except Exception as ex: 
    1113        print ex 
    1214 
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/commons.py

    r8266 r8269  
    452452            try: 
    453453                linkLongName = link['href'].split('/')[-1] 
    454                 linkName = linkLongName.rsplit('__ATOM__')[1] 
     454                if '__ATOM__' in linkLongName: 
     455                    linkName = linkLongName.rsplit('__ATOM__')[1] 
     456                else: 
     457                    linkName = linkLongName 
    455458                dpt.append(linkName) 
    456459            except Exception as ex: 
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/dataEntity.py

    r8266 r8269  
    2727    log = logging.getLogger('DataEntityProcessor') 
    2828    log.addHandler(StreamHandler()) 
    29     log.setLevel(logging.DEBUG 
     29    log.setLevel(logging.INFO 
    3030    ''' 
    3131        Processes a DataEntityMigration item. Note that each DataEntity is associated to a "dataent_xxxx" file in Moles2 
     
    110110        ceda_guid.ceda_observationcollection = ceda_observationCollection.id 
    111111        Moles3EPB.addCedaObject(ceda_guid, self.migrationSessions.molesSession, True) 
     112        DataEntityProcessor.log.info("GUI for this ObservationCollection: %s" % (ceda_guid.id)) 
    112113         
    113114        return ceda_observationCollection 
     
    132133             
    133134            deProcessor.assignDOI(ceda_observation, doi) 
    134             if doi: 
    135                 DataEntityProcessor.log.info("DOI: %s" % (doi['href'][4:])) 
     135                 
    136136 
    137137            self.migrationSessions.molesSession.commit() 
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/deployment.py

    r8266 r8269  
    5959    log = logging.getLogger('DeploymentProcessor') 
    6060    log.addHandler(StreamHandler()) 
    61     log.setLevel(logging.DEBUG)     
     61    log.setLevel(logging.INFO)     
    6262    def __init__(self, dataEntityMigration, deploymentMigration, migrationSessions): 
    6363        ''' 
     
    176176             
    177177            if tmp_auth['author'] == 'unknown': 
    178                 DeploymentProcessor.log.info("%s %s %s has unknown author" \ 
     178                DeploymentProcessor.log.debug("%s %s %s has unknown author" \ 
    179179                                             % (whereAreAuthors.doc_status, whereAreAuthors.doc_owner, whereAreAuthors.doc_name))         
    180180                   
     
    339339            cited_responsible = createCI_ResponsibleParty(role=CI_RoleCode.cl_publisher, \ 
    340340                                                              organizationName='NERC - British Atmospheric Data Centre') 
    341             if doi == '10.5285/E8F43A51-0198-4323-A926-FE69225D57DD': 
     341            if doi.upper() == '10.5285/E8F43A51-0198-4323-A926-FE69225D57DD': 
    342342                py_date = date(2011, 4, 1) 
    343             elif doi == '10.5285/78114093-E2BD-4601-8AE5-3551E62AEF2B': 
     343            elif doi.upper() == '10.5285/78114093-E2BD-4601-8AE5-3551E62AEF2B': 
    344344                py_date = date(2011, 11, 29)                 
    345             elif doi == '10.5285/DB8D8981-1A51-4D6E-81C0-CCED9B921390': 
     345            elif doi.upper() == '10.5285/DB8D8981-1A51-4D6E-81C0-CCED9B921390': 
    346346                py_date = date(2012, 4, 16) 
    347             elif doi == '10.5285/639A3714-BC74-46A6-9026-64931F355E07': 
     347            elif doi.upper() == '10.5285/639A3714-BC74-46A6-9026-64931F355E07': 
    348348                py_date = date(2012, 4, 16)                 
    349349                 
     
    353353                i_authority = createCI_Citation("DOI", date = ci_date) 
    354354                identifier = createMD_Identifier(code = doi, authority=i_authority)              
    355                 observation.identifier.append(identifier)                                      
     355                observation.identifier.append(identifier) 
     356                DeploymentProcessor.log.info("DOI: %s" % (doi['href'][4:]))                                   
    356357 
    357358    def _assignPublisherCurator(self, observation):         
     
    502503        ceda_guid.ceda_observation = ceda_observation.id 
    503504        Moles3EPB.addCedaObject(ceda_guid, self._migrationSessions.molesSession, True) 
     505        DeploymentProcessor.log.info("GUI for this Observation: %s" % (ceda_guid.id)) 
    504506         
    505507        return ceda_observation 
Note: See TracChangeset for help on using the changeset viewer.