SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
CloudBridge
A Simple Cross-Cloud Python Library
Nuwan Goonasekera, Andrew Lonie, James Taylor, Enis Afgan
Outline
● Background and motivation
● Evaluation of available options
● CloudBridge
○ Design philosophy
○ Testing philosophy
○ Structure
○ Code Samples
● Demo
○ CloudLaunch
● Using
● Contributing
● Questions
Why?
● We needed to make the Genomics Virtual Lab/Galaxy CloudMan
cloud independent
○ Original version written against Amazon’s EC2 APIs
○ Ran on OpenStack using OpenStack’s EC2 Compatibility Layer
● OpenStack EC2 compatibility layer had limitations
○ Stability issues
○ Lacked features: Cannot name instances, cannot specify root volume sizes etc.
etc.
○ Deprecated - being spun off as separate project
● Go Native! - native APIs were
○ More stable
○ Cutting edge
○ Not likely to be dropped
The Available Options
● Apache Libcloud
○ The obvious candidate
○ Supports more than 30 providers
○ Supports Python 2.5 - 3
● HTTP abstraction layers
○ e.g. Apache DeltaCloud, Dasein Cloud
○ Need to run a separate HTTP service
○ Service would abstract away the specific clouds
● Build your own abstraction
○ NIH syndrome?
○ Differences between clouds can be complicated
○ How do you get access to so many clouds anyway?
Apache Libcloud Design
● Offers a lowest-common-denominator approach
○ Pros
■ Widest possible compatibility
■ Over 30 providers
■ Supports many versions of Python
■ Basic abstraction standardised
○ Cons
■ Everything else exposed as a provider specific extension (“ex_”)
■ Lots of methods/properties are “ex_”:
● ex_list_availability_zones
● def create_node(ex_keyname, ex_userdata..)
● ex_create_security_group
● ex_create_floating_ip etc.
○ In practice, requires special-cased code, unless requirements are very modest.
Apache Libcloud Design (contd…)
● Wraps libraries at a ReST/HTTP level, instead of using native SDKs
○ Pros
■ Minimises dependencies
■ Gives control over client-side implementation
○ Cons
■ Slower to incorporate features over native SDKs
■ Significant duplication of work
● Boto is over 77,000 lines of code
● Libcloud weighing in at 250,000+
Apache Libcloud Design (contd…)
● Testing is largely provider specific
○ This is because the exposed methods tend to be provider specific
○ Does not guarantee a write-once-run-anywhere experience
○ Makes it difficult to support a large number of clouds in practice
■ How do you test against many clouds yourself?
■ How do you even get access to so many clouds?
Apache Libcloud Design (contd…)
Does not offer a way to determine provider feature sets/profiles at runtime
Makes it difficult to write cross-cloud code
Meanwhile...
Mature clouds are converging in terms of functionality and scope
Making a single, uniform interface possible
Desirable requirements
● Need a write-once, run-anywhere experience
● Should not need to special-case code on a per cloud basis
○ Cannot obtain access to clouds easily
○ Don’t have the time to test them on each
● Simple and Pythonic
Tradeoffs
● Skip on widest possible compatibility
● Fine-grained feature determination
CloudBridge
A Simple Cross-Cloud Python Library
CloudBridge Design Goals
1. Offer a uniform API irrespective of the underlying provider
a. No special casing of application code
b. Simpler code
2. Provide a set of conformance tests for all supported clouds
a. No need to test against each cloud
b. Goal of “write-once-run-anywhere”
3. Focus on mature clouds with a required minimal set of features
a. Enables 1 and 2
4. Be as thin as possible
a. Keep the code-simple and reuse existing work ⟶ greater reliability, reduced development time
CloudBridge Testing Goals
1. Write one set of tests that all provider implementations must pass
2. Make the tests a ‘conformance’ test suite
● Validate that each implementation correctly implements the CloudBridge specification
3. No provider specific testing required
● A provider which passes the test suite can be used safely by an application with no additional
provider specific testing
4. Tests must pass against real infrastructure
● Mocks used to speed-up feedback
● But same tests must pass on real infrastructure
5. Aim for 100% code coverage
Automated testing using Travis
Testing py27, py35,
pypy
On OpenStack
(DevStack) and Mock
AWS (moto)
CloudBridge Design
API revolves around 3 concepts
a. Providers
An entry point for a service, encapsulating a connection
b. Services
Exposes provider functionality/feature sets
c. Resources
A remote cloud resource, such a Machine Instance, Volume etc.
Provider Service Resource Detail
Service name list get find create
InstanceService yes yes yes yes
VolumeService yes yes yes yes
SnapshotService yes yes yes yes
ImageService yes yes yes no
NetworkService yes yes yes yes
SubnetService yes yes no yes
ObjectStoreService yes yes yes yes
KeyPairService yes yes yes yes
SecurityGroupService yes yes yes yes
InstanceTypeService yes yes yes N/A
RegionService yes yes no N/A
Service feature set
Services have consistent interfaces:
<ServiceName>.[list|get|find|create]()
Resource feature
set
Resources have a common set of basic
properties: id, name
Plus fields and methods appropriate for
that resource type
Sample code: provider setup
$ pip install cloudbridge
1. from cloudbridge.cloud.factory import CloudProviderFactory
2. from cloudbridge.cloud.factory import ProviderList
3. aws_config = {'aws_access_key': 'a_key', 'aws_secret_key': 's_key')
4. provider = CloudProviderFactory().create_provider(ProviderList.AWS, aws_config)
5. os_config = {'os_username': 'username',
'os_password': 'pwd',
'os_tenant_name': 'tenant',
'os_auth_url': 'url',
'os_region_name': 'region'}
6. provider = CloudProviderFactory().create_provider(ProviderList.OPENSTACK, os_config)
OpenStack
AWS
Sample code: launch an instance
1. kp = provider.security.key_pairs.create('cloudbridge_intro')
2. with open('cloudbridge_intro.pem', 'w') as f:
3. f.write(kp.material)
4. sg = provider.security.security_groups.create(
5. 'cloudbridge_intro', 'A security group used by CloudBridge')
6. sg.add_rule('tcp', 22, 22, '0.0.0.0/0')
7. img = provider.compute.images.get(image_id)
8. inst_type = sorted([t for t in provider.compute.instance_types.list() if t.vcpus >= 2 and t.ram >= 4],
key=lambda x: x.vcpus*x.ram)[0]
9. inst = provider.compute.instances.create(
name='CloudBridge-intro', image=img, instance_type=inst_type,
key_pair=kp, security_groups=[sg])
10. # Wait until ready
11. inst.wait_till_ready()
12. # Show instance state
13. inst.state
14. # 'running'
15. inst.public_ips
16. # [u'54.166.125.219']
Create a key pair
Create a security group
Launch an instance
Currently Supported
cloudbridge.readthedocs.org
Get started guide
Usage guide
Contributor guide
API reference
A quick demo: CloudLaunch
CloudLaunch is a general-purpose cloud launcher
○ Multi-cloud
○ ReST API driven with Angular 2 front end
○ Built on CloudBridge and Django Rest Framework
http://beta.launch.usegalaxy.org/
Using/Contributing/Source Code
https://github.com/gvlproject/cloudbridge
http://cloudbridge.readthedocs.org/
Acknowledgments

