SlideShare a Scribd company logo
1 of 21
Batch API
 Dániel Kalmár
 March 28, 2013
What is batch API?
What is batch API?

●   Batch (execution of a series of “jobs”)
●   Application Programming Interface
●   Avoid PHP timeout
●   Spread out the processing over several page
    requests
●   Feedback for users (progress bar)
●   Cannot use in cron jobs
When can batch API be useful?

●   designed to integrate with the Form API
    workflow
●   can be used by non-Form API scripts (update,
    page callbacks)
●   site install (module install)
●   bulk operations (nodes, users)
●   search API (indexing)
Functions

●   batch_get()
●   batch_process()
●   batch_set()
●   hook_batch_alter()
●   _batch_populate_queue()
●   _batch_queue()
How does it work?
Configuration
Process
●   set batch operation



●   execute batch operation (only need outside of a
    form submit handler)
Operations

●   $context
●   Set the starting values
Operations


●   update the values in each steps
Operations


●   check if all the steps have been executed
Operations
“Finished” callback
Cron queue
What is cron queue?


●   cron
●   hooks
●   queue API
●   limit the processing time of a queue per cron
    run
When can cron queue be useful?

●   processing large amounts of data in cron
●   bulk operations (nodes, users)
●   regular newsletter sending
How does it work?
Define a queue
●   Implement hook_cron_queue_info()
Load the queue
●   Loading items in the queue in hook_cron()
Process a queue item
●   worker callback deals with the individual queue
    items
Questions?

More Related Content

What's hot

SciPipe - A light-weight workflow library inspired by flow-based programming
SciPipe - A light-weight workflow library inspired by flow-based programmingSciPipe - A light-weight workflow library inspired by flow-based programming
SciPipe - A light-weight workflow library inspired by flow-based programmingSamuel Lampa
 
Dockerfile for rust project
Dockerfile for rust projectDockerfile for rust project
Dockerfile for rust projectHien Nguyen
 
Types - slice, map, new, make, struct - Gopherlabs
Types - slice, map, new, make, struct - Gopherlabs Types - slice, map, new, make, struct - Gopherlabs
Types - slice, map, new, make, struct - Gopherlabs sangam biradar
 
Alfresco勉強会#40 QRコードによる文書の振り分け
Alfresco勉強会#40 QRコードによる文書の振り分けAlfresco勉強会#40 QRコードによる文書の振り分け
Alfresco勉強会#40 QRコードによる文書の振り分けTakeshi Totani
 
What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)
What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)
What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)DicodingEvent
 
Multitenant SaaS Apps In Rails By Iqbal Hasnan
Multitenant SaaS Apps In Rails By Iqbal HasnanMultitenant SaaS Apps In Rails By Iqbal Hasnan
Multitenant SaaS Apps In Rails By Iqbal Hasnaniqbal hasnan
 
Ansible Israel Kickoff Meetup
Ansible Israel Kickoff MeetupAnsible Israel Kickoff Meetup
Ansible Israel Kickoff Meetupansibleil
 
Trailblazer Rails Architecture
Trailblazer Rails ArchitectureTrailblazer Rails Architecture
Trailblazer Rails Architectureiqbal hasnan
 
Introducing CentOS container pipeline
Introducing CentOS container pipelineIntroducing CentOS container pipeline
Introducing CentOS container pipelineDharmit Shah
 
Ansistrano, or using Ansible for application deployments
Ansistrano, or using Ansible for application deploymentsAnsistrano, or using Ansible for application deployments
Ansistrano, or using Ansible for application deploymentsRoger Tanner
 
Continuous delivery@LesFurets - DC Continuous delivery meetup
Continuous delivery@LesFurets - DC Continuous delivery meetupContinuous delivery@LesFurets - DC Continuous delivery meetup
Continuous delivery@LesFurets - DC Continuous delivery meetupRaphaël Brugier
 
Introduction to Jhipster
Introduction to JhipsterIntroduction to Jhipster
Introduction to JhipsterKnoldus Inc.
 
