job_management.rst 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. Job Management (Tripal Daemon)
  2. ==============================
  3. .. note::
  4. Remember you must set the $DRUPAL_HOME environment variable to cut-and-paste the commands below. See see :doc:`./install_tripal/drupal_home`
  5. 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.
  6. Features
  7. --------
  8. * Provides a Drush interface to start/stop your Daemon.
  9. * Your daemon starts in the background and is detached from the current terminal.
  10. * Daemon will run all Tripal Jobs submitted within 20 seconds.
  11. * A log including the number of jobs executed, their identifiers and results.
  12. * 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.
  13. Installation
  14. ------------
  15. 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:
  16. .. code-block:: shell
  17. drush pm-download libraries
  18. drush pm-enable libraries
  19. 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:
  20. .. code-block:: shell
  21. cd $DRUPAL_HOME/sites/all/libraries
  22. wget https://github.com/shaneharter/PHP-Daemon/archive/v2.0.tar.gz
  23. tar -zxvf v2.0.tar.gz
  24. mv v2.0.tar.gz PHP-Daemon
  25. Next, install the `Drush Daemon API <https://www.drupal.org/project/drushd>`_ module.
  26. .. code-block:: shell
  27. drush pm-download drushd
  28. drush pm-enable drushd
  29. Finally, enable the Tripal Daemon module. This module comes with Tripal v3.
  30. .. code-block:: shell
  31. drush pm-enable tripal_daemon
  32. Usage
  33. -----
  34. Start the Daemon
  35. .. code-block:: shell
  36. drush trpjob-daemon start
  37. Stop the Daemon
  38. .. code-block:: shell
  39. drush trpjob-daemon stop
  40. Check the status
  41. .. code-block:: shell
  42. drush trpjob-daemon status
  43. List the last 10 lines of the log file:
  44. .. code-block:: shell
  45. drush trpjob-daemon show-log
  46. List the last N lines of the log file:
  47. .. code-block:: shell
  48. drush trpjob-daemon show-log --num_lines=N
  49. Set N to the number of lines you want to view.