Mais conteúdo relacionado

Mais procurados

Docker swarm
Docker swarmDocker swarm
Docker swarm
Kalkey
 

Mais procurados (20)

Docker swarm
Docker swarmDocker swarm
Docker swarm
 
Coordinating Micro-Services with Spring Cloud Contract
Coordinating Micro-Services with Spring Cloud ContractCoordinating Micro-Services with Spring Cloud Contract
Coordinating Micro-Services with Spring Cloud Contract
 
Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NET
 
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 Flow
 
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: DevOps workflow with Docker on AWSCloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
 
The new Netflix API
The new Netflix APIThe new Netflix API
The new Netflix API
 
Multi host container networking
Multi host container networkingMulti host container networking
Multi host container networking
 
Docker & ECS: Secure Nearline Execution
Docker & ECS: Secure Nearline ExecutionDocker & ECS: Secure Nearline Execution
Docker & ECS: Secure Nearline Execution
 
Netflix Open Source Meetup Season 4 Episode 3
Netflix Open Source Meetup Season 4 Episode 3Netflix Open Source Meetup Season 4 Episode 3
Netflix Open Source Meetup Season 4 Episode 3
 
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
 
Sebastien goasguen cloud stack and docker
Sebastien goasguen   cloud stack and dockerSebastien goasguen   cloud stack and docker
Sebastien goasguen cloud stack and docker
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 
AWS Primer and Quickstart
AWS Primer and QuickstartAWS Primer and Quickstart
AWS Primer and Quickstart
 
