SlideShare una empresa de Scribd logo
1 de 12
Python Multiprocessing Spoon-fed
Brendan Collins Blue Raster @blueraster
Flickr - jystewart's photostream
Hello Multiprocessing Module!
• Python standard library module
• Allows for parallel code execution
• Easy to use
• Nice compliment to arcpy module
Flickr - jystewart's photostream
The Multiprocessing Mission:
• Fully leverage all CPUs
• Increase Scalability
• Improve Performance
• Alternative to Threading
Flickr - jystewart's photostream
Threads: Fluffy the three-headed dog
Flickr - jegcarpio's photostream
Threads: Fluffy the three-headed dog
• Each thread has same parent process
• Threads share memory
• Good for I/O Bound tasks (Scraping websites)
• Poor for CPU Bound Tasks (Geoprocessing)
• At the mercy of Global Interpreter Lock (GIL)
• Problems can affect other threads
Flickr - jegcarpio's photostream
Flickr - Blacksmith's photostream
Processes: Hounds of Resurrection
Processes: Hounds of Resurrection
• Each process is a separate python instance
• Memory space is NOT shared
• Easily distributed across all cores
• If one process dies, others are not affected
• Communication via IPC
Flickr - Blacksmith's photostream
Step 1: Basic Setup
Multiprocessing Pitfalls
• All worker arguments must be picklable
• Schema locks (File Geodatabase…)
• Script tools must be run “out-of-process”
• Worker startup cost
In Closing:
• Jason Pardy’s Multiprocessing post
– blogs.esri.com/esri/arcgis/2011/08/29/multiproce
ssing (link)
• Follow Me:
– @brendancol
– bcdcspatial.blogspot.com (link)
• Follow Blue Raster:
– @blueraster
– blueraster.com/blog (link)
Flickr - jystewart's photostream

Más contenido relacionado

La actualidad más candente

La actualidad más candente (8)

Plug-ins & Third-Party SDKs in UE4
Plug-ins & Third-Party SDKs in UE4Plug-ins & Third-Party SDKs in UE4
Plug-ins & Third-Party SDKs in UE4
 
C# - Raise the bar with functional & immutable constructs (Dutch)
C# - Raise the bar with functional & immutable constructs (Dutch)C# - Raise the bar with functional & immutable constructs (Dutch)
C# - Raise the bar with functional & immutable constructs (Dutch)
 
PyTest - The Awesome Parts by Josh Grant
PyTest - The Awesome Parts by Josh GrantPyTest - The Awesome Parts by Josh Grant
PyTest - The Awesome Parts by Josh Grant
 
Pharo Status ESUG 2014
Pharo Status ESUG 2014Pharo Status ESUG 2014
Pharo Status ESUG 2014
 
Performance Testing with JMeter, Taurus & Jenkins
Performance Testing with JMeter, Taurus & JenkinsPerformance Testing with JMeter, Taurus & Jenkins
Performance Testing with JMeter, Taurus & Jenkins
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talk
 
Hybrid concurrency patterns
Hybrid concurrency patternsHybrid concurrency patterns
Hybrid concurrency patterns
 
Why Plone Will Die
Why Plone Will DieWhy Plone Will Die
Why Plone Will Die
 

Similar a Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lightning Talk

Taming Pythons with ZooKeeper (Pyconfi edition)
Taming Pythons with ZooKeeper (Pyconfi edition)Taming Pythons with ZooKeeper (Pyconfi edition)
Taming Pythons with ZooKeeper (Pyconfi edition)
Jyrki Pulliainen
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pie
Tomas Doran
 

Similar a Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lightning Talk (20)

Performance and Abstractions
Performance and AbstractionsPerformance and Abstractions
Performance and Abstractions
 
Plone 5.2 migration at University Ghent, Belgium
Plone 5.2 migration at University Ghent, BelgiumPlone 5.2 migration at University Ghent, Belgium
Plone 5.2 migration at University Ghent, Belgium
 
Multithreading Design Patterns
Multithreading Design PatternsMultithreading Design Patterns
Multithreading Design Patterns
 
Developing a Staff-Only Samvera Application
Developing a Staff-Only Samvera ApplicationDeveloping a Staff-Only Samvera Application
Developing a Staff-Only Samvera Application
 
Git preso to valtech cfml team
Git preso to valtech cfml teamGit preso to valtech cfml team
Git preso to valtech cfml team
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflow
 
Go & multi platform GUI Trials and Errors
Go & multi platform GUI Trials and ErrorsGo & multi platform GUI Trials and Errors
Go & multi platform GUI Trials and Errors
 
Chapman cactus con-2015-nf_workshop
Chapman cactus con-2015-nf_workshopChapman cactus con-2015-nf_workshop
Chapman cactus con-2015-nf_workshop
 
Gentoo Linux, or Why in the World You Should Compile Everything
Gentoo Linux, or Why in the World You Should Compile EverythingGentoo Linux, or Why in the World You Should Compile Everything
Gentoo Linux, or Why in the World You Should Compile Everything
 
