SlideShare une entreprise Scribd logo
1  sur  43
Create a simple Service Offering with Python & Solaris Python with Solaris Zones, Dtrace & OCCI MUCOSUG meeting, June 16th, 2011
Create a simple Service Offering with Python & Solaris Warning:Clouds ahead Python with Solaris Zones, Dtrace & OCCI MUCOSUG meeting, June 16th, 2011
Intention: present why Python and Solaris are a perfect fit… 2011 (c) Thijs MetschThis work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
This is just a showcase to demonstrate all necessary ingredients...
Why Python, OCCI and Solaris?
Why Python, OCCI and Solaris? Containers Robustness ZFS SMF DTrace Performance
Why Python, OCCI and Solaris? Innovation RESTful Python Powered Standard Cloud Protocol Containers Robustness ZFS SMF DTrace Performance
Why Python, OCCI and Solaris? Innovation RESTful Readability Simplicity Python Powered Maintainability BDFL Standard Cloud Protocol Development Speed Containers Robustness ZFS SMF DTrace Performance
Why Python, OCCI and Solaris? Innovation RESTful Readability Simplicity Python Powered Maintainability BDFL Standard Cloud Protocol Development Speed Fastest way to create a service and start earning money! Containers Robustness ZFS SMF DTrace Performance
Source: http://xkcd.com/353/
Source: lesher.ws/choose_python.pdf
Cutting edge,Cool & Robust Technology
General Flow
Big Picture* WSGIApp Monitoring ServiceOffering Deployment Developer Manage Access Enduser Solaris Zonewith WSGI App Enduser Solaris Zonewith WSGI App Enduser Solaris Zonewith WSGI App ... ...(Scaling) Monitoring (Analytics) Solaris Box Internet * Everybody needs one
Big Picture* pyOCCI WSGIApp Monitoring OCCI/Mercurial ServiceOffering Deployment Developer Manage Python Access Enduser Solaris Zonewith WSGI App Enduser Solaris Zonewith WSGI App Enduser Solaris Zonewith WSGI App ... ...(Scaling) Monitoring (Analytics) DTrace Solaris Box Website Internet * Everybody needs one
Step 1 – Service definition
A simple WSGI app fromwsgiref.simple_serverimportmake_server defapplication(env,response): response_body='Hello World' status='200 OK' response_headers=[('Content-Type','text/plain'), ('Content-Length',str(len(response_body))) ] response(status,response_headers) return[response_body] httpd=make_server('localhost',4711,application) httpd.handle_request()
Step 2 – Service deployment
[object Object]
During the creation of OCCI we updated implementations periodically
Complete implementation of the Specification ~1000 LOC
Testframe written in Python„The Open Cloud Computing Interface (OCCI) is a RESTfulProtocol and API for all kinds of Management tasks. OCCI was originally initiated to create a remote management API for IaaS model based Services. It has since evolved into a flexible API with a strong focus on integration, portability, interoperability and innovation while still offering a high degree of extensibility. The current release of the Open Cloud Computing Interface is suitable to serve many other models in addition to IaaS, including e.g. PaaS and SaaS.” – http://www.occi-wg.org
[object Object]
During the creation of OCCI we updated implementations periodically
Complete implementation of the Specification ~1000 LOC
Testframe written in Python„The Open Cloud Computing Interface (OCCI) is a RESTfulProtocol and API for all kinds of Management tasks. OCCI was originally initiated to create a remote management API for IaaS model based Services. It has since evolved into a flexible API with a strong focus on integration, portability, interoperability and innovation while still offering a high degree of extensibility. The current release of the Open Cloud Computing Interface is suitable to serve many other models in addition to IaaS, including e.g. PaaS and SaaS.” – http://www.occi-wg.org Python based OCCI implementation: pyOCCI
Step 3 – Backen Magic
Python is ideal to create a (Scalable/Cloud) Service -Very easy to integrate with other services (e.g. For Authentication, DBs, Messaging, SCM...)
Python is ideal to create a (Scalable/Cloud) Service -Very easy to integrate with other services (e.g. For Authentication, DBs, Messaging, SCM...) For Data transfer: e.g. Uploading the WSGI through mercurial
Integration with LDAP, CouchDB, AMQP importldap server=ldap.initialize('ldap://localhost:8080') server.search_s('dc=example,dc=com',ldap.SCOPE_SUBTREE,'(cn=foo*)',['cn','mail']) importcouchdb couch=couchdb.Server('http://localhost:5984/') db=couch['services'] doc={'user':'foo'} db.save(doc) importpika connection=pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) channel=connection.channel() channel.queue_declare(queue='hello') channel.basic_publish(exchange='',routing_key='hello',body='Hello World!') connection.close()
Now let‘s handle Resource Pools & Zones (OS Integration) with Python
Wrapping zone.h with SWIG... $ make all       swig -Wall -python pyzone.i gcc -I/usr/include/python2.6 -c pyzone_wrap.c ld -shared pyzone_wrap.o -o _pyzone.so  $ cat test.py    import pyzone zones = pyzone.zone_list() print len(zones) # equal to: pyzone.get_nr_of_act_zones() print zones $ python test.py 2 ['global', 'foo'] I can release this if there is interest…
Step 4 – Using the service
Batteries included (for the Client) ... importhttplib connection=httplib.HTTPConnection('localhost:8080') connection.request('GET','/') r1=connection.getresponse() printr1.status,r1.reason importjson printjson.dumps({'msg':'Hello World'},sort_keys=True,indent=2) Python also offers many GUI frameworks – also build-in (and therefore available on all platforms/clients) is Tk (Easy to use with pytkgen*)... * Creates Tk based GUIs from JSON definition files.
Step 5 – Monitoring
You can user Dtrace to monitor the ZFS, Zones, Network etc.
You can also create stuff like this... Source: http://wiki.joyent.com/display/node/Using+Cloud+Analytics
Or even trace Python itself...
Check if Python probes are available $ pfexec dtrace -ln 'python*:::'   ID   PROVIDER            MODULE                          FUNCTION NAME 9398  python861 libpython2.6.so.1.0                PyEval_EvalFrameEx function-entry 9399  python861 libpython2.6.so.1.0                      dtrace_entry function-entry 9400  python861 libpython2.6.so.1.0                PyEval_EvalFrameEx function-return 9401  python861 libpython2.6.so.1.0                     dtrace_return function-return
Check if Python probes are available $ pfexec dtrace -ln 'python*:::'   ID   PROVIDER            MODULE                          FUNCTION NAME 9398  python861 libpython2.6.so.1.0                PyEval_EvalFrameEx function-entry 9399  python861 libpython2.6.so.1.0                      dtrace_entry function-entry 9400  python861 libpython2.6.so.1.0                PyEval_EvalFrameEx function-return 9401  python861 libpython2.6.so.1.0                     dtrace_return function-return If you need more you could tinker around with ceval.c in the Python sources
Count calls #pragma D option quietpython*:::function-entry/(self->name = copyinstr(arg0)) != NULL && self->name >= "/export/home/tmetsch/data/workspace/pyssf/pyocci/" /{    @[copyinstr(arg0)] = count();    self->ts=timestamp;}  $ pfexec dtrace -s ./test2.d   /export/home/tmetsch/data/workspace/pyssf/pyocci/examples/vm_skeleton.py                9
Count calls #pragma D option quietpython*:::function-entry/(self->name = copyinstr(arg0)) != NULL && self->name >= "/export/home/tmetsch/data/workspace/pyssf/pyocci/" /{    @[copyinstr(arg0)] = count();    self->ts=timestamp;}  Predicate $ pfexec dtrace -s ./test2.d   /export/home/tmetsch/data/workspace/pyssf/pyocci/examples/vm_skeleton.py                9
Trace the flow... #pragma D option quietpython*:::function-entry/(self->name = copyinstr(arg0)) != NULL && self->name == "/export/home/tmetsch/data/workspace/pyssf/pyocci/core.py" /{    printf("step into: %s %s ", copyinstr(arg1), copyinstr(arg0));    self->traced = 1}python*:::function-return/self->traced/{    printf("back from: %s ", copyinstr(arg1));    self->traced = 0}

