Beispiel #1
0
import diane, sys, time, os

config = diane.getConfig('MSGMonitoring')

# MSG specific options
config.addOption('MSG_MONITORING_ENABLED', True, 'enable/disable MSG monitoring')
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)
Beispiel #2
0
import diane

config = diane.getConfig("FileTransfer")

config.addOption("DEFAULT_CHUNK_SIZE", 100000, "default chunk size for file transfer")
config.addOption(
    "ORPHANED_SESSION_TIMEOUT",
    200,
    "if transfer of one chunk takes longer than this timeout then the session is cancelled",
)
Beispiel #3
0
import diane
logger = diane.getLogger('RunMaster')

import diane.util

import DIANE_CORBA 
import DIANE_CORBA__POA

import sys, time

config = diane.getConfig('RunMaster')
config.addOption('LOST_WORKER_TIMEOUT',60,'timout in seconds to declare worker as "lost"')
config.addOption('CONTROL_DELAY',1,'default periodicity of control loop')
config.addOption('IDLE_WORKER_TIMEOUT', 600, 'if a worker stays idle for this time then it is automatically removed from the pool, 0 means that the worker is never removed')

# --- temporary config and logger workaround
import diane.WorkerRegistry as WorkerRegistryModule
WorkerRegistryModule.config = config
WorkerRegistryModule.logger = logger
# ---

import diane.journal

from diane.TaskInfo import TaskInfo,TaskStatus

from diane.Peer import Peer

# make sure that you always import with full package name (otherwise pickle on the client side will compain)
from diane.WorkerRegistry import WorkerRegistry

import streamer
Beispiel #4
0
import diane
logger = diane.getLogger('WorkerAgent')
config = diane.getConfig('WorkerAgent')
logger.debug('original config %s',repr(config))
config.addOption('HEARTBEAT_DELAY',10,"default periodicity of heartbeat")
config.addOption('HEARTBEAT_TIMEOUT',30,"timeout for heartbeat calls, if a heartbeat call may not be completed in HEARTBEAT_TIMEOUT seconds, we assume that the peer (master or directory service) is lost")
config.addOption('BOOTSTRAP_CONTACT_TIMEOUT',30,"timeout for bootstraping new connections")
config.addOption('BOOTSTRAP_CONTACT_REPEAT',10,"the number of times the agent will attempt to establish the first contact with the master")
config.addOption('PULL_REQUEST_DELAY',0.2,"delay in seconds between updating the result to the master and pulling new task")
config.addOption('APPLICATION_SHELL','','Shell for running the application. If left empty then the application package is imported directly into the WorkerAgent process. Otherwise, a separate process is started with the specified shell (e.g. "sh"). That process is called a servlet (and implemented by WorkerServlet module) and the application package is imported there.')


# constants
miliseconds = 1000

import omniORB
from omniORB import CORBA
import DIANE_CORBA 
import time
import os
import sys
import streamer

from diane.application import create_application_proxy

import diane.application

from diane.BaseThread import BaseThread
class HeartbeatThread(BaseThread):
    """ Periodically ping given peer (master or directory service).
    """