"Problems and solutions with generative and non-generative AI models deployme...
"Problems and solutions with generative and non-generative AI models deployme..."Problems and solutions with generative and non-generative AI models deployme...
"Problems and solutions with generative and non-generative AI models deployme...
 
Threads in Operating System | Multithreading | Interprocess Communication
Threads in Operating System | Multithreading | Interprocess CommunicationThreads in Operating System | Multithreading | Interprocess Communication
Threads in Operating System | Multithreading | Interprocess Communication
 
Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"
 
Erlang, the big switch in social games
Erlang, the big switch in social gamesErlang, the big switch in social games
Erlang, the big switch in social games
 
Taming Pythons with ZooKeeper (Pyconfi edition)
Taming Pythons with ZooKeeper (Pyconfi edition)Taming Pythons with ZooKeeper (Pyconfi edition)
Taming Pythons with ZooKeeper (Pyconfi edition)
 
Preparing Fusion codes for Perlmutter - CGYRO
Preparing Fusion codes for Perlmutter - CGYROPreparing Fusion codes for Perlmutter - CGYRO
Preparing Fusion codes for Perlmutter - CGYRO
 
Scratching the itch, making Scratch for the Raspberry Pie
Scratching the itch, making Scratch for the Raspberry PieScratching the itch, making Scratch for the Raspberry Pie
Scratching the itch, making Scratch for the Raspberry Pie
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pie
 
Reproducibility and automation of machine learning process
Reproducibility and automation of machine learning processReproducibility and automation of machine learning process
Reproducibility and automation of machine learning process
 

Más de Blue Raster

Kill those bugs with the ultimate tool - Chrome DevTools
Kill those bugs with the ultimate tool - Chrome DevToolsKill those bugs with the ultimate tool - Chrome DevTools
Kill those bugs with the ultimate tool - Chrome DevTools
Blue Raster
 
Make JavaScript Lean, Mean, and Clean
Make JavaScript Lean, Mean, and CleanMake JavaScript Lean, Mean, and Clean
Make JavaScript Lean, Mean, and Clean
Blue Raster
 
Building a Custom UI Control with D3 - 2015 Esri Devoloper Summit
Building a Custom UI Control with D3 - 2015 Esri Devoloper SummitBuilding a Custom UI Control with D3 - 2015 Esri Devoloper Summit
Building a Custom UI Control with D3 - 2015 Esri Devoloper Summit
Blue Raster
 
Building a Custom UI control with D3
Building a Custom UI control with D3Building a Custom UI control with D3
Building a Custom UI control with D3
Blue Raster
 

Más de Blue Raster (20)

ArcGIS Maps and Microsoft Integration: Power BI
ArcGIS Maps and Microsoft Integration: Power BIArcGIS Maps and Microsoft Integration: Power BI
ArcGIS Maps and Microsoft Integration: Power BI
 
ArcGIS StoryMaps: Agencies Are Creating Great Story Maps; Here's How You Can Too
ArcGIS StoryMaps: Agencies Are Creating Great Story Maps; Here's How You Can TooArcGIS StoryMaps: Agencies Are Creating Great Story Maps; Here's How You Can Too
ArcGIS StoryMaps: Agencies Are Creating Great Story Maps; Here's How You Can Too
 
Unless We Act Now: Impact of Climate Change on Children
Unless We Act Now: Impact of Climate Change on ChildrenUnless We Act Now: Impact of Climate Change on Children
Unless We Act Now: Impact of Climate Change on Children
 
ESRI Federal Small Business Specialty 2017 Partner of the Year Award
ESRI Federal Small Business Specialty 2017 Partner of the Year AwardESRI Federal Small Business Specialty 2017 Partner of the Year Award
ESRI Federal Small Business Specialty 2017 Partner of the Year Award
 
Emerging Hot Spot Analysis
Emerging Hot Spot AnalysisEmerging Hot Spot Analysis
Emerging Hot Spot Analysis
 
Fighting Climate Change by Fighting Fires - Esri FedGIS 2016 Presentation
Fighting Climate Change by Fighting Fires - Esri FedGIS 2016 PresentationFighting Climate Change by Fighting Fires - Esri FedGIS 2016 Presentation
Fighting Climate Change by Fighting Fires - Esri FedGIS 2016 Presentation
 
AppStudio for ArcGIS: The Basics - Esri FedGIS 2016
AppStudio for ArcGIS: The Basics - Esri FedGIS 2016AppStudio for ArcGIS: The Basics - Esri FedGIS 2016
AppStudio for ArcGIS: The Basics - Esri FedGIS 2016
 
Blue Raster Natureserve Synergy Workshop Presentation
Blue Raster Natureserve Synergy Workshop PresentationBlue Raster Natureserve Synergy Workshop Presentation
Blue Raster Natureserve Synergy Workshop Presentation
 
