def server_main(args=None):
    parser = getServerParser()
    parsedArgs = parser.parse_args(args)
    if parsedArgs.disable_urllib_warnings:
        requests.packages.urllib3.disable_warnings()

    frontend.configure(parsedArgs.config_file, parsedArgs.config,
                       parsedArgs.port)

    sslContext = None

    if parsedArgs.tls or ("OIDC_PROVIDER" in frontend.app.config):
        sslContext = "adhoc"

    if parsedArgs.gunicorn:
        options = {
            'bind': '%s:%s' % (parsedArgs.host, parsedArgs.port),
            'workers': int(parsedArgs.workers),
            'worker_class': parsedArgs.worker_class,
            'accesslog': '-',  # Puts the access log on stdout
            'errorlog': '-',  # Puts the error log on stdout
            'reload': not parsedArgs.dont_use_reloader,
        }

        frontend.configure(configFile=parsedArgs.config_file,
                           baseConfig="BaseConfig")
        app = StandaloneApplication(frontend.app, options)
        app.run()
    else:

        frontend.app.run(host=parsedArgs.host,
                         port=parsedArgs.port,
                         use_reloader=not parsedArgs.dont_use_reloader,
                         ssl_context=sslContext,
                         threaded=True)
Esempio n. 2
0
 def setUpClass(cls):
     config = {
         "DATA_SOURCE": paths.testDataRepo,
         "DEBUG": False
     }
     frontend.reset()
     frontend.configure(
         baseConfig="DevelopmentConfig", extraConfig=config)
     cls.app = frontend.app.test_client()
Esempio n. 3
0
 def setUpClass(cls):
     config = {
         "DATA_SOURCE": paths.testDataRepo,
         "DEBUG": False
     }
     frontend.reset()
     frontend.configure(
         baseConfig="DevelopmentConfig", extraConfig=config)
     cls.app = frontend.app.test_client()
Esempio n. 4
0
    def setUpClass(cls):
        config = {
            "DATA_SOURCE": "simulated://",
            "SIMULATED_BACKEND_RANDOM_SEED": 1111,
            "SIMULATED_BACKEND_NUM_CALLS": 1,
            "SIMULATED_BACKEND_VARIANT_DENSITY": 1.0,
            "SIMULATED_BACKEND_NUM_VARIANT_SETS": 1,
            "LANDING_MESSAGE_HTML": paths.landingMessageHtml
            # "DEBUG" : True
        }
        frontend.reset()
        frontend.configure(
            baseConfig="TestConfig", extraConfig=config)
        cls.app = frontend.app.test_client()
        # silence usually unhelpful CORS log
        logging.getLogger('ga4gh.frontend.cors').setLevel(logging.CRITICAL)

        # example test values
        cls.backend = frontend.app.backend
        cls.dataRepo = cls.backend.getDataRepository()
        cls.referenceSet = cls.dataRepo.getReferenceSets()[0]
        cls.referenceSetId = cls.referenceSet.getId()
        cls.reference = cls.referenceSet.getReferences()[0]
        cls.referenceId = cls.reference.getId()
        cls.dataset = cls.backend.getDataRepository().getDatasets()[0]
        cls.datasetId = cls.dataset.getId()
        cls.variantSet = cls.dataset.getVariantSets()[0]
        cls.variantSetId = cls.variantSet.getId()
        gaVariant = cls.variantSet.getVariants("1", 0, 2**32).next()
        cls.variantId = gaVariant.id
        cls.callSet = cls.variantSet.getCallSets()[0]
        cls.callSetId = cls.callSet.getId()
        cls.readGroupSet = cls.dataset.getReadGroupSets()[0]
        cls.readGroupSetId = cls.readGroupSet.getId()
        cls.readGroup = cls.readGroupSet.getReadGroups()[0]
        cls.readGroupId = cls.readGroup.getId()
        cls.readAlignment = cls.readGroup.getReadAlignments().next()
        cls.readAlignmentId = cls.readAlignment.id
        cls.phenotypeAssociationSet = \
            cls.dataset.getPhenotypeAssociationSets()[0]
        cls.phenotypeAssociationSetId = cls.phenotypeAssociationSet.getId()
        cls.association = cls.phenotypeAssociationSet.getAssociations()[0]
        cls.phenotype = cls.association.phenotype
        cls.phenotypeId = cls.phenotype.id
        cls.featureSets = cls.dataset.getFeatureSets()
        cls.genotypePhenotype = cls.phenotypeAssociationSet.getAssociations(
            request=None, featureSets=cls.featureSets)[0]
        cls.genotypePhenotypeId = cls.genotypePhenotype.id
        cls.rnaQuantificationSet = cls.dataset.getRnaQuantificationSets()[0]
        cls.rnaQuantificationSetId = cls.rnaQuantificationSet.getId()
        cls.rnaQuantification = cls.rnaQuantificationSet.getRnaQuantifications(
            )[0]
        cls.rnaQuantificationId = cls.rnaQuantification.getId()
        cls.expressionLevel = cls.rnaQuantification.getExpressionLevels(
            1, 2)[0]
        cls.expressionLevelId = cls.expressionLevel.getId()
