pyfarm.jobtypes.core.process module¶
Process¶
Module responsible for connecting a Twisted process object and a job type. Additionally this module contains other classes which are useful in starting or managing a process.
- class pyfarm.jobtypes.core.process.ReplaceEnvironment(frozen_environment, environment=None)[source]¶
Bases: object
A context manager which will replace os.environ‘s, or dictionary of your choosing, for a short period of time. After exiting the context manager the original environment will be restored.
This is useful if you have something like a process that’s using global environment and you want to ensure that global environment is always consistent.
Parameters: environment (dict) – If provided, use this as the environment dictionary instead of os.environ
- class pyfarm.jobtypes.core.process.ProcessProtocol(jobtype)[source]¶
Bases: twisted.internet.protocol.ProcessProtocol
Subclass of Protocol which hooks into the various systems necessary to run and manage a process. More specifically, this helps to act as plumbing between the process being run and the job type.
- connectionMade()[source]¶
Called when the process first starts and the file descriptors have opened.