Skip to content

Instantly share code, notes, and snippets.

@boseoladipo
boseoladipo / pardo_class.py
Created July 16, 2020 10:03
Apache Beam Pardo class for Exponea pipeline
class FetchEventsFn(beam.DoFn):
def __init__(self, payload):
self.payload = payload
self.url = exponea_vars['url']
self.headers = exponea_vars['headers']
def process(self, record):
try:
id = record['cookie']
@boseoladipo
boseoladipo / pipeline.py
Last active July 16, 2020 10:18
Pipeline for loading exponea data
payload = {
"customer_ids": {"cookie": ""},
"event_types": [
"campaign",
"first_session",
"session_start",
"session_end",
"reserve_car",
"view item",
"view_car",
@boseoladipo
boseoladipo / deploy_beam_exponea.sh
Last active August 24, 2020 08:17
Deployment command for beam exponea pipeline
python main.py --project $PROJECT \
--staging_location gs://$BUCKET/staging_location \
--temp_location gs://$BUCKET/temp_location \
--template_location gs://$BUCKET/templates/load-exponea-events \
--region $REGION \
--runner DataflowRunner \
--subnetwork https://www.googleapis.com/compute/alpha/projects/$PROJECT/regions/$REGION/subnetworks/$SUBNET_NAME \
--service_account_email $SERVICE_ACCOUNT \
--num_workers 1 \
--max_num_workers 5 \
@boseoladipo
boseoladipo / start_dataflow_job.py
Created July 16, 2020 11:02
Cloud function to start dataflow template
import logging
from string import Template
import google.auth
from google.cloud import error_reporting
from googleapiclient.discovery import build
client = error_reporting.Client(service="start_dataflow_job")
@boseoladipo
boseoladipo / git-collaborative-workflow.md
Last active December 10, 2021 01:40 — forked from adamloving/git-collaborative-workflow.md
Simple Git workflow for collaborating on a project.

How we collaborate

We collaborate using the Github Flow method, as described below;

  • Anything in the master branch is deployable
  • To work on something new, create a descriptively named branch off of master (ie: new-oauth2-scopes)
  • Commit to that branch locally and regularly push your work to the same named branch on the server
  • When you need feedback or help, or you think the branch is ready for merging, open a pull request
  • After someone else has reviewed and signed off on the feature, you can merge it into master
@boseoladipo
boseoladipo / git-pushing-multiple.rst
Created April 28, 2021 09:59 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just