Sage-Bionetworks/github-issues-to-synapse-lambda

Name: github-issues-to-synapse-lambda

Owner: Sage Bionetworks

Description: Write open Github issues to a Synapse table

Created: 2017-10-03 17:51:52.0

Updated: 2017-10-03 17:55:42.0

Pushed: 2017-10-09 16:32:37.0

Homepage: null

Size: 12

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

AWS Lambda - Github issues to Synapse

Write open Github issues to a Synapse table using AWS Lambda.

Usage
  1. Clone this repository.
  2. Create a Python virtual environment virtualenv.
  3. Install dependencies (pip install -r requirements.txt).
  4. From the repository directory, use the following to create the Lambda code as a .zip file:
rt REPODIR=`pwd`
d ${VIRTUAL_ENV}/lib/python2.7/site-packages/
${REPODIR}/lambda-code.zip `find .`

-r ${REPODIR}/lambda-code.zip ${REPODIR}/export_repo_issues_to_synapse.py
  1. Upload to an Amazon S3 bucket:
s3 cp lambda-code.zip s3://my-bucket-for-lambda
  1. Create a Lambda function (best practice is to use an IAM role specifically for this task):
lambda create-function --region us-east-1 --function-name IssuesToSynapse --code S3Bucket=my-bucket-for-lambda,S3Key=lambda-code.zip,S3ObjectVersion=1 --role arn:aws:iam::510534517075:role/MyLambdaRole --handler export_repo_issues_to_synapse.issues_to_table_handler --runtime python2.7 --timeout 100 --memory-size 512
Updating the function

Modifications to the code require re-creating the zip file, uploading to the S3 bucket, and then updating the Lambda function:

lambda update-function-code --function-name IssuesToSynapse --s3-bucket my-bucket-for-lambda --s3-key export_repo_issues_to_synapse.zip
Creating the Synapse table

A Synapse table that uses the following column IDs is required to exist:

15', '4372', '60818', '60819', '60852', '60853', '61041']
Triggering the function

The Lambda function requires an event of the following format:

table_id": "syn123456", "repo": "myusername/myreponame"}

Where the table_id is the same as the one created above, and the repo is the repository from which to get the issues.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.