Bodywork deploys machine learning projects developed in Python, to Kubernetes.

Overview

Bodywork deploys machine learning projects developed in Python, to Kubernetes. It helps you to:

  • serve models as microservices
  • execute batch jobs
  • run reproducible pipelines

On demand, or on a schedule. It automates repetitive DevOps tasks and frees machine learning engineers to focus on what they do best - solving data problems with machine learning.

Get Started

Bodywork is distributed as a Python package - install it from PyPI:

Add a bodywork.yaml file to your Python project’s Git repo. The contents of this file describe how your project will be deployed:

Bodywork is used from the command-line to deploy projects to Kubernetes clusters. With a single command, you can start Bodywork containers (hosted by us on Docker Hub), that pull Python modules directly from your project’s Git repo, and run them:

You don’t need to build Docker images or understand how to configure Kuberentes resources. Bodywork will fill the gap between executable Python modules and operational jobs and services on Kubernetes.

If you’re new to Kubernetes then check out our guide to Kubernetes for ML - we’ll have you up-and-running with a test cluster on your laptop, in under 10 minutes.

Documentation

The documentation for bodywork-core can be found here. This is the best place to start.

Deployment Templates

To accelerate your project's journey to production, we provide deployment templates for common use-cases:

We want your Feedback

If Bodywork sounds like a useful tool, then please send us a signal with a GitHub ★

Contacting Us

If you:

  • Have a question that these pages haven't answered, or need help getting started with Kubernetes, then please use our discussion board.
  • Have found a bug, then please open an issue.
  • Would like to contribute, then please talk to us first at [email protected].
  • Would like to commission new functionality, then please contact us at [email protected].

Bodywork is brought to you by Bodywork Machine Learning.

