ServiceReactor

DIRAC class to execute services

In the most common case, DIRAC services are executed using the dirac-service command. dirac-service accepts a list positional arguments. These arguments have the form: [DIRAC System Name]/[DIRAC Service Name] dirac-service then: - produces a instance of ServiceReactor - loads the required modules using the ServiceReactor.loadAgentModules method - starts the execution loop using the ServiceReactor.serve() method

Service modules must be placed under the Service directory of a DIRAC System. DIRAC Systems are called XXXSystem where XXX is the [DIRAC System Name], and must inherit from the base class RequestHandler

class DIRAC.Core.DISET.ServiceReactor.ReactorStats

Bases: object

__init__()
connectionStablished()
class DIRAC.Core.DISET.ServiceReactor.ServiceReactor

Bases: object

__init__()
closeListeningConnections()
initialize(servicesList)
serve()
stopAllProcess()

It stops all the running processes.

stopChildProcesses(_sig, frame)

It is used to properly stop the service when more than one process are used. In principle this is doing the job of runsv, becuase runsv only send a sigterm to the parent process…

Parameters
  • _sig (int) – the signal sent to the process

  • frame (object) – execution frame which contains the child processes

DIRAC.Core.DISET.ServiceReactor.THROTTLE_SERVICE_SLEEP_SECONDS = 0.25

Time during which the service does not accept new requests and handles those in the queue, if the backlog is too large This sleep is repeated for as long as Service.wantsThrottle is truthy