Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate or Script deployment of functions #5

Closed
3 tasks
ChristopherMancuso opened this issue Feb 9, 2024 · 3 comments · Fixed by #30
Closed
3 tasks

Automate or Script deployment of functions #5

ChristopherMancuso opened this issue Feb 9, 2024 · 3 comments · Fixed by #30
Assignees

Comments

@ChristopherMancuso
Copy link
Contributor

It would be good to have some scripts that can generate the needed files/scripts for deploying functions for the various hyperparameters

  • Setting up the data needed by each function
  • Writing the main.py and requirements.txt files
  • deploy using gcloud functions deploy command
@falquaddoomi falquaddoomi self-assigned this Feb 22, 2024
@falquaddoomi
Copy link
Collaborator

Storage pricing:

  • After revieiwng a few storage options, Google Cloud Storage (aka GCS) is cheaper than using GitHub LFS
    • we pay ~$0.02/GB/mo for the standard storage class, and storage is free below 5GB. Our current usage of ~2.6GB falls below this, so we're not paying for storage yet. (source: https://cloud.google.com/storage/pricing/#cloud-storage-pricing)
    • network egress from North America (where the GCS bucket is stored) to worldwide locations cost $0.12/GB below 1TB, then becomes cheaper afterward. To deploy all our functions (again, ~2.6GB), it'd cost ~$0.31 per deployment.

GenePlexus storage notes:

  • the data is currently stored in a private GCS bucket at gs://geneplexus-func-data, with subdirectories for each function
    • the data is gzipped and when extracted creates a folder called "data" containing the contents of the gzip

GH Action Caching:

@falquaddoomi
Copy link
Collaborator

Regarding progress, so far I've tested the data retrieval from the bucket (which requires authenticating to GCP using a service account key), extracting the archive, caching, and verifying that the filesystem with the extracted data looks correct. I've been using act to do the action testing, which is surprisingly actually working for once, including emulating a local GH action cache.

I haven't tested actually deploying the functions because I didn't want to mess up the current deployment. @ChristopherMancuso, if you're ok with me trying and potentially having to revert to a previous deployment if things go awry, I can test that, too. FYI, I've been testing with the convert-ids function, since its data requirement is tiny, ~20mb.

@ChristopherMancuso
Copy link
Contributor Author

This all sounds great. I feel like you can mess with the current GCP deployment as much as you want since you set the repo up to use functions-framework, I don't think Vince is actually using the GCP functions, just the local version, right?

@vincerubinetti vincerubinetti linked a pull request Apr 23, 2024 that will close this issue
falquaddoomi added a commit that referenced this issue Apr 24, 2024
Closes #5 

This PR adds one workflow per function (i.e., one for `convert-ids` and
one for `ml`) that redeploys the function whenever anything is merged
into `main` that alters the function's code.

The PR includes a helper workflow, `helper-deploy-func.yaml`, which does
the following:
1. installs the gcloud tools
2. authenticates to GCP as the `cloud-function-deployer` service
account, via a service account credentials file stored as a secret in
this repo
3. pulls the data archive associated with the current function from a
GCS bucket, unless it's already in the GitHub actions cached
4. extracts the data archive, caches the resulting data under a hash of
the data archive
5. deploys the function

Each function mentioned above uses the function deployer helper workflow
to minimize code duplication.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants