예제 #1
0
def get_provider(provider_type, project_id=None, auth_token=None):
    """Construct the dsub provider for the given parameters.

        Args:
            provider_type: A string indicating google, local, or stub provider
            project_id: A string representing a Google Cloud Project ID
            auth_token: oauth2 token for authorizing Genomics API requests in
                dsub

        Returns:
            JobProvider: Instance of LocalJobProvider, GoogleJobProvider, or
                StubJobProvider.
    """
    if provider_type == ProviderType.GOOGLE:
        return _get_google_provider(project_id, auth_token)
    elif project_id or auth_token:
        raise BadRequest(
            'The Local provider does not support the `{}` field .'.format(
                'authToken' if auth_token else 'parentId'))
    elif provider_type == ProviderType.LOCAL:
        # TODO(https://github.com/googlegenomics/dsub/issues/93): Remove
        # resources parameter and import
        return local.LocalJobProvider(resources)
    elif provider_type == ProviderType.STUB:
        return stub.StubJobProvider()
예제 #2
0
def get_dsub_provider():
    if test.DSUB_PROVIDER == 'local':
        return local.LocalJobProvider(resources)
    elif test.DSUB_PROVIDER == 'google':
        return google.GoogleJobProvider(False, False, test.PROJECT_ID)
    else:
        print >> sys.stderr, 'Invalid provider specified.'
        sys.exit(1)
예제 #3
0
def get_dsub_provider():
    """Return the appropriate google_base.JobProvider instance."""
    if test.DSUB_PROVIDER == 'local':
        return local.LocalJobProvider(resources)
    elif test.DSUB_PROVIDER == 'google-cls-v2':
        return google_cls_v2.GoogleCLSV2JobProvider(False, test.PROJECT_ID,
                                                    'us-central1')
    elif test.DSUB_PROVIDER == 'google-v2':
        return google_v2.GoogleV2JobProvider(False, test.PROJECT_ID)
    else:
        print('Invalid provider specified.', file=sys.stderr)
        sys.exit(1)
예제 #4
0
 def setUpClass(cls):
     super(TestJobsControllerLocal, cls).setUpClass()
     # TODO(https://github.com/googlegenomics/dsub/issues/93): Remove
     # resources parameter and import
     cls.provider = local.LocalJobProvider(resources)
예제 #5
0
 def test_logging_path(self, unused_name, path, logname, jid, tid,
                       expected):
     prov = local.LocalJobProvider()
     loguri = param_util.UriParts(path, logname)
     self.assertEqual(expected, prov._prepare_logging_uri(loguri, jid, tid))