ParallelizingDaemon.php

Summary
ParallelizingDaemon.php
Parallelizing DaemonDaemon able to spawn multiple child processes to do work in parallel
ParallelizingDaemonDaemon able to spawn multiple child processes to do work in parallel
__constructConstructor
RunRun the daemon
removePsRemove a child process from the list of children
getObjectsGet a list of objects to work on in parallel
childTaskDo something with each object in parallel

Parallelizing Daemon

Daemon able to spawn multiple child processes to do work in parallel

postActiv

the micro-blogging software

Copyright

Copyright © 2016, Maiyannah Bishop

Derived from code copyright various sources

  • GNU Social © 2013-2016, Free Software Foundation, Inc
  • StatusNet © 2008-2012, StatusNet, Inc

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses/.

https://www.gnu.org/licenses/agpl.html

About

Daemon able to spawn multiple child processes to do work in parallel

PHP version

Tested with PHP 5.6

File Authors

Web

ParallelizingDaemon

Daemon able to spawn multiple child processes to do work in parallel

Summary
__constructConstructor
RunRun the daemon
removePsRemove a child process from the list of children
getObjectsGet a list of objects to work on in parallel
childTaskDo something with each object in parallel

__construct

function __construct($id =  null,
$interval =  60,
$max_children =  2,
$debug =  null)

Constructor

Parameters

  • string $id - the name/id of this daemon
  • int $interval - sleep this long before doing everything again
  • int $max_children - maximum number of child processes at a time
  • boolean $debug - debug output flag

Returns

  • void

Run

Run the daemon

Returns

  • void

removePs

function removePs(&$plist,
$ps)

Remove a child process from the list of children

Parameters

  • array &$plist array of processes
  • int $ps process id

Returns

  • void

getObjects

function getObjects()

Get a list of objects to work on in parallel

Returns

  • array An array of objects to work on

childTask

function childTask($object)

Do something with each object in parallel

Parameters

mixed $objectdata to work on

Returns

  • void
function __construct($id =  null,
$interval =  60,
$max_children =  2,
$debug =  null)
Constructor
function removePs(&$plist,
$ps)
Remove a child process from the list of children
function getObjects()
Get a list of objects to work on in parallel
function childTask($object)
Do something with each object in parallel