Skip to content

Instantly share code, notes, and snippets.

View omegaml's full-sized avatar
💭
MLOps simplified.

omega-ml omegaml

💭
MLOps simplified.
View GitHub Profile
@omegaml
omegaml / README.md
Last active June 30, 2023 13:21
Easily deploy shared code with omega-ml

Using shared modules in omega-ml

Shared modules allow data scientists to implement complex functionality as virtual functions, classes, installable scripts, or packaged apps.

A motivating example

Consider a use case where we want to leverage sqlalchemy's ORM Models

@omegaml
omegaml / README.md
Last active August 31, 2021 21:26
Connect omegaml to Atlas Service

Create MongoDB on MongoDB Atlas service

  1. Sign up to Atlasdb https://cloud.mongodb.com/

  2. Create new MongoDB

  3. Connect > Connect your application > Python > 3.4

  4. Copy/paste the first server URL:

    e.g.

@omegaml
omegaml / omdeploy.py
Last active August 7, 2021 14:43
omega-ml mlops bulk deployment
""" omega-ml bulk deployment utility
(c) 2020 one2seven GmbH, Switzerland
Enables deployment of datasets, models, scripts, jobs as well as cloud
resources from a single configuration file. This is currently a separate
utility that will be integrated into the omega-ml cli.
Installation:
$ pip install -U getgist omegaml==0.14.0
$ getgist omegaml omdeploy
@omegaml
omegaml / dedicated-cluster.rst
Last active July 5, 2021 15:24
omega-ml cloud technical information

omega-ml dedicated clusters

Summary

Dedicated clusters run omega-ml in a customer-owned cloud account (AWS, Azure, Exoscale, any other cloud provider or on-premise). Each cluster is a fully deployed kubernetes cluster with the following Rancher projects and namespaces:

  • omegaml-services - runs all the basic services like mongodb, rabbitmq, apphub, juypterhub and related pods
  • omegaml-runtime - runs omega-ml runtime worker pods, jupyter notebook services and deployed apps. These pods are deployed in user-named namespaces (e.g. user foxbar = namespace foxbar)
@omegaml
omegaml / omx_dslongname.py
Last active January 14, 2021 19:03
helper function for overly long dataset names (overcoming a monogdb limitation)
def put_longname(store, obj, name, **kwargs):
""" helper function to overcome mongodb limitation on namespace length
Only use to store Pandas dataframes and series
Usage:
Copy/paste this function into your code base
# instead of
meta = om.datasets.put(obj, name)
@omegaml
omegaml / omx_chained.py
Last active December 22, 2020 15:22
omega|ml plugin to run chained tasks
"""
omegaml plugin to chain runtime tasks
Usage:
# this will chain the fit and predict, i.e. fit will run only on predict success
with om.runtime.chain() as crt:
crt.model('regmodelx').fit('sample[y]', 'sample[x]')
crt.model('regmodelx').predict([5], rName='foox')
result = crt.run()
@omegaml
omegaml / README_files.md
Last active December 4, 2020 16:47
Reading and writing raw files with omega|ml

Using omega|ml datasets for files

Motivating example: Say you have a file 'test.xyz' that you want to read and write in your web application. That's not typically a supported scenario in a containerized application as local storage is emphemeral.

For this purpose, om.datasets provides the python.file object kind:

  1. Store a file
@omegaml
omegaml / README.md
Last active October 22, 2020 19:59
notebook task runner using omegaml runtime

What is this?

This nbtasks plugin, built for the omega|ml runtime, let's you run a Jupyter notebook many times with a different set of parameters. Essentially like Python's multiprocessing Pool.map() for running Jupyter Notebooks in the cloud.

# run the 'mynb' notebook 10 times
# -- each notebook gets one value of the range
job = om.runtime.job('mynb')
job.map(range(10))
@omegaml
omegaml / omx_qfmdfmerge.py
Last active September 16, 2020 17:42
MDataFrame merge quickfix
"""
This fixes MDataFrame.merge() where the join results in duplicate object keys
When to use:
if your mdf.merge() operation results in a duplicate key error exception
Usage:
!pip install -q getgist
!rm -f *omx_qfmdfmerge.py && getgist -y omegaml omx_qfmdfmerge.py
import omx_qfmdfmerge
@omegaml
omegaml / omx_getinfo.py
Last active May 30, 2020 09:29
omegaml support info collector
def getinfo(om, models=None, datasets=None, scripts=None, jobs=None, outfile=None, tryget=False):
"""
get info relevant to provide support
Usage:
import omegaml as om
# to get a printed report
print(getinfo(om, ...))