Blue Raster Presents on Emerging Hotspots of Global Tree Cover Loss
Blue Raster Presents on Emerging Hotspots of Global Tree Cover LossBlue Raster Presents on Emerging Hotspots of Global Tree Cover Loss
Blue Raster Presents on Emerging Hotspots of Global Tree Cover Loss
 
Creating Apps with Maps in AppStudio - Esri User Conference 2015 Presentation
Creating Apps with Maps in AppStudio - Esri User Conference 2015 PresentationCreating Apps with Maps in AppStudio - Esri User Conference 2015 Presentation
Creating Apps with Maps in AppStudio - Esri User Conference 2015 Presentation
 
U.S. National Arboretum - Esri User Conference 2015 Presentation
U.S. National Arboretum - Esri User Conference 2015 Presentation U.S. National Arboretum - Esri User Conference 2015 Presentation
U.S. National Arboretum - Esri User Conference 2015 Presentation
 
The Power of Story Maps, Data Visualization, and Analysis: NetHope and Blue R...
The Power of Story Maps, Data Visualization, and Analysis: NetHope and Blue R...The Power of Story Maps, Data Visualization, and Analysis: NetHope and Blue R...
The Power of Story Maps, Data Visualization, and Analysis: NetHope and Blue R...
 
Best Practices for Story Maps
Best Practices for Story MapsBest Practices for Story Maps
Best Practices for Story Maps
 
Kill those bugs with the ultimate tool - Chrome DevTools
Kill those bugs with the ultimate tool - Chrome DevToolsKill those bugs with the ultimate tool - Chrome DevTools
Kill those bugs with the ultimate tool - Chrome DevTools
 
Make JavaScript Lean, Mean, and Clean
Make JavaScript Lean, Mean, and CleanMake JavaScript Lean, Mean, and Clean
Make JavaScript Lean, Mean, and Clean
 
Building a Custom UI Control with D3 - 2015 Esri Devoloper Summit
Building a Custom UI Control with D3 - 2015 Esri Devoloper SummitBuilding a Custom UI Control with D3 - 2015 Esri Devoloper Summit
Building a Custom UI Control with D3 - 2015 Esri Devoloper Summit
 
Building a Custom UI control with D3
Building a Custom UI control with D3Building a Custom UI control with D3
Building a Custom UI control with D3
 
Great Story Maps - Blue Raster Esri User Conference 2014 Presentation
Great Story Maps - Blue Raster Esri User Conference 2014 PresentationGreat Story Maps - Blue Raster Esri User Conference 2014 Presentation
Great Story Maps - Blue Raster Esri User Conference 2014 Presentation
 
Total Knockout: Start-to-Finish Development of Suitability Applications Using...
Total Knockout: Start-to-Finish Development of Suitability Applications Using...Total Knockout: Start-to-Finish Development of Suitability Applications Using...
Total Knockout: Start-to-Finish Development of Suitability Applications Using...
 
Online Mapping Patterns in 2013 and Beyond
Online Mapping Patterns in 2013 and BeyondOnline Mapping Patterns in 2013 and Beyond
Online Mapping Patterns in 2013 and Beyond
 

Python Multiprocessing Spoon-fed - Blue Raster Esri Developer Summit 2013 Lightning Talk

  • 1. Python Multiprocessing Spoon-fed Brendan Collins Blue Raster @blueraster Flickr - jystewart's photostream
  • 2. Hello Multiprocessing Module! • Python standard library module • Allows for parallel code execution • Easy to use • Nice compliment to arcpy module Flickr - jystewart's photostream
  • 3. The Multiprocessing Mission: • Fully leverage all CPUs • Increase Scalability • Improve Performance • Alternative to Threading Flickr - jystewart's photostream
  • 4. Threads: Fluffy the three-headed dog Flickr - jegcarpio's photostream
  • 5. Threads: Fluffy the three-headed dog • Each thread has same parent process • Threads share memory • Good for I/O Bound tasks (Scraping websites) • Poor for CPU Bound Tasks (Geoprocessing) • At the mercy of Global Interpreter Lock (GIL) • Problems can affect other threads Flickr - jegcarpio's photostream
  • 6. Flickr - Blacksmith's photostream Processes: Hounds of Resurrection
  • 7. Processes: Hounds of Resurrection • Each process is a separate python instance • Memory space is NOT shared • Easily distributed across all cores • If one process dies, others are not affected • Communication via IPC Flickr - Blacksmith's photostream
  • 8.
  • 10.
  • 11. Multiprocessing Pitfalls • All worker arguments must be picklable • Schema locks (File Geodatabase…) • Script tools must be run “out-of-process” • Worker startup cost
  • 12. In Closing: • Jason Pardy’s Multiprocessing post – blogs.esri.com/esri/arcgis/2011/08/29/multiproce ssing (link) • Follow Me: – @brendancol – bcdcspatial.blogspot.com (link) • Follow Blue Raster: – @blueraster – blueraster.com/blog (link) Flickr - jystewart's photostream