This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ARG BASE_CONTAINER=jupyter/scipy-notebook | |
| FROM $BASE_CONTAINER | |
| LABEL maintainer="[email protected]" | |
| LABEL version="01" | |
| USER $NB_UID | |
| # install specific package versions i want to use here | |
| RUN conda install --quiet --yes \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| from my_utils.os_utils import subprocess_execute | |
| from my_dev.dev import hello_world | |
| import pandas as pd | |
| def run(event=dict(), context=dict()): | |
| ''' Function to be called by serverless lambda | |
| ''' | |
| # make a dummy df to ensure pandas available to the lambda function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| service: serverless-learn-lambda | |
| provider: | |
| name: aws | |
| runtime: python3.6 | |
| region: us-west-2 | |
| stage: dev | |
| role: arn:aws:iam::XXX:role/serverless-lambda | |
| functions: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ARG BASE_CONTAINER=gcr.io/kubeflow-images-public/tensorflow-1.13.1-notebook-cpu:v0.5.0 | |
| FROM $BASE_CONTAINER | |
| LABEL maintainer="[email protected]" | |
| LABEL version="01" | |
| RUN pip3 install git+https://github.com/andrewm4894/my_utils.git#egg=my_utils | |
| RUN pip3 install kfp --upgrade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| GCP HTTP Cloud Function to handle github webhook events. | |
| Some code stolen from here: https://github.com/carlos-jenkins/python-github-webhooks/blob/master/webhooks.py | |
| """ | |
| # -*- coding: utf-8 -*- | |
| import hmac | |
| import json | |
| import datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| service: handle-github-events | |
| frameworkVersion: ">=1.2.0 <2.0.0" | |
| package: | |
| exclude: | |
| - node_modules/** | |
| - .gitignore | |
| - .git/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm install serverless -g | |
| serverless install -u https://github.com/serverless/examples/tree/master/google-python-simple-http-endpoint -n handle-github-events |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd handle-github-errors | |
| npm i -D serverless-dotenv-plugin | |
| npm install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def calc_batches(train_max: int, train_every: int, n: int) -> dict: | |
| batches = dict() | |
| # loop over up to as many records as you have | |
| for batch in range(n): | |
| # work out the start of the batch, with a max() to handle first batch | |
| start = max(train_every * batch, 1) | |
| # work out the end of the batch, with a min() to handle last batch | |
| end = min(train_max+(train_every * batch), n) | |
| # add batch info to the dictionary | |
| batches[batch+1] = {"start": start, "end": end} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def calc_batches(train_min: int, train_max: int, train_every: int, n: int) -> dict: | |
| batches = dict() | |
| batch = 0 | |
| for row in range(1,n+1): | |
| if row < train_min: | |
| pass | |
| elif row == train_min: | |
| batches[batch] = dict(start=0, end=row) | |
| elif row % train_every == 0: | |
| batch += 1 |