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

Add a convention to make sure experiment_name is parameterized in notebook sample. #2112

Merged
Merged
Show file tree
Hide file tree
Changes from 8 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
8 changes: 6 additions & 2 deletions samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ For better readability and integrations with the sample test infrastructure, sam
* The sample file should be either `*.py` or `*.ipynb`, and its file name is consistent with its directory name.
* For `*.py` sample, it's recommended to have a main invoking `kfp.compiler.Compiler().compile()` to compile the
pipeline function into pipeline yaml spec.
* For `*.ipynb` sample, parameters (e.g., experiment name and project name) should be defined in a dedicated cell and
tagged as parameter. Detailed guideline is [here](https://github.com/nteract/papermill). Also, all the environment setup and
* For `*.ipynb` sample, parameters (e.g., experiment name and project name)
should be defined in a dedicated cell and tagged as parameter.
(If the author would like to let the sample test infra run it, it's necessary to parameterize
experiment name used.)
Detailed guideline is
[here](https://github.com/nteract/papermill). Also, all the environment setup and
preparation should be within the notebook, such as by `!pip install packages`


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"outputs": [],
"source": [
"EXPERIMENT_NAME = 'lightweight python components'"
"experiment_name = 'lightweight python components'"
]
},
{
Expand Down Expand Up @@ -263,7 +263,7 @@
"#Get or create an experiment and submit a pipeline run\n",
"import kfp\n",
"client = kfp.Client()\n",
"experiment = client.create_experiment(EXPERIMENT_NAME)\n",
"experiment = client.create_experiment(experiment_name)\n",
"\n",
"#Submit a pipeline run\n",
"run_name = pipeline_func.__name__ + ' run'\n",
Expand Down
17 changes: 0 additions & 17 deletions test/sample-test/configs/lightweight_component.config.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion test/sample-test/sample_test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def _compile(self):
if self._is_notebook:
# Parse necessary params from config.yaml
nb_params = {}

try:
config_file = os.path.join(CONFIG_DIR, '%s.config.yaml' % self._test_name)
with open(config_file, 'r') as f:
Expand All @@ -120,6 +119,9 @@ def _compile(self):
if 'run_pipeline' in raw_args.keys():
self._run_pipeline = raw_args['run_pipeline']

if self._run_pipeline:
nb_params['experiment_name'] = self._test_name + '-test'

pm.execute_notebook(
input_path='%s.ipynb' % self._test_name,
output_path='%s.ipynb' % self._test_name,
Expand Down