Пример #1
0
    def __init__(self, command, cwd, env, settings, id=None):
        """
        Initializer.
        @param command: the full command to exec. contains all options and arguments.
        @param cwd: a current working directory for the execed process.
        @param env: dict of environment variables to use for the execed process.
        @param settings: configuration from "conf/settings/json".
        @param id: an identifier for the process to run. e.g. a job id.
        """
        AbstractInterruptableProcess.__init__(self)

        self._command = command
        self._cwd = cwd
        self._env = env
        self._settings = settings
        self._id = id

        self._process = None
        self._exitCode = 1  # default to error

        # needed to store to file as work-around for billiard not correctly storing exit code into variable.
        self._exitCodeFile = os.path.join(self._cwd, "_exit_code")
        self._exitCodeHold = os.path.join(self._cwd, ".exit_code_hold")
        self._pidFile = os.path.join(self._cwd, "_pid")

        # create cwd if not exists
        if not os.path.isdir(self._cwd): os.makedirs(self._cwd)
Пример #2
0
 def __init__(self, stream, streamSubject):
     """
     Initializer.
     """
     AbstractInterruptableProcess.__init__(self)
     self._stream = stream
     self._streamSubject = streamSubject
Пример #3
0
 def __init__(self, queue, sendInterval, messenger=None):
     """
     Initializer.
     """
     AbstractInterruptableProcess.__init__(self)
     self._queue = queue
     self._sendInterval = sendInterval
     self._messenger = messenger
Пример #4
0
 def __del__(self):
     """
     Finalizer.
     """
     AbstractInterruptableProcess.__del__(self)