Exemple #1
0
    def test_process_package(self):
        pkg = {
            'notes':
            'Test',
            'license_id':
            'uk-ogl',
            'extras': [{
                'key': 'UKLP',
                'value': 'True'
            }],
            'resources': [{
                'url':
                'http://environment.data.gov.uk/ds/wms?SERVICE=WMS&INTERFACE=ENVIRONMENT--6f51a299-351f-4e30-a5a3-2511da9688f7',
                'description': 'Resource locator',
            }]
        }
        pkg = factories.Dataset(**pkg)

        process_package_(pkg['id'])

        pkg = helpers.call_action('package_show', id=pkg['id'])
        res = pkg['resources'][0]
        assert_equal(res['format'], 'WMS')
        assert_equal(res['wms_base_urls'],
                     'http://www.geostore.com/OGC/OGCInterface;jsessionid=')
    def test_process_package(self):
        pkg = {
            "notes": "Test",
            "license_id": "uk-ogl",
            "extras": [{"key": "UKLP", "value": "True"}],
            "resources": [
                {
                    "url": "http://environment.data.gov.uk/ds/wms?SERVICE=WMS&INTERFACE=ENVIRONMENT--6f51a299-351f-4e30-a5a3-2511da9688f7",
                    "description": "Resource locator",
                }
            ],
        }
        pkg = factories.Dataset(**pkg)

        process_package_(pkg["id"])

        pkg = helpers.call_action("package_show", id=pkg["id"])
        res = pkg["resources"][0]
        assert_equal(res["format"], "WMS")
        assert_equal(res["wms_base_urls"], "http://www.geostore.com/OGC/OGCInterface;jsessionid=")
def process_package(ckan_ini_filepath, package_id, queue='bulk'):
    '''
    Archive a package.
    '''
    load_config(ckan_ini_filepath)
    register_translator()

    log = process_package.get_logger()
    log.info('Starting gemini process_package task: package_id=%r queue=%s', package_id, queue)

    # Do all work in a sub-routine since it can then be tested without celery.
    # Also put try/except around it is easier to monitor ckan's log rather than
    # celery's task status.
    try:
        process_package_(package_id)
    except Exception, e:
        if os.environ.get('DEBUG'):
            raise
        # Any problem at all is logged and reraised so that celery can log it too
        log.error('Error occurred during gemini post-process of package: %s\nPackage: %r %r',
                  e, package_id, package['name'] if 'package' in dir() else '')
        raise
Exemple #4
0
def process_package(ckan_ini_filepath, package_id, queue='bulk'):
    '''
    Archive a package.
    '''
    load_config(ckan_ini_filepath)
    register_translator()

    log = process_package.get_logger()
    log.info('Starting gemini process_package task: package_id=%r queue=%s',
             package_id, queue)

    # Do all work in a sub-routine since it can then be tested without celery.
    # Also put try/except around it is easier to monitor ckan's log rather than
    # celery's task status.
    try:
        process_package_(package_id)
    except Exception, e:
        if os.environ.get('DEBUG'):
            raise
        # Any problem at all is logged and reraised so that celery can log it too
        log.error(
            'Error occurred during gemini post-process of package: %s\nPackage: %r %r',
            e, package_id, package['name'] if 'package' in dir() else '')
        raise