[JCConf 2017] Reactive Programming with Reactor
[JCConf 2017] Reactive Programming with Reactor[JCConf 2017] Reactive Programming with Reactor
[JCConf 2017] Reactive Programming with ReactorSwanky Hsiao
 

What's hot (20)

SciPipe - A light-weight workflow library inspired by flow-based programming
SciPipe - A light-weight workflow library inspired by flow-based programmingSciPipe - A light-weight workflow library inspired by flow-based programming
SciPipe - A light-weight workflow library inspired by flow-based programming
 
Dockerfile for rust project
Dockerfile for rust projectDockerfile for rust project
Dockerfile for rust project
 
Types - slice, map, new, make, struct - Gopherlabs
Types - slice, map, new, make, struct - Gopherlabs Types - slice, map, new, make, struct - Gopherlabs
Types - slice, map, new, make, struct - Gopherlabs
 
Apache Airflow overview
Apache Airflow overviewApache Airflow overview
Apache Airflow overview
 
Alfresco勉強会#40 QRコードによる文書の振り分け
Alfresco勉強会#40 QRコードによる文書の振り分けAlfresco勉強会#40 QRコードによる文書の振り分け
Alfresco勉強会#40 QRコードによる文書の振り分け
 
What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)
What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)
What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)
 
Multitenant SaaS Apps In Rails By Iqbal Hasnan
Multitenant SaaS Apps In Rails By Iqbal HasnanMultitenant SaaS Apps In Rails By Iqbal Hasnan
Multitenant SaaS Apps In Rails By Iqbal Hasnan
 
Advanced guide to Quartz plugin
Advanced guide to Quartz pluginAdvanced guide to Quartz plugin
Advanced guide to Quartz plugin
 
MLBlock
MLBlockMLBlock
MLBlock
 
React meets o OCalm
React meets o OCalmReact meets o OCalm
React meets o OCalm
 
Ansible Israel Kickoff Meetup
Ansible Israel Kickoff MeetupAnsible Israel Kickoff Meetup
Ansible Israel Kickoff Meetup
 
Trailblazer Rails Architecture
Trailblazer Rails ArchitectureTrailblazer Rails Architecture
Trailblazer Rails Architecture
 
Introducing CentOS container pipeline
Introducing CentOS container pipelineIntroducing CentOS container pipeline
Introducing CentOS container pipeline
 
js-why-it-is-better
js-why-it-is-betterjs-why-it-is-better
js-why-it-is-better
 
Ansistrano, or using Ansible for application deployments
Ansistrano, or using Ansible for application deploymentsAnsistrano, or using Ansible for application deployments
Ansistrano, or using Ansible for application deployments
 
Apache Airflow
Apache AirflowApache Airflow
Apache Airflow
 
Continuous delivery@LesFurets - DC Continuous delivery meetup
Continuous delivery@LesFurets - DC Continuous delivery meetupContinuous delivery@LesFurets - DC Continuous delivery meetup
Continuous delivery@LesFurets - DC Continuous delivery meetup
 
Overlay HPC Information
Overlay HPC InformationOverlay HPC Information
Overlay HPC Information
 
Introduction to Jhipster
Introduction to JhipsterIntroduction to Jhipster
Introduction to Jhipster
 
[JCConf 2017] Reactive Programming with Reactor
[JCConf 2017] Reactive Programming with Reactor[JCConf 2017] Reactive Programming with Reactor
[JCConf 2017] Reactive Programming with Reactor
 

Viewers also liked

Extend your REST API
Extend your REST APIExtend your REST API
Extend your REST APIAlexey Tokar
 
Case Study: API Recovery Process
Case Study: API Recovery ProcessCase Study: API Recovery Process
Case Study: API Recovery ProcessFlex Process
 
Deviations management in the context of ICH Q9 Q10
Deviations management in the context of ICH Q9 Q10Deviations management in the context of ICH Q9 Q10
Deviations management in the context of ICH Q9 Q10Alicia Tébar
 
