示例#1
0
文件: util.py 项目: rmallof/aleph
    def create_app(self):
        oauth.remote_apps = {}

        # The testing configuration is inferred from the production
        # settings, but it can only be derived after the config files
        # have actually been evaluated.
        sls.REDIS_URL = None
        sls.WORKER_THREADS = None
        ftms.DATABASE_URI = "sqlite:///%s/ftm.store" % self.temp_dir
        settings.APP_NAME = APP_NAME
        settings.TESTING = True
        settings.DEBUG = True
        settings.CACHE = True
        settings.OAUTH = False
        settings.SECRET_KEY = "batman"
        settings.APP_UI_URL = UI_URL
        settings.ARCHIVE_TYPE = "file"
        settings.ARCHIVE_PATH = self.temp_dir
        settings.DATABASE_URI = DB_URI
        settings.ALEPH_PASSWORD_LOGIN = True
        settings.MAIL_SERVER = None
        settings.INDEX_PREFIX = APP_NAME
        settings.INDEX_WRITE = "yolo"
        settings.INDEX_READ = [settings.INDEX_WRITE]
        settings.TAG_ENTITIES = True
        settings._gcp_logger = None
        app = create_app({})
        return app
示例#2
0
    def create_app(self):
        oauth.remote_apps = {}

        # The testing configuration is inferred from the production
        # settings, but it can only be derived after the config files
        # have actually been evaluated.
        settings.APP_NAME = APP_NAME
        settings.TESTING = True
        settings.DEBUG = True
        settings.CACHE = True
        settings.EAGER = True
        settings.SECRET_KEY = 'batman'
        settings.APP_UI_URL = UI_URL
        settings.ARCHIVE_TYPE = 'file'
        settings.ARCHIVE_PATH = self.temp_dir
        settings.DATABASE_URI = DB_URI
        settings.ALEPH_PASSWORD_LOGIN = True
        settings.MAIL_SERVER = None
        settings.ENTITIES_SERVICE = None
        settings.ENTITIES_INDEX = '%s_entity' % APP_NAME
        settings.ENTITIES_INDEX_SET = [settings.ENTITIES_INDEX]
        settings.RECORDS_INDEX = '%s_records' % APP_NAME
        settings.RECORDS_INDEX_SET = [settings.RECORDS_INDEX]
        settings.COLLECTIONS_INDEX = '%s_collection' % APP_NAME
        settings.REDIS_URL = None
        app = create_app({})
        mount_app_blueprints(app)
        return app
示例#3
0
文件: util.py 项目: pudo/aleph
    def create_app(self):
        oauth.remote_apps = {}

        # The testing configuration is inferred from the production
        # settings, but it can only be derived after the config files
        # have actually been evaluated.
        settings.APP_NAME = APP_NAME
        settings.TESTING = True
        settings.DEBUG = True
        settings.CACHE = True
        settings.EAGER = True
        settings.SECRET_KEY = 'batman'
        settings.APP_UI_URL = UI_URL
        settings.ARCHIVE_TYPE = 'file'
        settings.ARCHIVE_PATH = self.temp_dir
        settings.DATABASE_URI = DB_URI
        settings.ALEPH_PASSWORD_LOGIN = True
        settings.MAIL_SERVER = None
        settings.ENTITIES_SERVICE = None
        settings.INDEX_PREFIX = APP_NAME
        settings.INDEX_WRITE = 'yolo'
        settings.INDEX_READ = [settings.INDEX_WRITE]
        settings.REDIS_URL = None
        settings._gcp_logger = None
        app = create_app({})
        mount_app_blueprints(app)
        return app
示例#4
0
    def create_app(self):
        oauth.remote_apps = {}

        # The testing configuration is inferred from the production
        # settings, but it can only be derived after the config files
        # have actually been evaluated.
        settings.APP_NAME = APP_NAME
        settings.TESTING = True
        settings.DEBUG = True
        settings.CACHE = True
        settings.EAGER = True
        settings.SECRET_KEY = 'batman'
        settings.APP_UI_URL = UI_URL
        settings.ARCHIVE_TYPE = 'file'
        settings.ARCHIVE_PATH = self.temp_dir
        settings.DATABASE_URI = DB_URI
        settings.ALEPH_PASSWORD_LOGIN = True
        settings.MAIL_SERVER = None
        settings.ENTITIES_SERVICE = None
        settings.INDEX_PREFIX = APP_NAME
        settings.INDEX_WRITE = 'yolo'
        settings.INDEX_READ = [settings.INDEX_WRITE]
        settings.REDIS_URL = None
        settings._gcp_logger = None
        app = create_app({})
        mount_app_blueprints(app)
        return app
示例#5
0
 def create_app(self):
     self.temp_dir = mkdtemp()
     oauth.remote_apps = {}
     app_name = 'aleph_test_name'
     app = create_app({
         'DEBUG':
         True,
         'TESTING':
         True,
         'CACHE':
         True,
         'SECRET_KEY':
         'batman',
         'ARCHIVE_TYPE':
         'file',
         'ARCHIVE_PATH':
         self.temp_dir,
         'APP_NAME':
         app_name,
         'PRESERVE_CONTEXT_ON_EXCEPTION':
         False,
         'SQLALCHEMY_DATABASE_URI':
         (os.environ.get('ALEPH_DATABASE_URI') + '_test'),
         'ELASTICSEARCH_INDEX':
         (os.environ.get('ELASTICSEARCH_INDEX', app_name) + '_test'),
         'CELERY_ALWAYS_EAGER':
         True
     })
     mount_app_blueprints(app)
     return app
