SlideShare a Scribd company logo
1 of 14
Download to read offline
Viewflow 
internals 
0.6.0 beta
Intro 
Reusable workflow library 
➔ Django friendly 
➔ Easy to start 
➔ Helps to grow 
➔ Business applications 
➔ People collaboration
Intro 
Highly technical talk 
Don’t panic. Library is only about 3k SLOC 
If anything unclear - ask kmmbvnr@gmail.com
Intro 
➔ Flow 
◆ Nodes 
◆ This object 
➔ Models 
➔ Nodes 
◆ Views 
◆ Jobs 
◆ Gates 
➔ Activation 
◆ Livecycle 
➔ Parallel tasks execution 
◆ Token 
◆ Locking 
➔ Error handling 
◆ Activation context 
➔ Viewsite 
◆ Forms 
Viewflow internals
Flow 
➔ CRUD and Flow Separation 
➔ Task dependencies graph 
➔ Boilerplate: Permissions, URLs
Models 
➔ Process/Task tables 
➔ Multi-table inheritance 
➔ Abstract base classes
Views 
➔ Function based Views ➔ Class based Views 
URL: <flow_cls>/<process_pk>/<task_name>/<task_pk>
Jobs 
➔ Never miss the broken task 
➔ Celery out of the box 
➔ Easy to add another libraries support: 
rq, huye
Gates 
➔ Workflow patterns support 
➔ Decide what task should be executed next 
➔ Easy to add logic by extending class or 
providing callable
Activation 
@classmethod 
def activate(cls, flow_task, prev_activation, token): 
def initialize(self, flow_task, task): 
def prepare(self, **data) 
def assign(self, user) 
def start(self) 
➔ Weaves declarative Flow node 
with Process and Task instance 
def execute(self) def error(self, exc) 
def done(self) 
def activate_next(self)
Parallel task execution and Joins 
Task Token 
➔ Split Node adds suffix 
➔ Join Node waits all nodes 
with common prefix 
Short pessimistic locks 
➔ @flow_view 
➔ @flow_job 
Optimistic lock with django-fsm on Task 
OR ➔ If your are ok with fails 
Concurrent updates are rare, but:
Error handling 
View Jobs 
➔ Any exception in subsequent task activation 
would rollback whole transaction. 
➔ View task still available for user second try 
➔ Job results committed immediately as job 
completes. 
➔ Any exception in subsequent tasks activations 
would save subsequent task in error state. 
Could be customized by providing custom Activation class
Viewsite 
Completely optional, but you will like it 
➔ Admin like speed for interface development 
➔ Works with your Views 
➔ Ready for end user 
➔ Forms layouts, dynamic formsets, bootstrap 
More in next videos...
Thank you 
$ pip install django-viewflow 
http://viewflow.io 
http://github.com/kmmbvnr/django-viewflow/ 
kmmbvnr@gmail.com

More Related Content

What's hot

Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Jay Friendly
 
Quartz component in mule
Quartz component in muleQuartz component in mule
Quartz component in mulejaveed_mhd
 
Using protractor to build automated ui tests
Using protractor to build automated ui testsUsing protractor to build automated ui tests
Using protractor to build automated ui tests🌱 Dale Spoonemore
 
Salesforce DUG - Queueable Apex
Salesforce DUG - Queueable ApexSalesforce DUG - Queueable Apex
Salesforce DUG - Queueable ApexAkshay Varu
 
Gatling Tool in Action at Devoxx 2012
Gatling Tool in Action at Devoxx 2012Gatling Tool in Action at Devoxx 2012
Gatling Tool in Action at Devoxx 2012slandelle
 
Gatling - Stress test tool
Gatling - Stress test toolGatling - Stress test tool
Gatling - Stress test toolKnoldus Inc.
 
One step in the future: CSS variables
One step in the future: CSS variablesOne step in the future: CSS variables
One step in the future: CSS variablesGiacomo Zinetti
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
 
Batchable vs @future vs Queueable
Batchable vs @future vs QueueableBatchable vs @future vs Queueable
Batchable vs @future vs QueueableBoris Bachovski
 
Nightwatch JS for End to End Tests
Nightwatch JS for End to End TestsNightwatch JS for End to End Tests
Nightwatch JS for End to End TestsSriram Angajala
 
Alfresco : Implementing Workflow
Alfresco : Implementing WorkflowAlfresco : Implementing Workflow
Alfresco : Implementing WorkflowWildan Maulana
 
AJAX the WordPress way
AJAX the WordPress wayAJAX the WordPress way
AJAX the WordPress wayJustin Foell
 
CasperJs Enjoy Functional Testing
CasperJs Enjoy Functional TestingCasperJs Enjoy Functional Testing
CasperJs Enjoy Functional TestingFabien POMEROL
 
Server-Side JavaScript with jQuery and AOLserver
Server-Side JavaScript with jQuery and AOLserverServer-Side JavaScript with jQuery and AOLserver
Server-Side JavaScript with jQuery and AOLserverDossy Shiobara
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Muleirfan1008
 