Treat Your API Like a Product
Treat Your API Like a ProductTreat Your API Like a Product
Treat Your API Like a ProductElie Chevignard
 
Process Validation of API
Process Validation of APIProcess Validation of API
Process Validation of APIsrirao3462
 
upstream & downstream process of antibiotics
upstream & downstream process of antibioticsupstream & downstream process of antibiotics
upstream & downstream process of antibioticsAnil Kollur
 
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...CA API Management
 

Viewers also liked (9)

Extend your REST API
Extend your REST APIExtend your REST API
Extend your REST API
 
Case Study: API Recovery Process
Case Study: API Recovery ProcessCase Study: API Recovery Process
Case Study: API Recovery Process
 
4 trending gmp-issues_eng
4 trending gmp-issues_eng4 trending gmp-issues_eng
4 trending gmp-issues_eng
 
Deviations management in the context of ICH Q9 Q10
Deviations management in the context of ICH Q9 Q10Deviations management in the context of ICH Q9 Q10
Deviations management in the context of ICH Q9 Q10
 
Treat Your API Like a Product
Treat Your API Like a ProductTreat Your API Like a Product
Treat Your API Like a Product
 
Process Validation of API
Process Validation of APIProcess Validation of API
Process Validation of API
 
upstream & downstream process of antibiotics
upstream & downstream process of antibioticsupstream & downstream process of antibiotics
upstream & downstream process of antibiotics
 
PROCESS VALIDATION
PROCESS VALIDATIONPROCESS VALIDATION
PROCESS VALIDATION
 
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
 

Similar to Drupal course - batch API

Design & Develop Batch Applications in Java/JEE
Design & Develop Batch Applications in Java/JEEDesign & Develop Batch Applications in Java/JEE
Design & Develop Batch Applications in Java/JEENaresh Chintalcheru
 
Apache Airflow in Production
Apache Airflow in ProductionApache Airflow in Production
Apache Airflow in ProductionRobert Sanders
 
Faster Drupal sites using Queue API
Faster Drupal sites using Queue APIFaster Drupal sites using Queue API
Faster Drupal sites using Queue APIOSInet
 
Delayed operations with queues for website performance
Delayed operations with queues for website performanceDelayed operations with queues for website performance
Delayed operations with queues for website performanceOSInet
 
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...Jimmy DeadcOde
 
Maintaining spatial data infrastructures (SDIs) using distributed task queues
Maintaining spatial data infrastructures (SDIs) using distributed task queuesMaintaining spatial data infrastructures (SDIs) using distributed task queues
Maintaining spatial data infrastructures (SDIs) using distributed task queuesPaolo Corti
 
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...Caktus Group
 
Introduction to Python Celery
Introduction to Python CeleryIntroduction to Python Celery
Introduction to Python CeleryMahendra M
 
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...Caktus Group
 
AthenaX - Unified Stream & Batch Processing using SQL at Uber, Zhenqiu Huang,...
AthenaX - Unified Stream & Batch Processing using SQL at Uber, Zhenqiu Huang,...AthenaX - Unified Stream & Batch Processing using SQL at Uber, Zhenqiu Huang,...
AthenaX - Unified Stream & Batch Processing using SQL at Uber, Zhenqiu Huang,...Bowen Li
 
LuaNode: Asynchronous I/O for Lua
LuaNode: Asynchronous I/O for LuaLuaNode: Asynchronous I/O for Lua
LuaNode: Asynchronous I/O for LuaIgnacio Burgueño
 
New features in Java 9: Modularity & Process handling
New features in Java 9: Modularity & Process handlingNew features in Java 9: Modularity & Process handling
New features in Java 9: Modularity & Process handlingKnoldus Inc.
 
Node js
Node jsNode js
Node jshazzaz
 
Java 9 has these new features!
Java 9 has these new features!Java 9 has these new features!
Java 9 has these new features!Knoldus Inc.
 

Similar to Drupal course - batch API (20)