Building Micro-Services with Scala
Building Micro-Services with ScalaBuilding Micro-Services with Scala
Building Micro-Services with Scala
 
Writing your First Ansible Playbook
Writing your First Ansible PlaybookWriting your First Ansible Playbook
Writing your First Ansible Playbook
 
How to Build Your First Web App in Go
How to Build Your First Web App in GoHow to Build Your First Web App in Go
How to Build Your First Web App in Go
 
Onnx and onnx runtime
Onnx and onnx runtimeOnnx and onnx runtime
Onnx and onnx runtime
 
20170831 - Greg Palmier: Terraform & AWS at Tempus
20170831 - Greg Palmier: Terraform & AWS at Tempus20170831 - Greg Palmier: Terraform & AWS at Tempus
20170831 - Greg Palmier: Terraform & AWS at Tempus
 
Wido den hollander cloud stack and ceph
Wido den hollander   cloud stack and cephWido den hollander   cloud stack and ceph
Wido den hollander cloud stack and ceph
 

Semelhante a 2016 07 - CloudBridge Python library (XSEDE16)

Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...
Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...
Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...
Alex Maclinovsky
 

Semelhante a 2016 07 - CloudBridge Python library (XSEDE16) (20)

Columbus AWS Meetup: AWS Certifications
Columbus AWS Meetup: AWS CertificationsColumbus AWS Meetup: AWS Certifications
Columbus AWS Meetup: AWS Certifications
 
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
 
Power of Azure Devops
Power of Azure DevopsPower of Azure Devops
Power of Azure Devops
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the Cloud
 
AWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for Government
 
Learn about AWS Certifications - Andrew May, Columbus
Learn about AWS Certifications - Andrew May, ColumbusLearn about AWS Certifications - Andrew May, Columbus
Learn about AWS Certifications - Andrew May, Columbus
 
How (and why) to roll your own Docker SaaS
How (and why) to roll your own Docker SaaSHow (and why) to roll your own Docker SaaS
How (and why) to roll your own Docker SaaS
 
Automate Software Deployments on EC2 with AWS CodeDeploy
Automate Software Deployments on EC2 with AWS CodeDeployAutomate Software Deployments on EC2 with AWS CodeDeploy
Automate Software Deployments on EC2 with AWS CodeDeploy
 
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
DevOps, Continuous Integration and Deployment on AWS: Putting Money Back into...
 
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
 
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
 
SRV312 DevOps on AWS: Building Systems to Deliver Faster
SRV312 DevOps on AWS: Building Systems to Deliver FasterSRV312 DevOps on AWS: Building Systems to Deliver Faster
SRV312 DevOps on AWS: Building Systems to Deliver Faster
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
 
AWS Summit Auckland - Introducing Well-Architected for Developers
AWS Summit Auckland  - Introducing Well-Architected for DevelopersAWS Summit Auckland  - Introducing Well-Architected for Developers
AWS Summit Auckland - Introducing Well-Architected for Developers
 
Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...
Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...
Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...
 