Comments
  • Refactor all Bodywork configuration

    Refactor all Bodywork configuration

    This PR contains a single, but very large unit of refactoring. It removes/relocates the logic contained in:

    • bodywork.workflow.BodyworkProject
    • bodywork.stages.Stage
    • bodywork.stages.BatchStage
    • bodywork.stages.ServiceStage

    And relocates it into complete refactoring of bodywork.config.BodyworkConfig. This scope of this class has changed enormously - because, it now opens and parses a YAML configuration file containing all of the configuration, for the entire project.

    The change to a single config file enabled the opportunity to validate the config for the entire project in one pass, before any workflow has been started - this is now what is happening in bodywork.config.BodyworkConfig and why it is so large.

    The Builder pattern has been implemented in bodywork.config.BodyworkConfig to create an easily extensible Bodywork config validator. Collectively, this refactoring has brought the following major advantages and new features:

    • We no longer need config.ini and requirements.txt files in every stage directory. This completely separates code from config as can be seen in the new bodywork-test-project, which is now structured as a conventional Python project with a bodywork.yaml in the root directory - in precisely the same manner as many CICD services. that hook into GitHub, require.
    • We now have the option of breaking the relationship between the name given to a stage, and the name of the directory that the executable module resides in. For any given stage, you now just provide the path to the executable to be used for that stage. This will allow users to re-use an executable module for multiple stages, without having to copy-paste anything. Also, this way Bodywork imposes absolutely nothing on the structure of the codebase 🙂 To build on this flexibility, I built-in the capability to pass parameters to each executable module, via the config file, so that a single executable module can be re-used in different ways, depending in which stage it's running in. This is demonstrated in bodywork-test-project, for stage_1.
    • Because all the config can be validated in one pass, it has been possible to accumulate a running log of all config errors. This has been used to implement a new CLI command - $ bodywork validate that prints a validation report to stdout, that can be used to debug the config, before deployment is tested. This is great for user-experience!
    • It is now much, much easier to extend and test config related code, without having to spawn new test resources (e.g. directories containing config.ini and requirements.txt files), each time a new parameter is added. This is basically how I slipped-in new features like passing args in config, so quickly.
    • All the config and validation is now in one module, under a single interface, which makes the codebase easier to navigate and comprehend.
    opened by AlexIoannides 8
  • Origin/37 improve exception handling and error messages for failed git clones

    Origin/37 improve exception handling and error messages for failed git clones

    This PR improves the exception handling in git.py, so that users receive the git error when trying to download a git repo. This closes #37

    Test fixture was also fixed to be compatible with Windows OS.

    opened by Marios85 7
  • 116 make secrets namespace agnostic

    116 make secrets namespace agnostic

    This PR closes #116 .

    Changes mostly follow those described in #116.

    When replicating the secrets to the target namespace the workflow will run in, all the secrets that belong to the secrets group specified will be copied. This occurs once per workflow before any stages are executed.

    Created a separate Integration test file for Secrets as another small step towards splitting them out and cleaning up our tests.

    opened by Marios85 5
  • 111 create a configure cluster command

    111 create a configure cluster command

    This PR closes #111. Tweaked the existing code for setting up a namespace so the job-deployment accounts have permission to create namespaces. This in turn is called by the new command to configure the cluster.

    opened by Marios85 5
  • 71-expose git commit hash as environment variable in bodywork containers to help with versioning

    71-expose git commit hash as environment variable in bodywork containers to help with versioning

    This PR close #71. The commit hash is retrieved and added to both batch and service stages.

    Some refactoring was also done in workflow_execution.py which consisted of breaking down the run_workflow method into smaller units.

    opened by Marios85 5
  • 120 implement bodywork deployment delete

    120 implement bodywork deployment delete

    This PR closes #120.

    In addition to closing the original PR this also includes the removal of the service commands so these are all available under deployment. bodywork deployment display --namewill show all services belonging to that deployment andbodywork deployment display --service_name myserviceis equivalent toservice display --name myservice`.

    During this I found out that the configure-cluster command was not giving the right permissions to the workflow service account because this was the first time the bodywork namespace was deleted since the V3 namespace related changes (this includes the cluster role). I effectively had to add all the permissions we had before, to the clusterrole, so that we can have the same permissions for multiple namespaces.

    Because these permissions are being added to the entire cluster, I removed the permissions giving '*' access and went for a more restrictive set.

    Integration tests have also been improved so that they use single stage projects unless they require the multi-stage project. This should reduce the strain on the cluster and also stop tests impacting each other as each project uses a different namespace.

    opened by Marios85 4
  • 112 automate the management of k8s namespaces

    112 automate the management of k8s namespaces

    This PR closes #112 .

    Implementation differs from the original issue requirements in the following way:

    • Job name is post-fixed with a small random number instead of a timestamp because there is a 52 character limit on the job name.
    • Cronjobs will have a static name as defined by the user as this best fits how people like to use cronjobs.
    • Namespace left as a parameter in lower level package functions as I see no gain in removing them and might come useful in later iterations.
    opened by Marios85 4
  • Unhandled exception when deploying from a private GitHub repo via SSH

    Unhandled exception when deploying from a private GitHub repo via SSH

    When trying to deploy a private repo via SSH using,

    $ bodywork deployment create \
        --namespace=arc-cpre \
        --name=d1 \
        [email protected]/everlution/arc-cpre.git \
        --git-repo-branch=rest-api-definition \
        -L
    

    I got the following unhandled exception:

    testing with local workflow-controller - retries are inactive
    namespace=arc-cpre is setup for use by Bodywork
    2021-06-22 19:48:29,882 - INFO - workflow_execution.run_workflow - attempting to run workflow for [email protected]/everlution/arc-cpre.git on branch=rest-api-definition in kubernetes namespace=arc-cpre
    2021-06-22 19:48:29,939 - ERROR - workflow_execution.run_workflow - failed to execute workflow for rest-api-definition branch of project repository at [email protected]/everlution/arc-cpre.git: Unable to setup SSH for Github and you are trying to connect via SSH: 'failed to setup SSH for github.com - cannot find BODYWORK_GIT_SSH_PRIVATE_KEY environment variable'
    Traceback (most recent call last):
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/git.py", line 63, in download_project_code_from_repo
        setup_ssh_for_git_host(hostname)
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/git.py", line 137, in setup_ssh_for_git_host
        raise KeyError(msg)
    KeyError: 'failed to setup SSH for github.com - cannot find BODYWORK_GIT_SSH_PRIVATE_KEY environment variable'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/workflow_execution.py", line 81, in run_workflow
        download_project_code_from_repo(repo_url, repo_branch, cloned_repo_dir)
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/git.py", line 74, in download_project_code_from_repo
        raise BodyworkGitError(msg)
    bodywork.exceptions.BodyworkGitError: Unable to setup SSH for Github and you are trying to connect via SSH: 'failed to setup SSH for github.com - cannot find BODYWORK_GIT_SSH_PRIVATE_KEY environment variable'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/workflow_execution.py", line 156, in run_workflow
        if config.project.run_on_failure and type(e) not in [
    UnboundLocalError: local variable 'config' referenced before assignment
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/workflow_execution.py", line 167, in run_workflow
        f"Error executing failure stage: {config.project.run_on_failure}"
    UnboundLocalError: local variable 'config' referenced before assignment
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/bin/bodywork", line 8, in <module>
        sys.exit(cli())
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/cli/cli.py", line 302, in cli
        args.func(args)
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/cli/cli.py", line 324, in wrapper
        func(*args, **kwargs)
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/cli/cli.py", line 393, in deployment
        workflow(pass_through_args)
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/cli/cli.py", line 324, in wrapper
        func(*args, **kwargs)
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/cli/cli.py", line 562, in workflow
        run_workflow(
      File "/Users/alexioannides/Dropbox/bodywork_client_repos/arc-CPRE/.venv/lib/python3.8/site-packages/bodywork/workflow_execution.py", line 176, in run_workflow
        if config is not None and config.project.usage_stats:
    UnboundLocalError: local variable 'config' referenced before assignment
    
    bug 
    opened by AlexIoannides 4
  • 73-send basic usage statistics to a centralised tracking server

    73-send basic usage statistics to a centralised tracking server

    This PR fulfills the changes required to Bodywork-core for #73. Every time the workflow is executed it will ping the usage trackage server (unless explicitly configured not to) and fail silently if it cannot be reached.

    The Constant containing the URL for the tracking server needs to be updated with the tracking server URL once this is available.

    opened by Marios85 4
  • #169 bodywork get deployment   git branch shows stage name instead of git branch

    #169 bodywork get deployment git branch shows stage name instead of git branch

    Fixed so that the git-branch is shown and removed the stage name field as this is the same as the name field, therefore displaying duplicate data.

    This commit also contains a fix for the CI/CD build:

    • Upgrade deprecated Ubuntu image for docker builds.
    • Fix Docker Dev Build Step after upgrade.
    opened by Marios85 3
  • Hotfix - add PYTHONPATH to `run_stage` environment and handle missing config file exceptions

    Hotfix - add PYTHONPATH to `run_stage` environment and handle missing config file exceptions

    This hotfix targets two separate issues:

    1. While putting together an example pipeline project for the next blog post, I run into several issues when using a pipeline/ folder for the pipeline code and then trying to import modules as if pipeline was a Python package module. These can be solved by adding the project's root directory to PYTHONPATH. While this isn't strictly necessary, it leads to a much better developer experience (and probably reduces the risk of confusion).
    • By accident, I tried to run a workflow without a bodywork.yaml file and I got a cascade of exceptions in the face. This is because BodyworkConfig throws a FileExistsError exception, which we don't handle in run_workflow. I thought about creating a custom exception that inherits from BodyworkConfigError, but that seemed overkill (need your opinion here).
    opened by AlexIoannides 3
  • Add support for private image registries

    Add support for private image registries

    "As a ML Engineer, I would like to be able to use Bodywork images hosted on a private image registry, so that I can use images that have passed security scanning as mandated by my place of work."

    Tasks

    • Investigate how image pull secrets could be configured for private image repositories. Could we use the existing secrets mechanism?
    • Investigate how images hosted on private image repositories can be pinged to check that they exist.
    • Plan the work required to develop the required functionality.
    enhancement spike prioritise 
    opened by AlexIoannides 2
  • Upgrade Kubernetes Python client

    Upgrade Kubernetes Python client

    "As a ML Engineer, I would like Bodywork to support the newest version of Kuberentes possible, so that I can use Bodywork with cluster running later versions of Kubernetes."

    Tasks

    • Upgrade the Kubernetes Python client and check to see what versions of Kubernetes it is officially compatible with.
    • Run integration tests on clusters with the lowest and highest supported versions of Kubernetes (via Minikube).
    • Update the documentation with the latest supported version of Kubernetes.
    enhancement 
    opened by AlexIoannides 0
  • Handle Jupyter notebook stage exception individually

    Handle Jupyter notebook stage exception individually

    "As a ML Engineer, I would like to know why my Jupyter notebook stage has failed, so that I can fix the issue."

    Tasks

    • Investigate what exceptions nbconvert.preprocessors.ExecutePreprocessor().preprocess throws when a notebook raises an exception.
    • Within bodywork.stage_execution.run_stage ensure that these exceptions are handled individually and that the resulting error message to the user is informative.
    • Consider executing the notebook via the CLI, if this makes managing the notebook execution easier.
    tech-debt user-experience 
    opened by AlexIoannides 0
  • Enhance the information content of all error, warning and info messages

    Enhance the information content of all error, warning and info messages

    "As a ML Engineer, I would like error messages that contain suggestions for how to fix the problem, so that I am enabled to make progress with my deployments."

    Tasks

    • Review all exceptions in bodywork.workflow_execution.run_workflow and ensure that, where possible, they contain suggestions for how to fix the problem.
    • Review all exceptions in bodywork.stage_execution.run_stage and ensure that, where possible, they contain suggestions for how to fix the problem.
    • When creating a secret or cronjob, without having configured the cluster first, ensure that the message to the user informs them that they ought to run bw configure-cluster.
    enhancement user-experience 
    opened by AlexIoannides 0
  • Document developer setup

    Document developer setup

    "As a newly recruited Bodywork Developer, I would like to know how to configure all developer tools, so that I can start making contributions quickly."

    Tasks

    • Add a Contributing section to the Bodywork docs.
    • Add a section that links to it in the project's README.md.
    • Add a CONTRIBUTING.md file to the project.
    documentation 
    opened by AlexIoannides 0
  • Add pre-commit hooks to automate code formatting

    Add pre-commit hooks to automate code formatting

    "As a Bodywork Developer, I would like code formatting to be executed automatically prior to making a commit, so that I don't have to remember to run all the formatting tools and each commit is consistently formatted."

    Tasks

    • Read about the pre-commit package.
    • Setup the pre-commit package.
    • Add Black, isort and pydocstyle as pre-commit hooks.
    • Document the installation steps required by new developers.

    Requires #197, #196 to be completed first.

    devops 
    opened by AlexIoannides 0
Owner
Bodywork Machine Learning
Deploy machine learning systems
Bodywork Machine Learning
Kubeflow is a machine learning (ML) toolkit that is dedicated to making deployments of ML workflows on Kubernetes simple, portable, and scalable.

SDK: Overview of the Kubeflow pipelines service Kubeflow is a machine learning (ML) toolkit that is dedicated to making deployments of ML workflows on

Kubeflow 3.1k Jan 6, 2023
Machine learning template for projects based on sklearn library.

Machine learning template for projects based on sklearn library.

Janez Lapajne 17 Oct 28, 2022
A collection of neat and practical data science and machine learning projects

Data Science A collection of neat and practical data science and machine learning projects Explore the docs » Report Bug · Request Feature Table of Co

Will Fong 2 Dec 10, 2021
Data Version Control or DVC is an open-source tool for data science and machine learning projects

Continuous Machine Learning project integration with DVC Data Version Control or DVC is an open-source tool for data science and machine learning proj

Azaria Gebremichael 2 Jul 29, 2021
A Powerful Serverless Analysis Toolkit That Takes Trial And Error Out of Machine Learning Projects

KXY: A Seemless API to 10x The Productivity of Machine Learning Engineers Documentation https://www.kxy.ai/reference/ Installation From PyPi: pip inst

KXY Technologies, Inc. 35 Jan 2, 2023
A Python Automated Machine Learning tool that optimizes machine learning pipelines using genetic programming.

Master status: Development status: Package information: TPOT stands for Tree-based Pipeline Optimization Tool. Consider TPOT your Data Science Assista

Epistasis Lab at UPenn 8.9k Jan 9, 2023
Python Extreme Learning Machine (ELM) is a machine learning technique used for classification/regression tasks.

Python Extreme Learning Machine (ELM) Python Extreme Learning Machine (ELM) is a machine learning technique used for classification/regression tasks.

Augusto Almeida 84 Nov 25, 2022
Vowpal Wabbit is a machine learning system which pushes the frontier of machine learning with techniques

Vowpal Wabbit is a machine learning system which pushes the frontier of machine learning with techniques such as online, hashing, allreduce, reductions, learning2search, active, and interactive learning.

Vowpal Wabbit 8.1k Dec 30, 2022
MIT-Machine Learning with Python–From Linear Models to Deep Learning

MIT-Machine Learning with Python–From Linear Models to Deep Learning | One of the 5 courses in MIT MicroMasters in Statistics & Data Science Welcome t

null 2 Aug 23, 2022
Microsoft contributing libraries, tools, recipes, sample codes and workshop contents for machine learning & deep learning.

Microsoft contributing libraries, tools, recipes, sample codes and workshop contents for machine learning & deep learning.

Microsoft 366 Jan 3, 2023
A data preprocessing package for time series data. Design for machine learning and deep learning.

A data preprocessing package for time series data. Design for machine learning and deep learning.

Allen Chiang 152 Jan 7, 2023
A mindmap summarising Machine Learning concepts, from Data Analysis to Deep Learning.

A mindmap summarising Machine Learning concepts, from Data Analysis to Deep Learning.

Daniel Formoso 5.7k Dec 30, 2022
A comprehensive repository containing 30+ notebooks on learning machine learning!

A comprehensive repository containing 30+ notebooks on learning machine learning!

Jean de Dieu Nyandwi 3.8k Jan 9, 2023
Implemented four supervised learning Machine Learning algorithms

Implemented four supervised learning Machine Learning algorithms from an algorithmic family called Classification and Regression Trees (CARTs), details see README_Report.

Teng (Elijah)  Xue 0 Jan 31, 2022
High performance, easy-to-use, and scalable machine learning (ML) package, including linear model (LR), factorization machines (FM), and field-aware factorization machines (FFM) for Python and CLI interface.

What is xLearn? xLearn is a high performance, easy-to-use, and scalable machine learning package that contains linear model (LR), factorization machin

Chao Ma 3k Jan 8, 2023
A library of extension and helper modules for Python's data analysis and machine learning libraries.

Mlxtend (machine learning extensions) is a Python library of useful tools for the day-to-day data science tasks. Sebastian Raschka 2014-2021 Links Doc

Sebastian Raschka 4.2k Dec 29, 2022
MLBox is a powerful Automated Machine Learning python library.

MLBox is a powerful Automated Machine Learning python library. It provides the following features: Fast reading and distributed data preprocessing/cle

Axel 1.4k Jan 6, 2023
Python package for stacking (machine learning technique)

vecstack Python package for stacking (stacked generalization) featuring lightweight functional API and fully compatible scikit-learn API Convenient wa

Igor Ivanov 671 Dec 25, 2022
A Python Package to Tackle the Curse of Imbalanced Datasets in Machine Learning

imbalanced-learn imbalanced-learn is a python package offering a number of re-sampling techniques commonly used in datasets showing strong between-cla

null 6.2k Jan 1, 2023