Esempio n. 5
0
    def setUpClass(cls):
        config = {
            "DATA_SOURCE": "simulated://",
            "SIMULATED_BACKEND_RANDOM_SEED": 1111,
            "SIMULATED_BACKEND_NUM_CALLS": 1,
            "SIMULATED_BACKEND_VARIANT_DENSITY": 1.0,
            "SIMULATED_BACKEND_NUM_VARIANT_SETS": 1,
            "LANDING_MESSAGE_HTML": paths.landingMessageHtml
            # "DEBUG" : True
        }
        frontend.reset()
        frontend.configure(
            baseConfig="TestConfig", extraConfig=config)
        cls.app = frontend.app.test_client()
        # silence usually unhelpful CORS log
        logging.getLogger('ga4gh.frontend.cors').setLevel(logging.CRITICAL)

        # example test values
        cls.backend = frontend.app.backend
        cls.dataRepo = cls.backend.getDataRepository()
        cls.referenceSet = cls.dataRepo.getReferenceSets()[0]
        cls.referenceSetId = cls.referenceSet.getId()
        cls.reference = cls.referenceSet.getReferences()[0]
        cls.referenceId = cls.reference.getId()
        cls.dataset = cls.backend.getDataRepository().getDatasets()[0]
        cls.datasetId = cls.dataset.getId()
        cls.variantSet = cls.dataset.getVariantSets()[0]
        cls.variantSetId = cls.variantSet.getId()
        gaVariant = cls.variantSet.getVariants("1", 0, 2**32).next()
        cls.variantId = gaVariant.id
        cls.callSet = cls.variantSet.getCallSets()[0]
        cls.callSetId = cls.callSet.getId()
        cls.readGroupSet = cls.dataset.getReadGroupSets()[0]
        cls.readGroupSetId = cls.readGroupSet.getId()
        cls.readGroup = cls.readGroupSet.getReadGroups()[0]
        cls.readGroupId = cls.readGroup.getId()
        cls.readAlignment = cls.readGroup.getReadAlignments().next()
        cls.readAlignmentId = cls.readAlignment.id
        cls.phenotypeAssociationSet = \
            cls.dataset.getPhenotypeAssociationSets()[0]
        cls.phenotypeAssociationSetId = cls.phenotypeAssociationSet.getId()
        cls.association = cls.phenotypeAssociationSet.getAssociations()[0]
        cls.phenotype = cls.association.phenotype
        cls.phenotypeId = cls.phenotype.id
        cls.featureSets = cls.dataset.getFeatureSets()
        cls.genotypePhenotype = cls.phenotypeAssociationSet.getAssociations(
            request=None, featureSets=cls.featureSets)[0]
        cls.genotypePhenotypeId = cls.genotypePhenotype.id
        cls.rnaQuantificationSet = cls.dataset.getRnaQuantificationSets()[0]
        cls.rnaQuantificationSetId = cls.rnaQuantificationSet.getId()
        cls.rnaQuantification = cls.rnaQuantificationSet.getRnaQuantifications(
            )[0]
        cls.rnaQuantificationId = cls.rnaQuantification.getId()
        cls.expressionLevel = cls.rnaQuantification.getExpressionLevels(
            1, 2)[0]
        cls.expressionLevelId = cls.expressionLevel.getId()
Esempio n. 6
0
 def setUpClass(cls):
     config = {
         "DATA_SOURCE": paths.testDataRepo,
         "DEBUG": False
     }
     logging.getLogger('ga4gh.frontend.cors').setLevel(logging.CRITICAL)
     frontend.reset()
     frontend.configure(
         baseConfig="TestConfig", extraConfig=config)
     cls.app = frontend.app.test_client()