Evaluating Cloud Native Storage Vendors - DoK Talks #147
Evaluating Cloud Native Storage Vendors - DoK Talks #147Evaluating Cloud Native Storage Vendors - DoK Talks #147
Evaluating Cloud Native Storage Vendors - DoK Talks #147
 
Andrew May - Getting Certified for Fun and Profit
Andrew May - Getting Certified for Fun and ProfitAndrew May - Getting Certified for Fun and Profit
Andrew May - Getting Certified for Fun and Profit
 
Azure serverless architectures
Azure serverless architecturesAzure serverless architectures
Azure serverless architectures
 
Building self service framework
Building self service frameworkBuilding self service framework
Building self service framework
 

Mais de Enis Afgan

GCC 2014 scriptable workshop
GCC 2014 scriptable workshopGCC 2014 scriptable workshop
GCC 2014 scriptable workshop
Enis Afgan
 
Galaxy workshop
Galaxy workshopGalaxy workshop
Galaxy workshop
Enis Afgan
 
CloudMan workshop
CloudMan workshopCloudMan workshop
CloudMan workshop
Enis Afgan
 

Mais de Enis Afgan (17)

Federated Galaxy: Biomedical Computing at the Frontier
Federated Galaxy: Biomedical Computing at the FrontierFederated Galaxy: Biomedical Computing at the Frontier
Federated Galaxy: Biomedical Computing at the Frontier
 
From laptop to super-computer: standardizing installation and management of G...
From laptop to super-computer: standardizing installation and management of G...From laptop to super-computer: standardizing installation and management of G...
From laptop to super-computer: standardizing installation and management of G...
 
Horizontal scaling with Galaxy
Horizontal scaling with GalaxyHorizontal scaling with Galaxy
Horizontal scaling with Galaxy
 
Endofday: A Container Workflow Engine for Scalable, Reproducible Computation
Endofday: A Container Workflow Engine for Scalable, Reproducible ComputationEndofday: A Container Workflow Engine for Scalable, Reproducible Computation
Endofday: A Container Workflow Engine for Scalable, Reproducible Computation
 
2017.07.19 Galaxy & Jetstream cloud
2017.07.19 Galaxy & Jetstream cloud2017.07.19 Galaxy & Jetstream cloud
2017.07.19 Galaxy & Jetstream cloud
 
Resource planning on the (Amazon) cloud
Resource planning on the (Amazon) cloudResource planning on the (Amazon) cloud
Resource planning on the (Amazon) cloud
 
The pulse of cloud computing with bioinformatics as an example
The pulse of cloud computing with bioinformatics as an exampleThe pulse of cloud computing with bioinformatics as an example
The pulse of cloud computing with bioinformatics as an example
 
Cloud computing and bioinformatics
Cloud computing and bioinformaticsCloud computing and bioinformatics
Cloud computing and bioinformatics
 
Galaxy CloudMan performance on AWS
Galaxy CloudMan performance on AWSGalaxy CloudMan performance on AWS
Galaxy CloudMan performance on AWS
 
Adding Transparency and Automation into the Galaxy Tool Installation Process
Adding Transparency and Automation into the Galaxy Tool Installation ProcessAdding Transparency and Automation into the Galaxy Tool Installation Process
Adding Transparency and Automation into the Galaxy Tool Installation Process
 
Enabling Cloud Bursting for Life Sciences within Galaxy
Enabling Cloud Bursting for Life Sciences within GalaxyEnabling Cloud Bursting for Life Sciences within Galaxy
Enabling Cloud Bursting for Life Sciences within Galaxy
 
Introduction to Galaxy and RNA-Seq
Introduction to Galaxy and RNA-SeqIntroduction to Galaxy and RNA-Seq
Introduction to Galaxy and RNA-Seq
 
IRB Galaxy CloudMan radionica
IRB Galaxy CloudMan radionicaIRB Galaxy CloudMan radionica
IRB Galaxy CloudMan radionica
 
