Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

translate5 has a core component for this. It is able to manage multiple processes at the same time.

These processes can be external processes called via REST, or internal translate5 processes.

The basic classes you can build on to use these mechanisms are

  • ZfExtended_Worker_Abstract
  • ZfExtended_Models_Worker

Have a look at the termTagger-Plugin (located in /application/editor/Plugins/TermTagger) as a complex example and the LockSegmentsBasedOnConfig-Plugin as a simple example (located in /application/editor/Plugins/LockSegmentsBasedOnConfig).

The basic idea is, that each one process mostly runs completely independent (kind of an own thread) from the others. Such a process is called a "worker" in translate5. The workers can be called directly by a php-class (then it does not run as as an own process, but as part of the calling php-class) or they can be queued in the DB-table Zf_worker.

A worker is queued by calling the ZfExtended_Worker_Abstract-Method "queue". This method also kicks of the worker queue, this means starts the first worker in the queue. Depending on what is defined for a child class of ZfExtended_Worker_Abstract, the queue calls one or multiple resources for this kind of worker. For example the editor_Plugins_TermTagger_Worker_Abstract distributes the termTagging-Load to as many different TermTagger-REST-servers, as are defined in Zf_configuration for the termTagger.

But:

  • A worker can have dependencies, defined in the DB-table Zf_worker_dependencies. If a dependency is defined, 

 

 

  • No labels