Contenu connexe

Dernier

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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...Martijn de Jong
 
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 CVKhem
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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 WorkerThousandEyes
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
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 DevelopmentsTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Dernier (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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...
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Simple Service Offering with Python, Solaris, OCCI and DTrace

  • 1. Create a simple Service Offering with Python & Solaris Python with Solaris Zones, Dtrace & OCCI MUCOSUG meeting, June 16th, 2011
  • 2. Create a simple Service Offering with Python & Solaris Warning:Clouds ahead Python with Solaris Zones, Dtrace & OCCI MUCOSUG meeting, June 16th, 2011
  • 3. Intention: present why Python and Solaris are a perfect fit… 2011 (c) Thijs MetschThis work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
  • 4. This is just a showcase to demonstrate all necessary ingredients...
  • 5. Why Python, OCCI and Solaris?
  • 6. Why Python, OCCI and Solaris? Containers Robustness ZFS SMF DTrace Performance
  • 7. Why Python, OCCI and Solaris? Innovation RESTful Python Powered Standard Cloud Protocol Containers Robustness ZFS SMF DTrace Performance
  • 8. Why Python, OCCI and Solaris? Innovation RESTful Readability Simplicity Python Powered Maintainability BDFL Standard Cloud Protocol Development Speed Containers Robustness ZFS SMF DTrace Performance
  • 9. Why Python, OCCI and Solaris? Innovation RESTful Readability Simplicity Python Powered Maintainability BDFL Standard Cloud Protocol Development Speed Fastest way to create a service and start earning money! Containers Robustness ZFS SMF DTrace Performance
  • 12. Cutting edge,Cool & Robust Technology
  • 14. Big Picture* WSGIApp Monitoring ServiceOffering Deployment Developer Manage Access Enduser Solaris Zonewith WSGI App Enduser Solaris Zonewith WSGI App Enduser Solaris Zonewith WSGI App ... ...(Scaling) Monitoring (Analytics) Solaris Box Internet * Everybody needs one
  • 15. Big Picture* pyOCCI WSGIApp Monitoring OCCI/Mercurial ServiceOffering Deployment Developer Manage Python Access Enduser Solaris Zonewith WSGI App Enduser Solaris Zonewith WSGI App Enduser Solaris Zonewith WSGI App ... ...(Scaling) Monitoring (Analytics) DTrace Solaris Box Website Internet * Everybody needs one
  • 16. Step 1 – Service definition
  • 17. A simple WSGI app fromwsgiref.simple_serverimportmake_server defapplication(env,response): response_body='Hello World' status='200 OK' response_headers=[('Content-Type','text/plain'), ('Content-Length',str(len(response_body))) ] response(status,response_headers) return[response_body] httpd=make_server('localhost',4711,application) httpd.handle_request()
  • 18. Step 2 – Service deployment
  • 19.
  • 20. During the creation of OCCI we updated implementations periodically
  • 21. Complete implementation of the Specification ~1000 LOC
  • 22. Testframe written in Python„The Open Cloud Computing Interface (OCCI) is a RESTfulProtocol and API for all kinds of Management tasks. OCCI was originally initiated to create a remote management API for IaaS model based Services. It has since evolved into a flexible API with a strong focus on integration, portability, interoperability and innovation while still offering a high degree of extensibility. The current release of the Open Cloud Computing Interface is suitable to serve many other models in addition to IaaS, including e.g. PaaS and SaaS.” – http://www.occi-wg.org
  • 23.
  • 24. During the creation of OCCI we updated implementations periodically
  • 25. Complete implementation of the Specification ~1000 LOC
  • 26. Testframe written in Python„The Open Cloud Computing Interface (OCCI) is a RESTfulProtocol and API for all kinds of Management tasks. OCCI was originally initiated to create a remote management API for IaaS model based Services. It has since evolved into a flexible API with a strong focus on integration, portability, interoperability and innovation while still offering a high degree of extensibility. The current release of the Open Cloud Computing Interface is suitable to serve many other models in addition to IaaS, including e.g. PaaS and SaaS.” – http://www.occi-wg.org Python based OCCI implementation: pyOCCI
  • 27. Step 3 – Backen Magic
  • 28. Python is ideal to create a (Scalable/Cloud) Service -Very easy to integrate with other services (e.g. For Authentication, DBs, Messaging, SCM...)
  • 29. Python is ideal to create a (Scalable/Cloud) Service -Very easy to integrate with other services (e.g. For Authentication, DBs, Messaging, SCM...) For Data transfer: e.g. Uploading the WSGI through mercurial
  • 30. Integration with LDAP, CouchDB, AMQP importldap server=ldap.initialize('ldap://localhost:8080') server.search_s('dc=example,dc=com',ldap.SCOPE_SUBTREE,'(cn=foo*)',['cn','mail']) importcouchdb couch=couchdb.Server('http://localhost:5984/') db=couch['services'] doc={'user':'foo'} db.save(doc) importpika connection=pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) channel=connection.channel() channel.queue_declare(queue='hello') channel.basic_publish(exchange='',routing_key='hello',body='Hello World!') connection.close()
  • 31. Now let‘s handle Resource Pools & Zones (OS Integration) with Python
  • 32. Wrapping zone.h with SWIG... $ make all swig -Wall -python pyzone.i gcc -I/usr/include/python2.6 -c pyzone_wrap.c ld -shared pyzone_wrap.o -o _pyzone.so $ cat test.py import pyzone zones = pyzone.zone_list() print len(zones) # equal to: pyzone.get_nr_of_act_zones() print zones $ python test.py 2 ['global', 'foo'] I can release this if there is interest…
  • 33. Step 4 – Using the service
  • 34. Batteries included (for the Client) ... importhttplib connection=httplib.HTTPConnection('localhost:8080') connection.request('GET','/') r1=connection.getresponse() printr1.status,r1.reason importjson printjson.dumps({'msg':'Hello World'},sort_keys=True,indent=2) Python also offers many GUI frameworks – also build-in (and therefore available on all platforms/clients) is Tk (Easy to use with pytkgen*)... * Creates Tk based GUIs from JSON definition files.
  • 35. Step 5 – Monitoring
  • 36. You can user Dtrace to monitor the ZFS, Zones, Network etc.
  • 37. You can also create stuff like this... Source: http://wiki.joyent.com/display/node/Using+Cloud+Analytics
  • 38. Or even trace Python itself...
  • 39. Check if Python probes are available $ pfexec dtrace -ln 'python*:::'   ID   PROVIDER            MODULE                          FUNCTION NAME 9398  python861 libpython2.6.so.1.0                PyEval_EvalFrameEx function-entry 9399  python861 libpython2.6.so.1.0                      dtrace_entry function-entry 9400  python861 libpython2.6.so.1.0                PyEval_EvalFrameEx function-return 9401  python861 libpython2.6.so.1.0                     dtrace_return function-return
  • 40. Check if Python probes are available $ pfexec dtrace -ln 'python*:::'   ID   PROVIDER            MODULE                          FUNCTION NAME 9398  python861 libpython2.6.so.1.0                PyEval_EvalFrameEx function-entry 9399  python861 libpython2.6.so.1.0                      dtrace_entry function-entry 9400  python861 libpython2.6.so.1.0                PyEval_EvalFrameEx function-return 9401  python861 libpython2.6.so.1.0                     dtrace_return function-return If you need more you could tinker around with ceval.c in the Python sources
  • 41. Count calls #pragma D option quietpython*:::function-entry/(self->name = copyinstr(arg0)) != NULL && self->name >= "/export/home/tmetsch/data/workspace/pyssf/pyocci/" /{    @[copyinstr(arg0)] = count();    self->ts=timestamp;} $ pfexec dtrace -s ./test2.d   /export/home/tmetsch/data/workspace/pyssf/pyocci/examples/vm_skeleton.py                9
  • 42. Count calls #pragma D option quietpython*:::function-entry/(self->name = copyinstr(arg0)) != NULL && self->name >= "/export/home/tmetsch/data/workspace/pyssf/pyocci/" /{    @[copyinstr(arg0)] = count();    self->ts=timestamp;} Predicate $ pfexec dtrace -s ./test2.d   /export/home/tmetsch/data/workspace/pyssf/pyocci/examples/vm_skeleton.py                9
  • 43. Trace the flow... #pragma D option quietpython*:::function-entry/(self->name = copyinstr(arg0)) != NULL && self->name == "/export/home/tmetsch/data/workspace/pyssf/pyocci/core.py" /{    printf("step into: %s %s ", copyinstr(arg1), copyinstr(arg0));    self->traced = 1}python*:::function-return/self->traced/{    printf("back from: %s ", copyinstr(arg1));    self->traced = 0}
  • 44. Trace the flow...(2) $ pfexec dtrace -s ./test4.d -c '/usr/bin/python ./pyocci/examples/vms_main.py' step into: <module> ./pyocci/examples/vms_main.py back from: <module> step into: Login ./pyocci/examples/vms_main.py back from: Login step into: MyService ./pyocci/examples/vms_main.py back from: MyService step into: __init__ ./pyocci/examples/vms_main.py back from: _load_ui_modules step into: start ./pyocci/examples/vms_main.py back from: __init__
  • 45. Monitoring the OCCI service $ pfexec dtrace -s ./test2.d -c '/usr/bin/python ./pyocci/examples/vms_main.py' Creating the virtual machineStarting virtual machine with id/compute/c768773a-2b6e-ce34-f08a-be3fd3a3670c  ./pyocci/examples/vms_main.py                                     5  Login                                                          2193  MyService                                                      3538 ...
  • 46. Python + Solaris = Perfect Platform* Cool Technology * http://www.nohuddleoffense.de/2011/02/21/my-software-development-environment-for-python/
  • 47. Also for Development BTW (See Blog post) Python + Solaris = Perfect Platform* Cool Technology * http://www.nohuddleoffense.de/2011/02/21/my-software-development-environment-for-python/
  • 48.
  • 62. Thank you! (c) 2011 - Thijs Metschtmetsch at opensolaris dot org   http://www.twitter.com/befreax http://www.tmetsch.org