예제 #1
0
config.addOption('MSG_SERVER', 'ganga.msg.cern.ch:6163', 'MSG server')
config.addOption('MSG_EXIT_TIMEOUT',5, 'Maximum seconds to clear queued monitoring messages on exit.')

# username and password was requested by the CERN MSG team for accounting purposes
# this is not a security measure, this change goes along with the stomputil version 2.4 which
# fixes the disconnect frames of the STOMP protocol
config.addOption('MSG_USERNAME','ganga','This is used for accounting purposes and NOT for security')
config.addOption('MSG_PASSWORD','analysis','This is used for accounting purposes and NOT for security')

if os.environ.has_key('DIANE_MSG_TEST'):
    config.log_config()
    config.MSG_SERVER = 'gridmsg001.cern.ch:6163' # USE TEST SERVER INSTEAD
    

from diane.logger import getLogger
log = getLogger('MSG-Logger')

publisher = None

def create_publisher():
    global publisher
    import stomputil
    server, port = config.MSG_SERVER.split(':')
    port = int(port)
    #MSGUtil.SERVER, MSGUtil.PORT = server, int(port)
    log.debug('Creating publisher...')
    publisher = stomputil.createPublisher(diane.BaseThread.BaseThread, server, port, config.MSG_USERNAME, config.MSG_PASSWORD, logger=log)
    publisher.start()
    publisher.addExitHandler(config.MSG_EXIT_TIMEOUT)

def send(dst, msg): # entopic the msg in msg_q for the connection thread to consume and send
예제 #2
0
# this is the interface used by ganga-based submitter scripts
# standard submitter scripts are defined in this package
# other submitter scripts should be put in PYTHONPATH

import sys
import os
import os.path

from diane.diane_exceptions import DianeException
import diane.util

from diane.logger import getLogger,logging
logger = getLogger('Submitter')

sh_download_wrapper = '''#!/bin/sh

wget %(DIANE_DOWNLOAD_URL)s/diane-install
python ./diane-install --download-url=%(DIANE_DOWNLOAD_URL)s --prefix=$PWD/diane %(DIANE_VERSION)s
$($PWD/diane/install/%(DIANE_VERSION)s/bin/diane-env)
%(DIANE_WORKER_START)s
'''

sh_shared_setup_wrapper = '''#!/bin/sh
$(%(DIANE_TOP)s/bin/diane-env)
%(DIANE_WORKER_START)s
'''

sh_shared_platform_doctor_wrapper = """#!/bin/sh

python %(DIANE_TOP)s/etc/platform-doctor.py --force=DUMMY_PLATFORM_STRING