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
Convert examples
to conform to best practices
#679
Convert examples
to conform to best practices
#679
Conversation
… it easily callable/testable
examples
to conform to best practices
The fact that ✅ is the emoji for not done is the biggest troll today! :D |
Changed it to 🍔 to motivate volunteers |
…ke-examples-conform-to-bp
I can do the alerter one later and will do the PR review once all examples are done. Also, could you please add a link to the best practices section somewhere in your PR description? |
@fa9r https://docs.zenml.io/links-and-resources/resources/best-practices is the best practices link, but you probably would do better just to look at the model of one of the complete ones. I was going to write up instructions on this process on Friday but didn't get around to it. Maybe overkill given how many we have left and that this is a one-off process. But lmk if you have any questions. I didn't find it super intuitive to do the first one. |
slack example should also be done now |
…ke-examples-conform-to-bp
…com:zenml-io/zenml into feature/ENG-939-make-examples-conform-to-bp
We're getting close, really looking forward to finally have this merged! 😄 |
…com:zenml-io/zenml into feature/ENG-939-make-examples-conform-to-bp
Just some tests missing now :) |
Only Seldon's example is left for the test I think. tried to make sure it's right but still would be better to run it if you guys can do that with the AWS Stack @AlexejPenner @fa9r |
Somehow not all examples are really following the same exact format! there are examples where each step or pipeline is inside a separated folder and some are gathered together, should it be unified @AlexejPenner @strickvl ? |
@safoinme like which examples? |
|
I know I'm late to this party, but I just had to go through the process of refactoring one of my examples to conform to these best practices and I have to object to the python module hierarchy recommendation. Do we really need to have a separate python sub-module for every single pipeline and step ? I find it unnecessary and difficult to work with. A better/simpler hierarchy would be e.g.:
|
|
||
Returns: | ||
imported module: Module | ||
""" | ||
# Add directory of python file to PYTHONPATH so we can import it | ||
file_path = os.path.abspath(file_path) | ||
module_name = os.path.splitext(os.path.basename(file_path))[0] | ||
module_path = os.path.relpath(file_path, zen_root) | ||
# module_name = os.path.splitext(os.path.basename(file_path))[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# module_name = os.path.splitext(os.path.basename(file_path))[0] |
if full_module_path not in sys.modules: | ||
with prepend_python_path(os.path.dirname(file_path)): | ||
if module_name in sys.modules: | ||
del sys.modules[module_name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you maybe add a short (or long) comment here that explains in detail why the module needs to be deleted, as that is a very strange operation if someone comes access this code.
I agree 100%. I did all my refactorings like this, which are the "inconsistencies" between the different examples we talked about 😄 For now, I think we agreed that both structures are acceptable since this design choice doesn't affect testing. |
…com:zenml-io/zenml into feature/ENG-939-make-examples-conform-to-bp
Describe changes
I have updated some of our examples to conform to our best practices - ✔️ is done - 🍔 is not done and should be done in the next few days - airflow currently does not work with our best practices structure.
✔️ add_your_own
✔️ airflow_orchestration
✔️ cloud_secrets_manager
✔️ evidently_drift_detection
✔️ facets_visualize_statistics
✔️ feast_feature_store
✔️ github_actions_orchestration
✔️ : huggingface
✔️ kubeflow_pipelines_orchestration
✔️ lightgbm
✔️ mlflow_deployment
✔️ mlflow_tracking
✔️ neural_prophet
✔️ pytorch
✔️ quickstart
✔️ scipy
🌵 seldon_deployment - done - Need to be tested with AWS cluster where seldon is installed
✔️ slack_alert
✔️ step_operator_remote_training
✔️ vertex_ai_orchestration
✔️ wandb_tracking
✔️ whylogs_data_profiling
✔️ xgboost
https://docs.zenml.io/links-and-resources/resources/best-practices
Besides the obvious many changes to the example structure there have been a few changes in the core repo. The pipeline-run code has moved out of the cli into the pipelines module to be callable from code without invoking subprocess calls or cli-runners.
On top of that the source utils have been adjusted to make sure that
zenml pipeline run ... -c config.yaml
works for our recommended repo structure. Special attention should be payed to the changes in src/zenml/utils/source_utils.py during code review (:eyes: @schustmi 😉 )Pre-requisites
Please ensure you have done the following:
Types of changes