Trees | Indices | Help |
---|
|
1 # -*- Mode: Python -*- 2 # vi:si:et:sw=4:sts=4:ts=4 3 # 4 # Flumotion - a streaming media server 5 # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). 6 # All rights reserved. 7 8 # This file may be distributed and/or modified under the terms of 9 # the GNU General Public License version 2 as published by 10 # the Free Software Foundation. 11 # This file is distributed without any warranty; without even the implied 12 # warranty of merchantability or fitness for a particular purpose. 13 # See "LICENSE.GPL" in the source distribution for more information. 14 15 # Licensees having purchased or holding a valid Flumotion Advanced 16 # Streaming Server license may use this file in accordance with the 17 # Flumotion Advanced Streaming Server Commercial License Agreement. 18 # See "LICENSE.Flumotion" in the source distribution for more information. 19 20 # Headers in this file shall remain intact. 21 22 import os 23 24 from twisted.internet import reactor 25 26 from flumotion.configure import configure 27 from flumotion.common import log, keycards, common, errors 28 from flumotion.job import job 29 from flumotion.twisted import credentials, fdserver 30 from flumotion.common.options import OptionParser 31 32 __version__ = "$Rev$" 33 3436 parser = OptionParser(domain="flumotion-job") 37 38 log.debug('job', 'Parsing arguments (%r)' % ', '.join(args)) 39 options, args = parser.parse_args(args) 40 41 # check if a config file was specified; if so, parse config and copy over 42 if len(args) != 3: 43 parser.error("must pass an avatarId and a path to the socket: %r" % 44 args) 45 avatarId = args[1] 46 socket = args[2] 47 48 # log our standardized starting marker 49 log.info('job', "Starting job '%s'" % avatarId) 50 51 # register all package paths (FIXME: this should go away when 52 # components and all deps come from manager) 53 # this is still necessary so that code from other projects can be imported 54 from flumotion.common import setup 55 setup.setupPackagePath() 56 57 log.info('job', 'Connecting to worker on socket %s' % (socket)) 58 59 job_factory = job.JobClientFactory(avatarId) 60 reactor.connectWith(fdserver.FDConnector, socket, job_factory, 61 10, checkPID=False) 62 63 reactor.addSystemEventTrigger('before', 'shutdown', 64 job_factory.medium.shutdownHandler) 65 66 # log our standardized started marker 67 log.info('job', "Started job '%s'" % avatarId) 68 69 reactor.run() 70 71 # log our standardized stopping marker 72 log.info('job', "Stopping job '%s'" % avatarId) 73 # log our standardized stopped marker 74 log.info('job', "Stopped job '%s'" % avatarId) 75 76 return 077
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu May 5 05:30:34 2011 | http://epydoc.sourceforge.net |