Design & Develop Batch Applications in Java/JEE
Design & Develop Batch Applications in Java/JEEDesign & Develop Batch Applications in Java/JEE
Design & Develop Batch Applications in Java/JEE
 
Apache Airflow in Production
Apache Airflow in ProductionApache Airflow in Production
Apache Airflow in Production
 
Faster Drupal sites using Queue API
Faster Drupal sites using Queue APIFaster Drupal sites using Queue API
Faster Drupal sites using Queue API
 
Delayed operations with queues for website performance
Delayed operations with queues for website performanceDelayed operations with queues for website performance
Delayed operations with queues for website performance
 
Sprint 78
Sprint 78Sprint 78
Sprint 78
 
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
 
Sprint 59
Sprint 59Sprint 59
Sprint 59
 
Sprint 61
Sprint 61Sprint 61
Sprint 61
 
Maintaining spatial data infrastructures (SDIs) using distributed task queues
Maintaining spatial data infrastructures (SDIs) using distributed task queuesMaintaining spatial data infrastructures (SDIs) using distributed task queues
Maintaining spatial data infrastructures (SDIs) using distributed task queues
 
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
 
Introduction to Python Celery
Introduction to Python CeleryIntroduction to Python Celery
Introduction to Python Celery
 
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
Write an API for Almost Anything: The Amazing Power and Flexibility of Django...
 
AthenaX - Unified Stream & Batch Processing using SQL at Uber, Zhenqiu Huang,...
AthenaX - Unified Stream & Batch Processing using SQL at Uber, Zhenqiu Huang,...AthenaX - Unified Stream & Batch Processing using SQL at Uber, Zhenqiu Huang,...
AthenaX - Unified Stream & Batch Processing using SQL at Uber, Zhenqiu Huang,...
 
Sprint 60
Sprint 60Sprint 60
Sprint 60
 
Api presentation
Api presentationApi presentation
Api presentation
 
Sprint 66
Sprint 66Sprint 66
Sprint 66
 
LuaNode: Asynchronous I/O for Lua
LuaNode: Asynchronous I/O for LuaLuaNode: Asynchronous I/O for Lua
LuaNode: Asynchronous I/O for Lua
 
New features in Java 9: Modularity & Process handling
New features in Java 9: Modularity & Process handlingNew features in Java 9: Modularity & Process handling
New features in Java 9: Modularity & Process handling
 
Node js
Node jsNode js
Node js
 
Java 9 has these new features!
Java 9 has these new features!Java 9 has these new features!
Java 9 has these new features!
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 

Recently uploaded (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 

Drupal course - batch API

  • 1. Batch API Dániel Kalmár March 28, 2013
  • 3. What is batch API? ● Batch (execution of a series of “jobs”) ● Application Programming Interface ● Avoid PHP timeout ● Spread out the processing over several page requests ● Feedback for users (progress bar) ● Cannot use in cron jobs
  • 4. When can batch API be useful? ● designed to integrate with the Form API workflow ● can be used by non-Form API scripts (update, page callbacks) ● site install (module install) ● bulk operations (nodes, users) ● search API (indexing)
  • 5. Functions ● batch_get() ● batch_process() ● batch_set() ● hook_batch_alter() ● _batch_populate_queue() ● _batch_queue()
  • 6. How does it work?
  • 8. Process ● set batch operation ● execute batch operation (only need outside of a form submit handler)
  • 9. Operations ● $context ● Set the starting values
  • 10. Operations ● update the values in each steps
  • 11. Operations ● check if all the steps have been executed
  • 15. What is cron queue? ● cron ● hooks ● queue API ● limit the processing time of a queue per cron run
  • 16. When can cron queue be useful? ● processing large amounts of data in cron ● bulk operations (nodes, users) ● regular newsletter sending
  • 17. How does it work?
  • 18. Define a queue ● Implement hook_cron_queue_info()
  • 19. Load the queue ● Loading items in the queue in hook_cron()
  • 20. Process a queue item ● worker callback deals with the individual queue items