This repository contains an Azure Function App that serves as a launcher for APBS (Adaptive Poisson-Boltzmann Solver) and PDB2PQR jobs. The function app processes user requests to run molecular electrostatics calculations in the cloud using Azure Container Apps.
The system processes molecular structure files (PDB files) through either PDB2PQR (for structure preparation) or APBS (for electrostatics calculations) using a serverless architecture. The function app acts as a job orchestrator, while the actual computational work happens in container instances.
- Azure Function App: Processes incoming job requests, validates input files, and queues jobs for execution
- Azure Blob Storage: Stores input and output files
- Azure Queue Storage: Manages job execution queue
- Azure Container Apps: Executes the actual APBS/PDB2PQR calculations
- Azure Event Grid: The low-latency event trigger platform
- User submits a job to the system with PDB files and parameters
- The Function App's blob trigger activates when a job configuration JSON file is uploaded
- The app validates input files and parameters
- Job status is initialized and stored in blob storage
- Job information is placed in a queue for processing
- A Container App is started to process the queued job
- Results are stored back in blob storage and status is updated
- /.github/workflows/: CI/CD workflows for deployment to Azure
- dev_apbs-azure-job-queue-function(dev).yml: Deployment workflow for dev branch
- main_apbs-azure-job-queue-function.yml: Deployment workflow for main branch
- /launcher/: Core business logic modules
- apbs.py: APBS job setup
- azure_storage_utils.py: Azure Blob Storage utilities
- jobsetup.py: Base job setup class
- pdb2pqr.py: PDB2PQR job setup
- utils.py: Utility functions and helper classes
- weboptions.py: Web form options processing
- function_app.py: Main Azure Function App definition and triggers
- host.json: Function App configuration
- requirements.txt: Python dependencies
The system supports two primary job types:
- PDB2PQR: Prepares molecular structures for electrostatics calculations
- APBS: Calculates electrostatic properties of molecules using the Poisson-Boltzmann equation
NOTE: Be VERY intentional in setting these up since if these aren't set the function will not deploy
The function app requires these environment variables:
BlobStorageConnectionString: Connection string for Azure Blob Storage.- To find this, go to Security + Networking > Access keys. Be careful, this string has lots of power.
CONTAINER_APP_CLIENT_ID: Managed Identity client ID- This maps to a role created to interact with the creating a contrainer app job
- This gets created by apbs-deploy-azure and is named
apbs-container-app-access
SUBSCRIPTION_ID: Azure subscription IDRESOURCE_GROUP_NAME: Resource group containing Container Apps- This gets created by apbs-deploy-azure and is named
apbs-backend
- This gets created by apbs-deploy-azure and is named
JOB_NAME: Container App Job name- This gets created by apbs-deploy-azure and is named
apbs-app
- This gets created by apbs-deploy-azure and is named
OutputQueue__credential: This should be set tomanagedIdentityOutputQueue__clientId: The client ID for the managed identity used to access the output queue- This gets created by apbs-deploy-azure and is named
apbs-backend-data-access - Find this in Managed Identites >
apbs-backend-data-access> Client ID
- This gets created by apbs-deploy-azure and is named
OutputQueue__serviceUri: The URI of the queue- Find this in your storage account Data Storage > Queues > Url
- Create a function app.
- Setup your deployment from this repo. We use a modified version in the GitHub Actions seen above because we found it works better than what is provided by Azure.
- Setup your environment variables from above.
- For the roles mentioned above, ensure they are added to the function app via the UI.
The repository includes GitHub Actions workflows for CI/CD:
- Push to
devbranch deploys to the dev slot - Push to
mainbranch deploys to production
If you are setting this workflow up yourself, you will need to create two deployment slots and set the above environment variables in your slot also. This ensures that your dev slot also has the correct access to the variables.
Key dependencies include:
- Azure Functions Core
- Azure Blob Storage SDK
- Azure Identity
- Azure Container Apps Management SDK
- Clone the repository
- Create Python virtual environment:
python -m venv venv source venv/bin/activate - Install dependencies:
pip install -r requirements.txt - Install Azure Functions Core Tools version 4
- Set up local.settings.json with required environment variables
- Run the function app locally:
func start