Esempio n. 7
0
def server_main(args=None):
    parser = getServerParser()
    parsedArgs = parser.parse_args(args)
    if parsedArgs.disable_urllib_warnings:
        requests.packages.urllib3.disable_warnings()
    frontend.configure(
        parsedArgs.config_file, parsedArgs.config, parsedArgs.port)
    sslContext = None
    if parsedArgs.tls or ("OIDC_PROVIDER" in frontend.app.config):
        sslContext = "adhoc"
    frontend.app.run(
        host=parsedArgs.host, port=parsedArgs.port,
        use_reloader=not parsedArgs.dont_use_reloader,
        ssl_context=sslContext)
Esempio n. 8
0
def server_main(args=None):
    parser = getServerParser()
    parsedArgs = parser.parse_args(args)
    if parsedArgs.disable_urllib_warnings:
        requests.packages.urllib3.disable_warnings()
    frontend.configure(parsedArgs.config_file, parsedArgs.config,
                       parsedArgs.port)
    sslContext = None
    if parsedArgs.tls or ("OIDC_PROVIDER" in frontend.app.config):
        sslContext = "adhoc"
    frontend.app.run(host=parsedArgs.host,
                     port=parsedArgs.port,
                     use_reloader=not parsedArgs.dont_use_reloader,
                     ssl_context=sslContext)
Esempio n. 9
0
 def setUpClass(cls):
     config = {
         "DATA_SOURCE": "simulated://",
         "SIMULATED_BACKEND_RANDOM_SEED": 1111,
         "SIMULATED_BACKEND_NUM_CALLS": 1,
         "SIMULATED_BACKEND_VARIANT_DENSITY": 1.0,
         "SIMULATED_BACKEND_NUM_VARIANT_SETS": 1,
         "CACHE_DIRECTORY": "/tmp/ga4gh-test"
     }
     frontend.reset()
     frontend.configure(baseConfig="TestAuth0Config", extraConfig=config)
     cls.app = frontend.app
     # silence usually unhelpful CORS log
     logging.getLogger('ga4gh.frontend.cors').setLevel(logging.CRITICAL)
     cls.backend = frontend.app.backend
     cls.client = frontend.app.test_client()
Esempio n. 10
0
 def setUpClass(cls):
     config = {
         "SIMULATED_BACKEND_RANDOM_SEED": 1111,
         "SIMULATED_BACKEND_NUM_CALLS": 1,
         "SIMULATED_BACKEND_VARIANT_DENSITY": 1.0,
         "SIMULATED_BACKEND_NUM_VARIANT_SETS": 1,
         "DATA_SOURCE": "simulated://",
         "OIDC_CLIENT_ID": "123",
         "OIDC_CLIENT_SECRET": RANDSTR,
         "OIDC_PROVIDER": "http://auth.com",
         "SECRET_KEY": "secret"
         # "DEBUG" : True
     }
     frontend.reset()
     frontend.configure(
         baseConfig="TestOidcConfig", extraConfig=config, port=8001)
     cls.app = frontend.app.test_client()
Esempio n. 11
0
 def setUpClass(cls):
     config = {
         "SIMULATED_BACKEND_RANDOM_SEED": 1111,
         "SIMULATED_BACKEND_NUM_CALLS": 1,
         "SIMULATED_BACKEND_VARIANT_DENSITY": 1.0,
         "SIMULATED_BACKEND_NUM_VARIANT_SETS": 1,
         "DATA_SOURCE": "simulated://",
         "OIDC_CLIENT_ID": "123",
         "OIDC_CLIENT_SECRET": RANDSTR,
         "OIDC_PROVIDER": "https://accounts.example.com",
         "SECRET_KEY": "secret"
         # "DEBUG" : True
     }
     shutil.rmtree('/tmp/ga4gh', True)
     frontend.reset()
     frontend.configure(
         baseConfig="TestOidcConfig", extraConfig=config, port=8001)
     cls.app = frontend.app.test_client()
 def setUpClass(cls):
     frontend.reset()
     frontend.configure(baseConfig="TestConfig")
     cls.app = frontend.app.test_client()
Esempio n. 13
0
 def setUpClass(cls):
     frontend.reset()
     frontend.configure(baseConfig="TestConfig")
     cls.app = frontend.app.test_client()
Esempio n. 14
0
 def setUpClass(cls):
     frontend.reset()
     frontend.configure(baseConfig="TestConfig")
     frontend.app.log_exception = mock.Mock()
Esempio n. 15
0
 def setUpClass(cls):
     frontend.reset()
     frontend.configure(baseConfig="TestConfig")
     frontend.app.log_exception = mock.Mock()