Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _create_context():
project_id = 'test'
creds = mock.Mock(spec=google.auth.credentials.Credentials)
return datalab.context.Context(project_id, creds)
def _create_context():
project_id = 'test'
creds = mock.Mock(spec=google.auth.credentials.Credentials)
return datalab.context.Context(project_id, creds)
def _create_context():
project_id = 'test'
creds = mock.Mock(spec=google.auth.credentials.Credentials)
return datalab.context.Context(project_id, creds)
def _create_context():
project_id = 'test'
creds = mock.Mock(spec=google.auth.credentials.Credentials)
return datalab.context.Context(project_id, creds)
def _create_context():
project_id = 'test'
creds = mock.Mock(spec=google.auth.credentials.Credentials)
return datalab.context.Context(project_id, creds)
def _create_context():
project_id = 'test'
creds = mock.Mock(spec=google.auth.credentials.Credentials)
return datalab.context.Context(project_id, creds)
def _create_context():
project_id = 'test'
creds = mock.Mock(spec=google.auth.credentials.Credentials)
return datalab.context.Context(project_id, creds)
def run(self, job_id=None):
"""Submit a training job to the CloudML service.
Args:
job_id: id for the training job. If None, a UUID will be generated.
Returns: job info returned from service.
"""
if job_id is None:
job_id = self._create_default_job_name()
job = {
'job_id': job_id,
'training_input': self._job_request,
}
context = datalab.context.Context.default()
cloudml = discovery.build('ml', 'v1beta1', credentials=context.credentials,
discoveryServiceUrl=_CLOUDML_DISCOVERY_URL)
request = cloudml.projects().jobs().create(body=job,
parent='projects/' + context.project_id)
request.headers['user-agent'] = 'GoogleCloudDataLab/1.0'
return request.execute()