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

Alexej/eng 267 additional example run implementations #286

Merged
Prev Previous commit
Next Next commit
Initial working versions for the three new example runs
  • Loading branch information
AlexejPenner committed Dec 28, 2021
commit 9270f10b24b09780a9795b2f1681a366daaeda41
3 changes: 0 additions & 3 deletions examples/class_based_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ zenml example pull class_based_api
cd zenml_examples/class_based_api

# initialize
git init
zenml init
```

Expand Down Expand Up @@ -66,5 +65,3 @@ In order to clean up, delete the remaining zenml references.
```shell
rm -rf zenml_examples
```

Press next to start the first chapter!
2 changes: 1 addition & 1 deletion examples/class_based_api/chapter_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# Configuring the training step
trainer = tf_steps.TensorflowBinaryClassifier(
tf_steps.TensorflowBinaryClassifierConfig(
target_column="has_diabetes", epochs=1
target_column="has_diabetes", epochs=100
)
)

Expand Down
20 changes: 20 additions & 0 deletions examples/class_based_api/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -Eeo pipefail

download_data () {
wget -O diabetes.csv https://gist.githubusercontent.com/AlexejPenner/0564d4cea7b7685f9ef119b56ff05475/raw/2c1fbd64b6624e251b53d9ba6d93b176a5bef050/diabetes.csv
export data='diabetes.csv'
}

pre_run () {
zenml integration install sklearn
zenml integration install tensorflow
download_data
}

pre_run_forced () {
zenml integration install sklearn -f
zenml integration install tensorflow -f
download_data
}
4 changes: 1 addition & 3 deletions examples/functional_api/chapter_7.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@

# Path to a pip requirements file that contains requirements necessary to run
# the pipeline
requirements_file = os.path.join(
os.path.dirname(__file__), "chapter_7_requirements.txt"
)
requirements_file = os.path.join(os.path.dirname(__file__), "requirements.txt")


class ImporterConfig(BaseStepConfig):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
scikit-learn
pandas
numpy
requests

11 changes: 11 additions & 0 deletions examples/functional_api/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -Eeo pipefail

pre_run () {
zenml integration install sklearn
}

pre_run_forced () {
zenml integration install sklearn -f
}
15 changes: 11 additions & 4 deletions src/zenml/cli/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ def executable_python_example(self) -> str:
if self.has_single_python_file:
return self.python_files_in_dir[0]
elif self.has_any_python_file:
raise RuntimeError(
"Unclear which python file to return for "
f"example {self.name}."
f"{self.python_files_in_dir}"
logger.warning(
"This example has multiple executable python files"
"The last one in alphanumerical order is taken."
)
return sorted(self.python_files_in_dir)[-1]
else:
raise RuntimeError(
"No pipeline runner script found in example. "
Expand Down Expand Up @@ -645,3 +645,10 @@ def run(
)
except NotImplementedError as e:
error(str(e))


#
# from click.testing import CliRunner
# runner = CliRunner()
#
# result = runner.invoke(example, ["run", "class_based_api"])