示例#6
0
文件: util.py 项目: tomjie/aleph
 def create_app(self):
     self.temp_dir = mkdtemp()
     app = create_app({
         'DEBUG': True,
         'TESTING': True,
         'CACHE': True,
         'SECRET_KEY': 'batman',
         'ARCHIVE_TYPE': 'file',
         'ARCHIVE_PATH': self.temp_dir,
         'APP_NAME': 'aleph_test_name',
         'PRESERVE_CONTEXT_ON_EXCEPTION': False,
         'CELERY_ALWAYS_EAGER': True
     })
     mount_app_blueprints(app)
     return app
示例#7
0
 def create_app(self):
     self.temp_dir = mkdtemp()
     app = create_app({
         'DEBUG': True,
         'TESTING': True,
         'CACHE': True,
         'SECRET_KEY': 'batman',
         'ARCHIVE_TYPE': 'file',
         'ARCHIVE_PATH': self.temp_dir,
         'APP_NAME': 'aleph_test_name',
         'PRESERVE_CONTEXT_ON_EXCEPTION': False,
         'CELERY_ALWAYS_EAGER': True
     })
     mount_app_blueprints(app)
     return app
示例#8
0
    def create_app(self):
        oauth.remote_apps = {}

        # The testing configuration is inferred from the production
        # settings, but it can only be derived after the config files
        # have actually been evaluated.
        settings.APP_NAME = APP_NAME
        settings.TESTING = True
        settings.DEBUG = True
        settings.CACHE = True
        settings.SECRET_KEY = 'batman'
        settings.APP_UI_URL = UI_URL
        settings.ARCHIVE_TYPE = 'file'
        settings.ARCHIVE_PATH = self.temp_dir
        settings.DATABASE_URI = DB_URI
        settings.QUEUE = False
        settings.MAIL_SERVER = None
        app = create_app({})
        mount_app_blueprints(app)
        return app
示例#9
0
from aleph.analyze import install_analyzers
from aleph.ingest import ingest_document
from aleph.index import delete_index, upgrade_search
from aleph.index import index_document_id
from aleph.logic import reindex_entities, delete_collection, process_collection
from aleph.logic import update_collection
from aleph.logic.alerts import check_alerts
from aleph.logic.bulk import bulk_load
from aleph.logic.xref import xref_collection
from aleph.util import load_config_file


log = logging.getLogger('aleph')
flask_script_commands.text_type = str

app = create_app()
mount_app_blueprints(app)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
manager.add_command('routes', ShowUrls)


@manager.command
def collections():
    """List all collections."""
    for collection in Collection.all():
        print collection.id, collection.foreign_id, collection.label


@manager.command
def alerts():
示例#10
0
文件: queues.py 项目: wilbrodn/aleph
from aleph.core import create_app, celery as app  # noqa

from aleph.ingest import ingest_url, ingest  # noqa
from aleph.analyze import analyze_document_id  # noqa
from aleph.index import index_document_id  # noqa
from aleph.logic import reindex_entities, analyze_collection  # noqa
from aleph.logic import check_alerts, load_rows  # noqa
from aleph.crawlers import execute_crawler  # noqa
from aleph.events import save_event  # noqa

flask_app = create_app()
flask_app.app_context().push()
示例#11
0
文件: queue.py 项目: adamchainz/aleph
from aleph.core import create_app, celery as app  # noqa

from aleph.ingest import ingest_url, ingest  # noqa
from aleph.analyze import analyze_document, analyze_collection  # noqa
from aleph.index import index_document  # noqa
from aleph.alerts import check_alerts  # noqa
from aleph.logic import reindex_entities  # noqa
from aleph.crawlers import execute_crawler  # noqa

flask_app = create_app()
flask_app.app_context().push()
示例#12
0
from aleph.analyze import install_analyzers
from aleph.alerts import check_alerts
from aleph.ingest import reingest_collection
from aleph.index import init_search, delete_index, upgrade_search
from aleph.index import index_document_id
from aleph.logic import reindex_entities, delete_collection, analyze_collection
from aleph.graph import upgrade_graph, load_documents, load_entities
from aleph.ext import get_crawlers
from aleph.crawlers.directory import DirectoryCrawler
from aleph.crawlers.sql import SQLCrawler
from aleph.crawlers.metafolder import MetaFolderCrawler


log = logging.getLogger('aleph')

app = create_app()
mount_app_blueprints(app)
manager = Manager(app)
manager.add_command('assets', ManageAssets(assets))
manager.add_command('db', MigrateCommand)


@manager.command
def collections():
    """List all collections."""
    for collection in Collection.all():
        print collection.id, collection.foreign_id, collection.label


@manager.command
def alerts():
示例#13
0
    OP_REINDEX,
    OP_REINGEST,
    OP_XREF,
    OP_EXPORT_SEARCH_RESULTS,
    OP_EXPORT_XREF_RESULTS,
    OP_LOAD_MAPPING,
    OP_FLUSH_MAPPING,
)
from aleph.logic.alerts import check_alerts
from aleph.logic.collections import compute_collections, refresh_collection
from aleph.logic.notifications import generate_digest
from aleph.logic.roles import update_roles
from aleph.logic.export import delete_expired_exports

log = logging.getLogger(__name__)
app = create_app(config={"SERVER_NAME": settings.APP_UI_URL})

# All stages that aleph should listen for. Does not include ingest,
# which is received and processed by the ingest-file service.
OPERATIONS = (
    OP_INDEX,
    OP_XREF,
    OP_REINGEST,
    OP_REINDEX,
    OP_LOAD_MAPPING,
    OP_FLUSH_MAPPING,
    OP_EXPORT_SEARCH_RESULTS,
    OP_EXPORT_XREF_RESULTS,
)