https://github.com/agnostiqhq/covalent-awslambda-plugin

Executor plugin interfacing Covalent with AWS Lambda

https://github.com/agnostiqhq/covalent-awslambda-plugin

Science Score: 39.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.6%) to scientific vocabulary

Keywords

aws-lambda covalent parallelization pipelines python serverless-functions workflow

Keywords from Contributors

data-pipeline hpc-applications machinelearning-python orchestration quantum quantum-computing quantum-machine-learning workflow-automation workflow-management etl
Last synced: 6 months ago · JSON representation

Repository

Executor plugin interfacing Covalent with AWS Lambda

Basic Info
  • Host: GitHub
  • Owner: AgnostiqHQ
  • License: apache-2.0
  • Language: Python
  • Default Branch: develop
  • Homepage: https://covalent.xyz
  • Size: 459 KB
Statistics
  • Stars: 8
  • Watchers: 10
  • Forks: 1
  • Open Issues: 10
  • Releases: 39
Topics
aws-lambda covalent parallelization pipelines python serverless-functions workflow
Created over 3 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.md

 

[![covalent](https://img.shields.io/badge/covalent-0.177.0-purple)](https://github.com/AgnostiqHQ/covalent) [![python](https://img.shields.io/pypi/pyversions/covalent-awslambda-plugin)](https://github.com/AgnostiqHQ/covalent-awslambda-plugin) [![tests](https://github.com/AgnostiqHQ/covalent-awslambda-plugin/actions/workflows/tests.yml/badge.svg)](https://github.com/AgnostiqHQ/covalent-awslambda-plugin/actions/workflows/tests.yml) [![codecov](https://codecov.io/gh/AgnostiqHQ/covalent-awslambda-plugin/branch/main/graph/badge.svg?token=QNTR18SR5H)](https://codecov.io/gh/AgnostiqHQ/covalent-awslambda-plugin) [![apache](https://img.shields.io/badge/License-Apache_License_2.0-blue)](https://www.apache.org/licenses/LICENSE-2.0)

Covalent AWS Lambda Plugin

Covalent is a Pythonic workflow tool used to execute tasks on advanced computing hardware. This executor plugin interfaces Covalent with AWS Lambda for dispatching computational tasks.

1. Installation

To use this plugin with Covalent, install it using pip:

sh pip install covalent-awslambda-plugin

2. Usage Example

This is an example of how a workflow can be constructed to use the AWS Lambda executor. In the example, we train a Support Vector Machine (SVM) and use an instance of the executor to execute the train_svm electron. Note that we also require DepsPip which will be required to execute the electrons.

The AWSLambdaExecutor requires a container based AWS lambda function to already have been created in the user's AWS account with its Container image URI configured properly. Users can use Covalent's public Lambda executor registry i.e. public.ecr.aws/covalent/covalent-lambda-executor:stable when creating their Lambda functions. This public ECR registry holds the base container image the lambda function can use to execute tasks from a workflow.

User's can pass in the name of their Lambda function to the constructor using the function_name argument. See our documentation for more details.

```python from numpy.random import permutation from sklearn import svm, datasets import covalent as ct

deps_pip = ct.DepsPip( packages=["numpy==1.23.2", "scikit-learn==1.1.2"] )

executor = ct.executor.AWSLambdaExecutor( functionname="my-lambda-function", s3bucket_name="covalent-lambda-job-resources", )

Use executor plugin to train our SVM model.

@ct.electron( executor=executor, depspip=depspip ) def train_svm(data, C, gamma): X, y = data clf = svm.SVC(C=C, gamma=gamma) clf.fit(X[90:], y[90:]) return clf

@ct.electron def loaddata(): iris = datasets.loadiris() perm = permutation(iris.target.size) iris.data = iris.data[perm] iris.target = iris.target[perm] return iris.data, iris.target

@ct.electron def scoresvm(data, clf): Xtest, ytest = data return clf.score( Xtest[:90], y_test[:90] )

@ct.lattice def runexperiment(C=1.0, gamma=0.7): data = loaddata() clf = trainsvm( data=data, C=C, gamma=gamma ) score = scoresvm( data=data, clf=clf ) return score

Dispatch the workflow.

dispatchid = ct.dispatch(runexperiment)( C=1.0, gamma=0.7 )

Wait for our result and get result value

result = ct.getresult(dispatchid, wait=True).result

print(result) ```

During the execution of the workflow, one can navigate to the UI to see the status of the workflow. Once completed, the above script should also output a value with the score of our model.

sh 0.8666666666666667 In order for the above workflow to run successfully, one has to provision the required cloud resources as mentioned in the section Required AWS Resources.

3. Configuration

There are many configuration options that can be passed into the ct.executor.AWSLambdaExecutor class or by modifying the covalent config file under the section [executors.awslambda]

For more information about all of the possible configuration values, visit our read the docs (RTD) guide for this plugin.

4. Required AWS Resources

In order for workflows to leverage this executor, users must ensure that all the necessary IAM permissions are properly setup and configured. This executor uses the S3 and AWS Lambda services to execute an electron, thus the required IAM roles and policies must be configured correctly. Precisely, the following resources are needed for the executor to run any dispatched electrons properly.

| Resource | Config Name | Description | | ------------ | ---------------- | ----------- | | IAM Role | lambdarolename | The IAM role this lambda will assume during execution of your tasks | | S3 Bucket | s3bucketname | The name of the S3 bucket that the executor can use to store temporary files | | AWS Lambda | function_name | Name of the pre-configured AWS Lambda function use to run tasks

For exact details on how the above resources can be provisioned, visit our read the docs (RTD) guide for this plugin.

Getting Started with Covalent

For more information on how to get started with Covalent, check out the project homepage and the official documentation.

Release Notes

Release notes are available in the Changelog.

Citation

Please use the following citation in any publications:

W. J. Cunningham, S. K. Radha, F. Hasan, J. Kanem, S. W. Neagle, and S. Sanand. Covalent. Zenodo, 2022. https://doi.org/10.5281/zenodo.5903364

License

Covalent is licensed under the Apache 2.0 License. See the LICENSE file or contact the support team for more details.

Owner

  • Name: Agnostiq
  • Login: AgnostiqHQ
  • Kind: organization
  • Email: contact@agnostiq.ai
  • Location: Toronto

Developing Software for Advanced Computing

GitHub Events

Total
  • Push event: 4
Last Year
  • Push event: 4

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 101
  • Total Committers: 11
  • Avg Commits per committer: 9.182
  • Development Distribution Score (DDS): 0.564
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
CovalentOpsBot c****t 44
Alejandro Esquivel ae@a****d 18
Faiyaz Hasan f****z@a****i 13
Venkat Bala v****t@a****i 13
Sankalp Sanand s****p@a****i 4
pre-commit-ci[bot] 6****] 2
Will Cunningham w****7 2
Casey Jao c****y@a****i 2
mpvgithub 1****b 1
Scott Wyman Neagle w****a@p****m 1
Okechukwu Emmanuel Ochia o****u@a****i 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 33
  • Total pull requests: 61
  • Average time to close issues: 27 days
  • Average time to close pull requests: 8 days
  • Total issue authors: 7
  • Total pull request authors: 11
  • Average comments per issue: 0.61
  • Average comments per pull request: 0.85
  • Merged pull requests: 54
  • Bot issues: 0
  • Bot pull requests: 6
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • cjao (10)
  • AlejandroEsquivel (10)
  • kessler-frost (5)
  • venkatBala (4)
  • scottwn (2)
  • Emmanuel289 (1)
  • FyzHsn (1)
Pull Request Authors
  • AlejandroEsquivel (18)
  • venkatBala (14)
  • FyzHsn (11)
  • kessler-frost (5)
  • pre-commit-ci[bot] (3)
  • dependabot[bot] (3)
  • cjao (2)
  • wjcunningham7 (2)
  • mpvgithub (1)
  • Emmanuel289 (1)
  • scottwn (1)
Top Labels
Issue Labels
Team West (4) east (2) Epic (1) feature (1) testing / validation (1) good first issue (1)
Pull Request Labels
dependencies (3) github_actions (2) Team West (1) feature (1) testing / unit tests (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 69 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 42
  • Total maintainers: 1
pypi.org: covalent-awslambda-plugin

Covalent AWS Lambda Executor Plugin

  • Versions: 42
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 69 Last month
Rankings
Dependent packages count: 6.6%
Downloads: 10.9%
Average: 20.4%
Stargazers count: 23.3%
Forks count: 30.5%
Dependent repos count: 30.6%
Maintainers (1)
Last synced: 7 months ago

Dependencies

requirements.txt pypi
  • boto3 ==1.24.35
  • covalent ==0.177.0rc0
tests/requirements.txt pypi
  • flake8 ==3.9.2 test
  • isort ==5.7.0 test
  • mock ==4.0.3 test
  • nbconvert ==6.3.0 test
  • pennylane ==0.16.0 test
  • pre-commit ==2.13.0 test
  • pytest ==6.2.5 test
  • pytest-asyncio ==0.18.3 test
  • pytest-cov ==2.12.0 test
  • pytest-mock ==3.6.1 test
.github/workflows/changelog.yml actions
  • EndBug/add-and-commit v9 composite
  • actions/checkout v3 composite
.github/workflows/changelog_reminder.yml actions
  • actions/checkout master composite
  • peterjgrainger/action-changelog-reminder v1.3.0 composite
.github/workflows/docker.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v4 composite
  • aws-actions/configure-aws-credentials v1 composite
  • docker/build-push-action v2 composite
  • docker/setup-buildx-action v2 composite
  • docker/setup-qemu-action v2 composite
.github/workflows/license.yml actions
  • actions/checkout v3 composite
  • pilosus/action-pip-license-checker main composite
.github/workflows/release.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • ncipollo/release-action v1 composite
.github/workflows/tests.yml actions
  • actions-ecosystem/action-get-latest-tag v1 composite
  • actions/checkout v3 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v3 composite
.github/workflows/version.yml actions
  • actions/checkout v1 composite
  • tj-actions/changed-files v18.4 composite
Dockerfile docker
  • ${COVALENT_BASE_IMAGE} latest build
pyproject.toml pypi
setup.py pypi