job_management.rst 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. Job Management (Tripal Daemon)
  2. ==============================
  3. The Tripal Daemon module is meant to provide a simple means of creating a robust command-line-driven, fully bootstrapped PHP Daemon. It uses the PHP-Daemon (https://github.com/shaneharter/PHP-Daemon) Library to create the Daemon (via the Libraries API) in order to not re-invent the wheel. It allows you to execute Jobs submitted to Tripal without using cron. It provides a faster user experience for running jobs. Prior to Tripal v3, the Tripal Daemon module was an extension module. It was integrated into the core Tripal pacakge.
  4. Features
  5. --------
  6. * Provides a Drush interface to start/stop your Daemon.
  7. * Your daemon starts in the background and is detached from the current terminal.
  8. * Daemon will run all Tripal Jobs submitted within 20 seconds.
  9. * A log including the number of jobs executed, their identifiers and results.
  10. * Lock Files, Automatic restart (8hrs default) and Built-in Signal Handling & Event Logging are only a few of the features provided by the Daemon API making this a fully featured & robust Daemon.
  11. Installation
  12. ------------
  13. The Tripal Daemon requires the `Libraries API <https://www.drupal.org/project/libraries>`_ module. You can easily download and install this module using the following drush commands:
  14. .. code-block:: shell
  15. drush pm-download Libraries
  16. drush pm-enable Libraries
  17. Next, we need the `PHP-Daemon Library version 2.0 <https://github.com/shaneharter/PHP-Daemon>`_. You must download the PHP-Daemon Library and extract it in your ``sites/all/libraries`` directory. The folder must be named "PHP-Daemon". The following commands can be used to do this:
  18. .. code-block:: shell
  19. cd /var/www/html/sites/all/libraries
  20. wget https://github.com/shaneharter/PHP-Daemon/archive/v2.0.tar.gz
  21. tar -zxvf v2.0.tar.gz
  22. mv v2.0.tar.gz PHP-Daemon
  23. Next, install the `Drush Daemon API <https://www.drupal.org/project/drushd>`_ module.
  24. .. code-block:: shell
  25. drush pm-download drushd
  26. drush pm-enable drushd
  27. Finally, enable the Tripal Daemon module. This module comes with Tripal v3.
  28. .. code-block:: shell
  29. drush pm-enable tripal_daemon
  30. Usage
  31. -----
  32. Start the Daemon
  33. .. code-block:: shell
  34. drush trpjob-daemon start
  35. Stop the Daemon
  36. .. code-block:: shell
  37. drush trpjob-daemon stop
  38. Check the status
  39. .. code-block:: shell
  40. drush trpjob-daemon status
  41. List the last 10 lines of the log file:
  42. .. code-block:: shell
  43. drush trpjob-daemon show-log
  44. List the last N lines of the log file:
  45. .. code-block:: shell
  46. drush trpjob-daemon show-log --num_lines=N
  47. Set N to the number of lines you want to view.