Skip to content

Commit

Permalink
specify output file with a parameter
Browse files Browse the repository at this point in the history
undo tf-launcher
  • Loading branch information
hougangliu committed Mar 3, 2019
1 parent 79b698a commit 6bfd44b
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 14 deletions.
6 changes: 1 addition & 5 deletions .cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,8 @@ steps:
id: 'buildDeployer'
- name: 'gcr.io/cloud-builders/docker'
entrypoint: '/bin/bash'
args: ['-c', 'cd /workspace/components/kubeflow/tf-launcher && ./build_image.sh -p $PROJECT_ID -t $COMMIT_SHA']
args: ['-c', 'cd /workspace/components/kubeflow/launcher && ./build_image.sh -p $PROJECT_ID -t $COMMIT_SHA']
id: 'buildLauncher'
- name: 'gcr.io/cloud-builders/docker'
entrypoint: '/bin/bash'
args: ['-c', 'cd /workspace/components/kubeflow/katib-launcher && ./build_image.sh -p $PROJECT_ID -t $COMMIT_SHA']
id: 'buildKatibLauncher'
- name: 'gcr.io/cloud-builders/docker'
entrypoint: '/bin/bash'
args: ['-c', 'cd /workspace/components/kubeflow/dnntrainer && ./build_image.sh -p $PROJECT_ID -t $COMMIT_SHA -l ml-pipeline-kubeflow-tf-trainer-gpu -b 1.6.0-gpu']
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def kubeflow_studyjob_launcher_op(name, namespace, optimizationtype, objectivevaluename, optimizationgoal, requestcount, metricsnames,
parameterconfigs, nasConfig, workertemplatepath, mcollectortemplatepath, suggestionspec,
studyjob_timeout_minutes, output_dir=None, step_name='StudyJob-Launcher'):
studyjob_timeout_minutes, output_file='/output.txt', step_name='StudyJob-Launcher'):
return dsl.ContainerOp(
name = step_name,
image = 'liuhougangxa/ml-pipeline-kubeflow-studyjob:latest',
Expand All @@ -33,7 +33,8 @@ def kubeflow_studyjob_launcher_op(name, namespace, optimizationtype, objectiveva
"--workertemplatepath", workertemplatepath,
"--mcollectortemplatepath", mcollectortemplatepath,
"--suggestionspec", suggestionspec,
"--outputfile", output_file,
'--studyjobtimeoutminutes', studyjob_timeout_minutes,
],
file_outputs = {'hyperparameter': '/output.txt'}
file_outputs = {'hyperparameter': output_file}
)
5 changes: 4 additions & 1 deletion components/kubeflow/katib-launcher/src/launch_study_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def main(argv=None):
parser.add_argument('--suggestionspec', type=yamlOrJsonStr,
default={},
help='StudyJob suggestion spec.')
parser.add_argument('--outputfile', type=str,
default='/output.txt',
help='The file which stores the best trial of the studyJob.')
parser.add_argument('--studyjobtimeoutminutes', type=int,
default=10,
help='Time in minutes to wait for the StudyJob to complete')
Expand Down Expand Up @@ -147,7 +150,7 @@ def main(argv=None):
if wait_response.get("status", {}).get("condition") == "Completed":
succ = True
trial = get_best_trial(wait_response["status"]["bestTrialId"])
with open('/output.txt', 'w') as f:
with open(args.outputfile, 'w') as f:
ps_dict = {}
for ps in trial.parameter_set:
ps_dict[ps.name] = ps.value
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@


import launcher
from launcher import train
import os
import shutil
import subprocess
Expand All @@ -35,7 +36,7 @@ def test_yaml_generation_basic(self):
pss = 1
args_list = []
args_list.append('--learning-rate=0.1')
generated_yaml = _generate_train_yaml(train_template_file, tfjob_ns, worker, pss, args_list)
generated_yaml = train._generate_train_yaml(train_template_file, tfjob_ns, worker, pss, args_list)
with open(os.path.join(test_data_dir, 'train_basic.yaml'), 'r') as f:
golden = yaml.load(f)
self.assertEqual(golden, generated_yaml)
Expand All @@ -50,7 +51,7 @@ def test_yaml_generation_advanced(self):
args_list = []
tfjob_ns = 'kubeflow'
args_list.append('--learning-rate=0.1')
generated_yaml = _generate_train_yaml(train_template_file, tfjob_ns, worker, pss, args_list)
generated_yaml = train._generate_train_yaml(train_template_file, tfjob_ns, worker, pss, args_list)
with open(os.path.join(test_data_dir, 'train_zero_worker.yaml'), 'r') as f:
golden = yaml.load(f)
self.assertEqual(golden, generated_yaml)
Expand Down
4 changes: 2 additions & 2 deletions samples/kubeflow-tf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Preprocessing:
[container](https://github.com/kubeflow/pipelines/tree/master/components/dataflow/tft)

Training:
[source code](https://github.com/kubeflow/pipelines/tree/master/components/kubeflow/tf-launcher/src),
[container](https://github.com/kubeflow/pipelines/tree/master/components/kubeflow/tf-launcher)
[source code](https://github.com/kubeflow/pipelines/tree/master/components/kubeflow/launcher/src),
[container](https://github.com/kubeflow/pipelines/tree/master/components/kubeflow/launcher)

Prediction:
[source code](https://github.com/kubeflow/pipelines/tree/master/components/dataflow/predict/src),
Expand Down
4 changes: 2 additions & 2 deletions samples/tfx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ Preprocessing:
[container](https://github.com/kubeflow/pipelines/tree/master/components/dataflow/tft)

Training:
[source code](https://github.com/kubeflow/pipelines/tree/master/components/kubeflow/tf-launcher/src)
[container](https://github.com/kubeflow/pipelines/tree/master/components/kubeflow/tf-launcher)
[source code](https://github.com/kubeflow/pipelines/tree/master/components/kubeflow/launcher/src)
[container](https://github.com/kubeflow/pipelines/tree/master/components/kubeflow/launcher)

Analysis:
[source code](https://github.com/kubeflow/pipelines/tree/master/components/dataflow/tfma/src)
Expand Down

0 comments on commit 6bfd44b

Please sign in to comment.