What's hot (20)

Simple Java component in Mule
Simple Java component in MuleSimple Java component in Mule
Simple Java component in Mule
 
Accessing Mule variables in groovy
Accessing Mule variables in groovyAccessing Mule variables in groovy
Accessing Mule variables in groovy
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8
 
Quartz component in mule
Quartz component in muleQuartz component in mule
Quartz component in mule
 
Using protractor to build automated ui tests
Using protractor to build automated ui testsUsing protractor to build automated ui tests
Using protractor to build automated ui tests
 
Salesforce DUG - Queueable Apex
Salesforce DUG - Queueable ApexSalesforce DUG - Queueable Apex
Salesforce DUG - Queueable Apex
 
Gatling Tool in Action at Devoxx 2012
Gatling Tool in Action at Devoxx 2012Gatling Tool in Action at Devoxx 2012
Gatling Tool in Action at Devoxx 2012
 
Gatling - Stress test tool
Gatling - Stress test toolGatling - Stress test tool
Gatling - Stress test tool
 
One step in the future: CSS variables
One step in the future: CSS variablesOne step in the future: CSS variables
One step in the future: CSS variables
 
Selenium with protractor
Selenium with protractorSelenium with protractor
Selenium with protractor
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
Batchable vs @future vs Queueable
Batchable vs @future vs QueueableBatchable vs @future vs Queueable
Batchable vs @future vs Queueable
 
Nightwatch JS for End to End Tests
Nightwatch JS for End to End TestsNightwatch JS for End to End Tests
Nightwatch JS for End to End Tests
 
Alfresco : Implementing Workflow
Alfresco : Implementing WorkflowAlfresco : Implementing Workflow
Alfresco : Implementing Workflow
 
Initialize database in Mule part2
Initialize database in Mule part2Initialize database in Mule part2
Initialize database in Mule part2
 
AJAX the WordPress way
AJAX the WordPress wayAJAX the WordPress way
AJAX the WordPress way
 
CasperJs Enjoy Functional Testing
CasperJs Enjoy Functional TestingCasperJs Enjoy Functional Testing
CasperJs Enjoy Functional Testing
 
Server-Side JavaScript with jQuery and AOLserver
Server-Side JavaScript with jQuery and AOLserverServer-Side JavaScript with jQuery and AOLserver
Server-Side JavaScript with jQuery and AOLserver
 
Compressing & decompressing in mule
Compressing & decompressing in muleCompressing & decompressing in mule
Compressing & decompressing in mule
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Mule
 

Similar to Viewflow internals: ~3k sloc explaned

Simple Tips to Improve Site Performance (No Coding Required!)
Simple Tips to Improve Site Performance (No Coding Required!)Simple Tips to Improve Site Performance (No Coding Required!)
Simple Tips to Improve Site Performance (No Coding Required!)Acquia
 
Jbpm4 Deployer
Jbpm4 DeployerJbpm4 Deployer
Jbpm4 Deployerhbraun
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-TranslatorDashamir Hoxha
 
Enhanced Workflows in Cascade Server by Leah Einecker
Enhanced Workflows in Cascade Server by Leah EineckerEnhanced Workflows in Cascade Server by Leah Einecker
Enhanced Workflows in Cascade Server by Leah Eineckerhannonhill
 
Systems Automation with Puppet
Systems Automation with PuppetSystems Automation with Puppet
Systems Automation with Puppetelliando dias
 
Queue Everything and Please Everyone
Queue Everything and Please EveryoneQueue Everything and Please Everyone
Queue Everything and Please EveryoneVaidik Kapoor
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
 
Cli jbug
Cli jbugCli jbug
Cli jbugmaeste
 
Comparison of different access controls
Comparison of different access controlsComparison of different access controls
Comparison of different access controlsRashmi Nair
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumLiraz Shay
 
Serenity BDD Workshop - 9th March 2016
Serenity BDD Workshop - 9th March 2016Serenity BDD Workshop - 9th March 2016
Serenity BDD Workshop - 9th March 2016vodqasg
 
The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integra...
The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integra...The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integra...
The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integra...jsauer
 
Play framework productivity formula
Play framework   productivity formula Play framework   productivity formula
Play framework productivity formula Sorin Chiprian
 
Best Practices For Workflow
Best Practices For WorkflowBest Practices For Workflow
Best Practices For WorkflowTimothy Spann
 
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersRob Windsor
 
ApacheConNA 2015: What's new in Apache httpd 2.4
ApacheConNA 2015: What's new in Apache httpd 2.4ApacheConNA 2015: What's new in Apache httpd 2.4
ApacheConNA 2015: What's new in Apache httpd 2.4Jim Jagielski
 

Similar to Viewflow internals: ~3k sloc explaned (20)

Automated Drupal deployment with Git and Capistrano
Automated Drupal deployment with Git and CapistranoAutomated Drupal deployment with Git and Capistrano
Automated Drupal deployment with Git and Capistrano
 