GCC 2014 scriptable workshop
GCC 2014 scriptable workshopGCC 2014 scriptable workshop
GCC 2014 scriptable workshop
 
Data analysis with Galaxy on the Cloud
Data analysis with Galaxy on the CloudData analysis with Galaxy on the Cloud
Data analysis with Galaxy on the Cloud
 
Galaxy workshop
Galaxy workshopGalaxy workshop
Galaxy workshop
 
CloudMan workshop
CloudMan workshopCloudMan workshop
CloudMan workshop
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

2016 07 - CloudBridge Python library (XSEDE16)

  • 1. CloudBridge A Simple Cross-Cloud Python Library Nuwan Goonasekera, Andrew Lonie, James Taylor, Enis Afgan
  • 2. Outline ● Background and motivation ● Evaluation of available options ● CloudBridge ○ Design philosophy ○ Testing philosophy ○ Structure ○ Code Samples ● Demo ○ CloudLaunch ● Using ● Contributing ● Questions
  • 3. Why? ● We needed to make the Genomics Virtual Lab/Galaxy CloudMan cloud independent ○ Original version written against Amazon’s EC2 APIs ○ Ran on OpenStack using OpenStack’s EC2 Compatibility Layer ● OpenStack EC2 compatibility layer had limitations ○ Stability issues ○ Lacked features: Cannot name instances, cannot specify root volume sizes etc. etc. ○ Deprecated - being spun off as separate project ● Go Native! - native APIs were ○ More stable ○ Cutting edge ○ Not likely to be dropped
  • 4. The Available Options ● Apache Libcloud ○ The obvious candidate ○ Supports more than 30 providers ○ Supports Python 2.5 - 3 ● HTTP abstraction layers ○ e.g. Apache DeltaCloud, Dasein Cloud ○ Need to run a separate HTTP service ○ Service would abstract away the specific clouds ● Build your own abstraction ○ NIH syndrome? ○ Differences between clouds can be complicated ○ How do you get access to so many clouds anyway?
  • 5. Apache Libcloud Design ● Offers a lowest-common-denominator approach ○ Pros ■ Widest possible compatibility ■ Over 30 providers ■ Supports many versions of Python ■ Basic abstraction standardised ○ Cons ■ Everything else exposed as a provider specific extension (“ex_”) ■ Lots of methods/properties are “ex_”: ● ex_list_availability_zones ● def create_node(ex_keyname, ex_userdata..) ● ex_create_security_group ● ex_create_floating_ip etc. ○ In practice, requires special-cased code, unless requirements are very modest.
  • 6. Apache Libcloud Design (contd…) ● Wraps libraries at a ReST/HTTP level, instead of using native SDKs ○ Pros ■ Minimises dependencies ■ Gives control over client-side implementation ○ Cons ■ Slower to incorporate features over native SDKs ■ Significant duplication of work ● Boto is over 77,000 lines of code ● Libcloud weighing in at 250,000+
  • 7. Apache Libcloud Design (contd…) ● Testing is largely provider specific ○ This is because the exposed methods tend to be provider specific ○ Does not guarantee a write-once-run-anywhere experience ○ Makes it difficult to support a large number of clouds in practice ■ How do you test against many clouds yourself? ■ How do you even get access to so many clouds?
  • 8. Apache Libcloud Design (contd…) Does not offer a way to determine provider feature sets/profiles at runtime Makes it difficult to write cross-cloud code
  • 9. Meanwhile... Mature clouds are converging in terms of functionality and scope Making a single, uniform interface possible
  • 10. Desirable requirements ● Need a write-once, run-anywhere experience ● Should not need to special-case code on a per cloud basis ○ Cannot obtain access to clouds easily ○ Don’t have the time to test them on each ● Simple and Pythonic Tradeoffs ● Skip on widest possible compatibility ● Fine-grained feature determination
  • 12. CloudBridge Design Goals 1. Offer a uniform API irrespective of the underlying provider a. No special casing of application code b. Simpler code 2. Provide a set of conformance tests for all supported clouds a. No need to test against each cloud b. Goal of “write-once-run-anywhere” 3. Focus on mature clouds with a required minimal set of features a. Enables 1 and 2 4. Be as thin as possible a. Keep the code-simple and reuse existing work ⟶ greater reliability, reduced development time
  • 13. CloudBridge Testing Goals 1. Write one set of tests that all provider implementations must pass 2. Make the tests a ‘conformance’ test suite ● Validate that each implementation correctly implements the CloudBridge specification 3. No provider specific testing required ● A provider which passes the test suite can be used safely by an application with no additional provider specific testing 4. Tests must pass against real infrastructure ● Mocks used to speed-up feedback ● But same tests must pass on real infrastructure 5. Aim for 100% code coverage
  • 14. Automated testing using Travis Testing py27, py35, pypy On OpenStack (DevStack) and Mock AWS (moto)
  • 15. CloudBridge Design API revolves around 3 concepts a. Providers An entry point for a service, encapsulating a connection b. Services Exposes provider functionality/feature sets c. Resources A remote cloud resource, such a Machine Instance, Volume etc.
  • 17. Service name list get find create InstanceService yes yes yes yes VolumeService yes yes yes yes SnapshotService yes yes yes yes ImageService yes yes yes no NetworkService yes yes yes yes SubnetService yes yes no yes ObjectStoreService yes yes yes yes KeyPairService yes yes yes yes SecurityGroupService yes yes yes yes InstanceTypeService yes yes yes N/A RegionService yes yes no N/A Service feature set Services have consistent interfaces: <ServiceName>.[list|get|find|create]() Resource feature set Resources have a common set of basic properties: id, name Plus fields and methods appropriate for that resource type
  • 18. Sample code: provider setup $ pip install cloudbridge 1. from cloudbridge.cloud.factory import CloudProviderFactory 2. from cloudbridge.cloud.factory import ProviderList 3. aws_config = {'aws_access_key': 'a_key', 'aws_secret_key': 's_key') 4. provider = CloudProviderFactory().create_provider(ProviderList.AWS, aws_config) 5. os_config = {'os_username': 'username', 'os_password': 'pwd', 'os_tenant_name': 'tenant', 'os_auth_url': 'url', 'os_region_name': 'region'} 6. provider = CloudProviderFactory().create_provider(ProviderList.OPENSTACK, os_config) OpenStack AWS
  • 19. Sample code: launch an instance 1. kp = provider.security.key_pairs.create('cloudbridge_intro') 2. with open('cloudbridge_intro.pem', 'w') as f: 3. f.write(kp.material) 4. sg = provider.security.security_groups.create( 5. 'cloudbridge_intro', 'A security group used by CloudBridge') 6. sg.add_rule('tcp', 22, 22, '0.0.0.0/0') 7. img = provider.compute.images.get(image_id) 8. inst_type = sorted([t for t in provider.compute.instance_types.list() if t.vcpus >= 2 and t.ram >= 4], key=lambda x: x.vcpus*x.ram)[0] 9. inst = provider.compute.instances.create( name='CloudBridge-intro', image=img, instance_type=inst_type, key_pair=kp, security_groups=[sg]) 10. # Wait until ready 11. inst.wait_till_ready() 12. # Show instance state 13. inst.state 14. # 'running' 15. inst.public_ips 16. # [u'54.166.125.219'] Create a key pair Create a security group Launch an instance
  • 21. cloudbridge.readthedocs.org Get started guide Usage guide Contributor guide API reference
  • 22. A quick demo: CloudLaunch CloudLaunch is a general-purpose cloud launcher ○ Multi-cloud ○ ReST API driven with Angular 2 front end ○ Built on CloudBridge and Django Rest Framework http://beta.launch.usegalaxy.org/