Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename gcloud commands from ml-engine to ai-platform #197

Merged
merged 1 commit into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions spotify_tensorflow/luigi/tensorflow_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class TensorFlowTask(luigi.Task):
model_name = None The name of the python module containing your model.
Ex: if the model is in /foo/models/main.py, you would set
model_package = "models" and model_name = "main"
gcp_project = None The Google Cloud project id to run with ml-engine
region = None The GCP region if running with ml-engine, e.g. europe-west1
gcp_project = None The Google Cloud project id to run with ai-platform
region = None The GCP region if running with ai-platform, e.g. europe-west1
model_name_suffix = None A string suffix representing the model name, which will be appended
to the job name.
runtime_version = None The Google Cloud ML Engine runtime version for this job. Defaults to
the latest stable version. See
runtime_version = None The Google Cloud AI Platform runtime version for this job. Defaults
to the latest stable version. See
https://cloud.google.com/ml/docs/concepts/runtime-version-list for a
list of accepted versions.
scale_tier = None Specifies the machine types, the number of replicas for workers and
Expand All @@ -62,19 +62,19 @@ class TensorFlowTask(luigi.Task):
region = luigi.Parameter(description="GCP region", default=None)
model_name_suffix = luigi.Parameter(description="String which will be appended to the job"
" name. Useful for finding jobs in the"
" ml-engine UI.", default=None)
" ai-platform UI.", default=None)

# Task parameters
cloud = luigi.BoolParameter(description="Run on ml-engine")
cloud = luigi.BoolParameter(description="Run on ai-platform")
blocking = luigi.BoolParameter(default=True, description="Run in stream-logs/blocking mode")
job_dir = luigi.Parameter(description="A job directory, used to store snapshots, logs and any "
"other artifacts. A trailing '/' is required for "
"'gs://' paths.")
ml_engine_conf = luigi.Parameter(default=None,
description="An ml-engine YAML configuration file.")
ai_platform_conf = luigi.Parameter(default=None,
description="An ai-platform YAML configuration file.")
tf_debug = luigi.BoolParameter(default=False, description="Run tf on debug mode")
runtime_version = luigi.Parameter(default=None,
description="The Google Cloud ML Engine runtime version "
description="The Google Cloud AI Platform runtime version "
"for this job.")
scale_tier = luigi.Parameter(default=None,
description="Specifies the machine types, the number of replicas "
Expand Down Expand Up @@ -113,7 +113,7 @@ def _success_hook(self):
open(success_file, "a").close()

def _mk_cmd(self):
cmd = ["gcloud", "ml-engine"]
cmd = ["gcloud", "ai-platform"]
if self.cloud:
cmd.extend(self._mk_cloud_params())
else:
Expand All @@ -140,8 +140,8 @@ def _mk_cloud_params(self):

if self.region:
params.append("--region=%s" % self.region)
if self.ml_engine_conf:
params.append("--config=%s" % self.ml_engine_conf)
if self.ai_platform_conf:
params.append("--config=%s" % self.ai_platform_conf)
params.append("--job-dir=%s" % self.get_job_dir())
if self.blocking:
params.append("--stream-logs") # makes the execution "blocking"
Expand Down
6 changes: 3 additions & 3 deletions tests/tensorflow_task_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_local_task(self):
job_dir="/local/job/dir",
model_package_path="/path/to/package")
expected = [
"gcloud", "ml-engine", "local", "train",
"gcloud", "ai-platform", "local", "train",
"--package-path=/path/to/package",
"--module-name=models.my_tf_model",
"--",
Expand All @@ -69,13 +69,13 @@ def test_cloud_task(self):
task = DummyTask(cloud=True,
model_package_path="/path/to/package",
job_dir="gs://job/dir",
ml_engine_conf="/path/conf.yaml",
ai_platform_conf="/path/conf.yaml",
blocking=True,
runtime_version="foo",
scale_tier="bar",
tf_debug=True)
expected = [
"gcloud", "ml-engine",
"gcloud", "ai-platform",
"--project=project-1",
"jobs", "submit", "training",
".*_DummyTask_.*",
Expand Down