Simple Tips to Improve Site Performance (No Coding Required!)
Simple Tips to Improve Site Performance (No Coding Required!)Simple Tips to Improve Site Performance (No Coding Required!)
Simple Tips to Improve Site Performance (No Coding Required!)
 
Jbpm4 Deployer
Jbpm4 DeployerJbpm4 Deployer
Jbpm4 Deployer
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-Translator
 
Enhanced Workflows in Cascade Server by Leah Einecker
Enhanced Workflows in Cascade Server by Leah EineckerEnhanced Workflows in Cascade Server by Leah Einecker
Enhanced Workflows in Cascade Server by Leah Einecker
 
Systems Automation with Puppet
Systems Automation with PuppetSystems Automation with Puppet
Systems Automation with Puppet
 
Queue Everything and Please Everyone
Queue Everything and Please EveryoneQueue Everything and Please Everyone
Queue Everything and Please Everyone
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Cli jbug
Cli jbugCli jbug
Cli jbug
 
AS7 and CLI
AS7 and CLIAS7 and CLI
AS7 and CLI
 
Comparison of different access controls
Comparison of different access controlsComparison of different access controls
Comparison of different access controls
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Presentation laravel 5 4
Presentation laravel 5 4Presentation laravel 5 4
Presentation laravel 5 4
 
Test your modules
Test your modulesTest your modules
Test your modules
 
Serenity BDD Workshop - 9th March 2016
Serenity BDD Workshop - 9th March 2016Serenity BDD Workshop - 9th March 2016
Serenity BDD Workshop - 9th March 2016
 
The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integra...
The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integra...The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integra...
The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integra...
 
Play framework productivity formula
Play framework   productivity formula Play framework   productivity formula
Play framework productivity formula
 
Best Practices For Workflow
Best Practices For WorkflowBest Practices For Workflow
Best Practices For Workflow
 
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint Developers
 
ApacheConNA 2015: What's new in Apache httpd 2.4
ApacheConNA 2015: What's new in Apache httpd 2.4ApacheConNA 2015: What's new in Apache httpd 2.4
ApacheConNA 2015: What's new in Apache httpd 2.4
 

Recently uploaded

Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Recently uploaded (20)

Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Viewflow internals: ~3k sloc explaned

  • 2. Intro Reusable workflow library ➔ Django friendly ➔ Easy to start ➔ Helps to grow ➔ Business applications ➔ People collaboration
  • 3. Intro Highly technical talk Don’t panic. Library is only about 3k SLOC If anything unclear - ask kmmbvnr@gmail.com
  • 4. Intro ➔ Flow ◆ Nodes ◆ This object ➔ Models ➔ Nodes ◆ Views ◆ Jobs ◆ Gates ➔ Activation ◆ Livecycle ➔ Parallel tasks execution ◆ Token ◆ Locking ➔ Error handling ◆ Activation context ➔ Viewsite ◆ Forms Viewflow internals
  • 5. Flow ➔ CRUD and Flow Separation ➔ Task dependencies graph ➔ Boilerplate: Permissions, URLs
  • 6. Models ➔ Process/Task tables ➔ Multi-table inheritance ➔ Abstract base classes
  • 7. Views ➔ Function based Views ➔ Class based Views URL: <flow_cls>/<process_pk>/<task_name>/<task_pk>
  • 8. Jobs ➔ Never miss the broken task ➔ Celery out of the box ➔ Easy to add another libraries support: rq, huye
  • 9. Gates ➔ Workflow patterns support ➔ Decide what task should be executed next ➔ Easy to add logic by extending class or providing callable
  • 10. Activation @classmethod def activate(cls, flow_task, prev_activation, token): def initialize(self, flow_task, task): def prepare(self, **data) def assign(self, user) def start(self) ➔ Weaves declarative Flow node with Process and Task instance def execute(self) def error(self, exc) def done(self) def activate_next(self)
  • 11. Parallel task execution and Joins Task Token ➔ Split Node adds suffix ➔ Join Node waits all nodes with common prefix Short pessimistic locks ➔ @flow_view ➔ @flow_job Optimistic lock with django-fsm on Task OR ➔ If your are ok with fails Concurrent updates are rare, but:
  • 12. Error handling View Jobs ➔ Any exception in subsequent task activation would rollback whole transaction. ➔ View task still available for user second try ➔ Job results committed immediately as job completes. ➔ Any exception in subsequent tasks activations would save subsequent task in error state. Could be customized by providing custom Activation class
  • 13. Viewsite Completely optional, but you will like it ➔ Admin like speed for interface development ➔ Works with your Views ➔ Ready for end user ➔ Forms layouts, dynamic formsets, bootstrap More in next videos...
  • 14. Thank you $ pip install django-viewflow http://viewflow.io http://github.com/kmmbvnr/django-viewflow/ kmmbvnr@gmail.com