コード例 #1
0
ファイル: ev_meta_mt4.py プロジェクト: simondaout/bat
def startServer(stationList, options):

    network = options.network
    mask = KeyFile.getIrisMask(None, stations=stationList)
    irisList = Basic.selectStrings(stationList, mask)
    geofonList = Basic.selectStrings(stationList, Basic.Not(mask))

    Conf = Globals.ConfigDict
    args = Server.joinClientArgs([Conf['pwd'], Conf['mail']])

    if not network or network == 'iris':
        if len(irisList) == 0:
            Logfile.add('All iris entries set')

        else:
            if not startIrisServer(irisList, args):
                return True  # aborted with ctrl c

    if not network or network == 'geofon':
        if len(irisList) == 0:
            Logfile.add('All geofon entries set')

        else:
            startGeofonServer(geofonList, args)
            return True

    if network and network != 'iris' and network != 'geofon':
        if not DataDir.isNetwork(network):
            return Logfile.error('Illegal network name <' + network + '>')

        list2 = DataTypes.selectNetwork(irisList, network)

        if len(list2) > 0:
            startIrisServer(list2, args)
            return True

        list2 = DataTypes.selectNetwork(geofonList, network)

        if len(list2) > 0:
            startGeofonServer(list2, args)
            return True

        Logfile.add('All network enties set')
    #endif

    return False  # nothing done
コード例 #2
0
def run_parallel(options, pwdDict):

    if options.station:  # Client part
        if not init(True): return False

        clt = WaveformClient(options, pwdDict)
        clt.run()
        return True

    else:  # Server part
        if not init(False): return False

        keyfileDir = os.path.join(Globals.EventDir(), options.keyfolder)

        if not Basic.checkExistsDir(keyfileDir):
            return False  # Cannot find directory

        #   Build station list
        #
        stationList = sorted(initWaitingList(options))

        if len(stationList) == 0:
            return Logfile.error('No stations found')

        #
        if not KeyFile.checkVersion(keyfileDir, fullName=stationList[0]):
            return False

        saveUrl(' ', None)  # init debug service
        network = options.network

        mask = KeyFile.getIrisMask(None, stations=stationList)
        irisList = Basic.selectStrings(stationList, mask)
        geofonList = Basic.selectStrings(stationList, Basic.Not(mask))

        if not network or network == 'iris':
            if not startIrisServer(irisList):
                return True  # aborted with ctrl c
        #endif

        if not network or network == 'geofon':
            if not startGeofonServer(geofonList):
                return True  # aborted with ctrl c
    #endif

        if network and network != 'iris' and network != 'geofon':
            if not KeyFile.isNetwork(network):
                return Logfile.error(
                    'Illegal network name <' + network + '>',
                    'Network not found in directory ' +
                    Globals.KeyfileFolder())

            list2 = DataTypes.selectNetwork(irisList,
                                            network)  # search in iris list

            if len(list2) > 0:
                startIrisServer(list2)
                return True

            list2 = DataTypes.selectNetwork(geofonList,
                                            network)  # search in geofon list

            if len(list2) > 0:
                startGeofonServer(list2)
                return True