Exemplo n.º 1
0
def totalAll(varConfFile, doGen = False):

    myDir = varConfFile.split("/")[0]

    lexec = Executor.Local(-multiprocessing.cpu_count())
    # lexec = Executor.Local(-10)

    N0, numGens, reps, dataDir = \
        myUtils.getVarConf(varConfFile)



    models = list(N0.keys())
    models.sort()
    for model in models:
        Ns = N0[model]
        Ns.sort()
        for N in Ns:
            #print("%s/%d%s.conf" % (myDir, N, model))
            cfg = myUtils.getConfig("%s/%d%s.conf" % (myDir, N, model))
            startGen = cfg.gens - numGens
            ageM, ageF = myUtils.getAgeFecund(cfg)
            if doGen:
                gen(model, N, ageM, ageF, reps)
            else:
                nongen(model, N, ageM, ageF, reps, startGen)
    lexec.wait(True)
Exemplo n.º 2
0
 def __init__(self, ip, def_perms=Permissions.Guest):
     # установка адреса, порта, главного сокета
     self.HOST = ip
     self.PORT = 9090
     self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self.sock.bind((self.HOST, self.PORT))
     self.sock.listen(10)
     # инициализация списков юзеров, блокировок
     self.blacklist = []
     self.users = []
     # создание потока приема новых пользователей
     self.th = threading.Thread(target=self.acceptor)
     self.th.start()
     # создание обработчика команд
     self.executor = Executor(self)
     # установка стандартных прав при входе на сервер
     Permissions.Default = def_perms
     self.users.append(ConsoleUser(self))
Exemplo n.º 3
0
    def __init__(self):
        super(main, self).__init__()
        self.logger = logging.getLogger(self.__class__.__name__)
        self.logger.info('initializing Self-Adaptive System')

        KB = KnowledgeBase.KnowledgeBase()
        KB.loadGoalModel('car-wheel.json')

        E = Executor.Executor(KB)
        P = Planner.Planner(KB, E)
        A = Analyzer.Analyzer(KB, P)
        M = Monitor.Monitor(KB)
Exemplo n.º 4
0
 def createROMLevel(self, lvl, ie):
     ROMs = {}
     runs = self.getRunSet(lvl)
     for run, vrs in runs.iteritems():
         print '\nStarting run:', run
         chlist, ident = self.makeCase(run)
         runfile = ie.writeInput(self.unc_inp_file, chlist, ident)
         inp_file = GetPot(Filename=runfile)
         exdict = {}
         for i in range(len(run)):
             exdict[run[i]] = vrs[i]
         ex = Executor.ExecutorFactory('SC', exdict, inp_file)
         ex.run()
         os.system('rm ' + runfile)
         ROMs[ident] = ex.ROM
     return ROMs
Exemplo n.º 5
0
 def createROMs(self):
     self.ROMs = {}
     ident = self.todo.keys()[0]
     print '\nStarting run:', ident
     inp_file = GetPot(Filename=self.unc_inp_file)
     ex_type = inp_file('Problem/executor', '')
     print 'ex type:', ex_type
     ex = Executor.ExecutorFactory(ex_type, self.varDict, inp_file)
     ex.run(verbose=self.verbose)
     try:
         self.ROMs[ident] = ex.ROM
         print 'sampled mean:', ex.ROM.moment(1)
     except AttributeError:
         pass  #MC doesn't store a rom at this point
     self.ex = ex
     #xs={}
     #for key,value in self.varDict.iteritems():
     #  xs[key]=1
     #print 'sampled:',ex.ROM.sample(xs,verbose=False)
     return ex
Exemplo n.º 6
0
def script(name,
           stdInput=None,
           fileInput=DEFAULT_FILE_INFO,
           stdOutput=None,
           fileOutput=DEFAULT_FILE_INFO):
    with fileInput.exists():
        fileInput.write(fileInput.data)
        with fileOutput.exists():
            with Executor.run(name) as process:
                stdout, stderr = process.communicate(stdInput)
                assert not stderr, 'There is some errors while script {} was executing: {}'.format(
                    name, stderr)
                assert process.returncode == 0, 'Script {} finished with exit code {}'.format(
                    name, process.returncode)
                assert stdOutput is None or stdout.strip(
                ) == stdOutput, 'Script {} output does not match expected.\nExpected: {}\nGot: {}'.format(
                    name, stdOutput, stdout)
                if fileOutput != DEFAULT_FILE_INFO:
                    fileOutputData = fileOutput.read()
                    assert fileOutputData.strip(
                    ) == fileOutput.data, 'Script {} file {} output does not match expected.\nExpected: {}\nGot: {}'.format(
                        name, fileOutput.name, fileOutput.data, fileOutputData)
Exemplo n.º 7
0
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4171 + int(index)) * 10
ip = str(90 + int(index))
sshPort = str(startPort + 1)
dbPort = str(startPort + 2)
adminPort = str(startPort + 3)

#初始化实例
executor = Executor(
    'value-atlas', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22",
            dbPort: "1234",
            adminPort: "2345"
        },
        "volumeMap": {
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd, index)
Exemplo n.º 8
0
from Memory import *
from Reader import *
from Executor import *
memory = Memory()
reader = Reader(memory)
executor = Executor(memory)
memory.consolePrintMemory()
reader.launch()
executor.executor()
memory.consolePrintMemory()
Exemplo n.º 9
0
index = sys.argv[2]

#设置端口和ip
startPort = (4040 + int(index)) * 10
ip = str(120 + int(index))
sshPort = str(startPort + 1)
ftpPort = str(startPort + 2)

#初始化实例
executor = Executor(
    'value-cw', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22",
            ftpPort: "21"
        },
        "volumeMap": {
            "/home/res/eduos/cw": "/home/cw",
            "/home/res/paper": "/home/paper",
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd, index)

if cmd == 'create':
    time.sleep(5)
    os.system("ssh [email protected] -p %s 'sh /root/install.sh'" % (sshPort, ))

if cmd == 'create' or cmd == 'restart':
    time.sleep(5)
    executor.app_restart(index)
Exemplo n.º 10
0
#!/usr/bin/python
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4110 + int(index)) * 10
ip = str(160 + int(index))
sshPort = str(startPort + 1)

#初始化实例
executor = Executor(
    'value-db', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22"
        },
        "volumeMap": {
            "/home/mysql/mysql" + str(index): "/home/mysql",
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd, index)
Exemplo n.º 11
0
import time
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = 40025 + int(index)
ip = str(90 + int(index))
sshPort = str(startPort )

#初始化实例
elmExe = Executor('elm-as', {
    "ip": ip,
    "sshPort": sshPort,
    "portMap": {
        "127.0.0.1:" + sshPort: "22"
    },
    "volumeMap": {
        "/new_home/res/elm": "/home/res/elm",
	"/new_home/res/logs/elm/"+index: "/home/software/apache-tomcat-8.0.3/logs",
        "~/authorized_keys": "/root/.ssh/authorized_keys"
    }
})
elmExe.execute(cmd, index)
#如果是新增或重启容器,则还要重启应用
if cmd == 'create' or cmd == 'restart':
    time.sleep(5)
    elmExe.app_restart(index)
Exemplo n.º 12
0
#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4071 + int(index)) * 10
ip = str(50 + int(index))
sshPort = str(startPort + 1)

#初始化实例
circleExe = Executor(
    'circle-as', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22"
        },
        "volumeMap": {
            "/home/res/circle": "/home/res/circle",
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
circleExe.execute(cmd, index)
circleIp = circleExe.get_ip()
#如果是新增或重启容器,则还要重启应用
if cmd == 'create' or cmd == 'restart':
    time.sleep(5)
    circleExe.app_restart(index)
if cmd == 'create':
    slb = Slb(1)
    slb.slb_add_ip(circleIp, "circle")
if cmd == 'remove':
Exemplo n.º 13
0
#!/usr/bin/python
#coding:utf-8
import sys
import time
from Executor import *

#获取参数
cmd = sys.argv[1]

#初始化实例
executor = Executor(
    'jenkins', {
        "ip": "3",
        "sshPort": "40001",
        "portMap": {
            "127.0.0.1:40001:22",
        },
        "volumeMap": {
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd)
if cmd == 'restart':
    time.sleep(2)
    executor.app_restart("0")
Exemplo n.º 14
0
#!/usr/bin/python
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]

#设置端口和ip
ip = 2
sshPort = "40011"

#初始化实例
executor = Executor('value-dnsmasq', {
    "ip": ip,
})
print(executor.get_ip())
Exemplo n.º 15
0
from Slb import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4080 + int(index)) * 10
ip = str(170 + int(index))
sshPort = str(startPort + 1)
tomcatPort = str(startPort + 2)

#初始化实例
executor = Executor(
    'value-solr', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22",
            "127.0.0.1:" + tomcatPort: "8080"
        },
        "volumeMap": {
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd, index)
#如果是新增或重启容器,则还要重启应用
if cmd == 'create' or cmd == 'restart':
    time.sleep(5)
    executor.app_restart(index)
Exemplo n.º 16
0
#设置端口和ip
startPort = (4141 + int(index)) * 10
ip = str(60 + int(index))
sshPort = str(startPort + 1)
serverPort = str(startPort + 2)
debugPort = str(startPort + 3)

if cmd == 'create':
    hostIp = os.environ.get('HOST_IP')
    os.system("mkdir -p /home/res/eduos/fsc/" + index)
    os.system("echo " + hostIp + ":" + serverPort + " > /home/res/eduos/fsc/" +
              index + "/ip.txt")

executor = Executor(
    'eduos-fsc', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22",
            serverPort: "10081",
            debugPort: "9999"
        },
        "volumeMap": {
            "~/authorized_keys": "/root/.ssh/authorized_keys",
            "/home/res/eduos/fsc/app": "/home/fsc",
            "/home/res/eduos/fsc/" + index + "/ip.txt": "/root/ip.txt",
        }
    })
executor.execute(cmd, index)
Exemplo n.º 17
0
def main(args):
    grammar = Executor(GlobalGrammar(args[0]))
    grammar.apply_to_inputs(args[1])
Exemplo n.º 18
0
class Server:
    alreadyBanned = ServerError("IP already banned!")
    notBanned = ServerError("IP has not banned!")
    userNotFound = ServerError("User with nick not found!")

    def __init__(self, ip, def_perms=Permissions.Guest):
        # установка адреса, порта, главного сокета
        self.HOST = ip
        self.PORT = 9090
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.sock.bind((self.HOST, self.PORT))
        self.sock.listen(10)
        # инициализация списков юзеров, блокировок
        self.blacklist = []
        self.users = []
        # создание потока приема новых пользователей
        self.th = threading.Thread(target=self.acceptor)
        self.th.start()
        # создание обработчика команд
        self.executor = Executor(self)
        # установка стандартных прав при входе на сервер
        Permissions.Default = def_perms
        self.users.append(ConsoleUser(self))

    def acceptor(self):
        # метод приема новых юзеров (в отдельном потоке)
        while True:
            conn, addr = self.sock.accept()
            u = User(addr[0], conn, self)
            try:
                if u.ip not in self.blacklist:
                    u.accept_success()  # если все ок, добавляем пользователя
                else:
                    u.accept_canceled(User.youBannedMessage
                                      )  # если забанен, то отменяем вход
            except ServerError as se:
                print("Error:", se.get_text())

    def resend(self, message):
        # ретрансляция сообщений всем юзерам
        for u in self.users:
            try:
                u.send(message)
            except ServerError as se:
                print("Error:", se.get_text())

    def manager(self, message, owner):
        # распределние приходящей информации на команды или сообщения юзера
        if len(message.get_message()) == 0:
            return
        if message.get_message()[0] == "/":
            name = message.text[1:].split()[0]
            args = message.text[1:].split()[1:]
            self.executor.execute(name, args,
                                  owner)  # отправка в обработчик команд
        else:
            # формирование нормального вида сообщения пользователя и отправка остальным
            message = UserMessage(message.get_message(), owner.nick)
            self.resend(message)

    def get_user_by_nick(self, nick):
        # получение объекта юзера по нику
        for u in self.users:
            if u.nick == nick:
                return u
        raise Server.userNotFound

    def ban(self, ip):
        # блокировка ip адреса
        if ip in self.blacklist:
            raise Server.alreadyBanned
        self.blacklist.append(ip)

    def unban(self, ip):
        # разблокировка ip адреса
        if ip not in self.blacklist:
            raise Server.notBanned
        self.blacklist.remove(ip)
    if Percept == 'PomdpSimViewVector':
        from Robot import Recognizers_POMDP_Antie_Periph_Sim as RecognizerModule
        Recognizer = RecognizerModule.PomdpAntiePeriphSimRecognizer
    elif Percept == 'PomdpSimSmallScaleStar':
        from Robot import Recognizers_HSSH as RecognizerModule
        Recognizer = RecognizerModule.HsshRecognizer
        for option in ('FaceDistance', 'FaceUntil', 'FacePast'):
            setattr(Options, option, False)
    RecognizerModule.Options = Options

    logger.shutdownLogger()
    logger.initLogger('Follower-' + str(Orientation),
                      26,
                      Ablate == [],
                      LogDir='MarcoLogs')
    executor = Executor.InstructionQueueExecutor()

    parser = ParseDirections.getDirParser(Directors, Maps, collectStats=False)

    class wrapper(object):
        def __init__(self, liveFn, cannedFn=''):
            self.cannedFn = cannedFn
            self.liveFn = liveFn

        def __call__(self, input, id):
            if id.startswith('INPUT') or CrossValidate:
                return self.liveFn(input), None, ''
            else:
                return self.cannedFn(input, id)

    if CrossValidate:
Exemplo n.º 20
0
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4020 + int(index)) * 10
ip = str(100 + int(index))
sshPort = str(startPort + 1)
memPort = str(startPort + 2)
twPort = str(startPort + 3)

#初始化实例
executor = Executor(
    'value-cs', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22",
            memPort: "11211",
            twPort: "22122"
        },
        "volumeMap": {
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd, index)
Exemplo n.º 21
0
 def createROMs(self):
     print ''
     print 'Beginning HDMR term calculations...'
     self.ROMs = {}
     ie = InputEditor.HDMR_IO()
     #reference run
     chlist, ident = self.makeCase({})
     runfile = ie.writeInput(self.unc_inp_file, chlist, ident)
     inp_file = GetPot(Filename=runfile)
     ex = Executor.ExecutorFactory('SC', {}, inp_file)
     ex.run(verbose=False)
     os.system('rm ' + runfile)
     self.ROMs[ident] = ex.ROM
     # rest of runs
     numruns = {}
     for i in range(1, self.hdmr_level + 1):
         nr = 0
         print '\n===================================='
         print '    STARTING %i-INPUT INTERACTIONS' % i
         print '====================================\n'
         new = self.createROMLevel(i, ie)
         for key, value in new.iteritems():
             nr += 1
             self.ROMs[key] = value
         print '\nnumber of order %i runs: %i' % (i, nr)
         numruns[i] = nr
     xs = {}
     for key, value in self.varDict.iteritems():
         xs[key] = 1
     #for key,value in self.ROMs.iteritems():
     #  print 'mean',key,':',value.moment(1)
     print '\nROMs per level:'
     for key, value in numruns.iteritems():
         print ' ', key, value
     #for rom in self.ROMs.values():
     #  pk.dump(rom.serializable(),file('hdmr_'+rom.case()+'.pk','w'))
     self.HDMR_ROM = ROM.HDMR_ROM(self.ROMs, self.varDict)
     print 'Total Det. Runs:', self.HDMR_ROM.numRunsToCreate()
     print 'HDMR sampled', self.HDMR_ROM.sample(xs, self.hdmr_level)[1]
     #store output
     case = 'hdmr'
     case += '_' + self.input_file('Sampler/SC/indexSet', '')
     case += '_N' + str(len(self.varDict))
     case += '_H' + str(self.hdmr_level)
     #case+= '_L'+self.input_file('Sampler/SC/expOrd','')
     mean = self.HDMR_ROM.moment(self.hdmr_level, r=1, verbose=False)
     if self.input_file('HDMR/anova', 0) > 0:
         secm, contribs = self.HDMR_ROM.moment(self.hdmr_level,
                                               r=2,
                                               anova=True)
         anovaFileName = case + '.anova'
         anovaFile = file(anovaFileName, 'w')
         anovaFile.writelines('Variables,Contribution,Percent\n')
         for i, j in contribs.iteritems():
             name = '-'.join(i.split('_')[1:])
             value = str(j**2 / secm)
             anovaFile.writelines(name + ',' + str(j**2) + ',' + value +
                                  '\n')
         anovaFile.close()
         print 'ANOVA analysis written to', anovaFileName
     else:
         secm = self.HDMR_ROM.moment(self.hdmr_level, r=2, verbose=False)
     outFile = file(case + '.out', 'a')
     outFile.writelines('\nRuns,SC Level,Mean\n')
     outFile.writelines(str(self.HDMR_ROM.numRunsToCreate()) + ',')
     outFile.writelines(self.input_file('Sampler/SC/expOrd', '') + ',')
     outFile.writelines('%1.15e,%1.15e \n' % (mean, secm - mean * mean))
     outFile.close()
Exemplo n.º 22
0
index = sys.argv[2]

#设置端口和ip
startPort = 41060 + 2*int(index)-1
ip = str(70 + int(index))
sshPort = str(startPort)
ftpPort = str(startPort + 1)

#初始化实例
executor = Executor('value-cw', {
    "ip": ip,
    "sshPort": sshPort,
    "portMap": {
        "127.0.0.1:" + sshPort: "22",
        ftpPort: "21"
    },
    "volumeMap": {
        "/new_home/res/eduos/cw": "/home/cw",
        "/new_home/res/paper": "/home/paper",
	"/new_home/res/logs/cw/"+index: "/home/logs",
        "~/authorized_keys": "/root/.ssh/authorized_keys"
    }
})
executor.execute(cmd, index)

if cmd == 'create':
    time.sleep(3)
    os.system("ssh [email protected] -p %s 'sh /root/install.sh'" % (sshPort,))

if cmd == 'create' or cmd == 'restart':
    time.sleep(3)
    executor.app_restart(index)
Exemplo n.º 23
0
#!/usr/bin/python
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4150 + int(index)) * 10
ip = str(70 + int(index))
sshPort = str(startPort + 1)
redisPort = str(startPort + 2)

#初始化实例
executor = Executor(
    'value-redis', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22",
            redisPort: "6379"
        },
        "volumeMap": {
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd, index)
Exemplo n.º 24
0
#!/usr/bin/python
#coding:utf-8
import sys
from Executor import *

cmd = sys.argv[1]
index = sys.argv[2]
startPort = (4051 + int(index)) * 10
ip = str(10 + int(index))
sshPort = str(startPort + 1)
nginxPort = str(startPort + 2)

#初始化实例
executor = Executor('value-slb', {
    "ip": ip,
    "sshPort": sshPort,
    "portMap": {
        "127.0.0.1:" + sshPort: "22",
        "127.0.0.1:" + nginxPort: "80"
    },
    "volumeMap": {
        "~/authorized_keys": "/root/.ssh/authorized_keys"
    }
})
executor.execute(cmd, index)

Exemplo n.º 25
0
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4031 + int(index)) * 10
ip = str(140 + int(index))
sshPort = str(startPort + 1)
trackerPort = str(startPort + 2)
storagePort = str(startPort + 3)

#初始化实例
executor = Executor(
    'value-fdfs', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22",
            trackerPort: "22122",
            storagePort: str(storagePort)
        },
        "volumeMap": {
            "/home/res/fdfs/fdfs" + index: "/home/fdfs",
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd, index)

#if cmd == 'create':
#    time.sleep(5)
#    os.system("ssh [email protected] -p %s 'sh /root/init.sh'" % (sshPort,))
Exemplo n.º 26
0
 def loadExec(self):
   self.ex_type = self.input_file('Problem/executor','not found')
   print 'Loading executor',self.ex_type
   self.ex=Exec.newExecutor(self.ex_type,self.input_file,self.restart)
Exemplo n.º 27
0
#!/usr/bin/python
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4110 + int(index)) * 10
ip = str(160 + int(index))
sshPort = str(startPort + 1)

#初始化实例
executor = Executor('value-db', {
    "ip": ip,
    "sshPort": sshPort,
    "portMap": {
        "127.0.0.1:" + sshPort: "22"
    },
    "volumeMap": {
        "/home/mysql/mysql"+str(index): "/home/mysql",
        "~/authorized_keys": "/root/.ssh/authorized_keys"
    }
})
executor.execute(cmd, index)
Exemplo n.º 28
0
import Apparatus
import Procedures_Toolpath
import Procedures_Alignments
import Executor
import EmbeddedHelixTPgen as TPGen
import FlexPrinterApparatus

MyApparatus = Apparatus.apparatus()
MyExecutor = Executor.executor()
MyExecutor.debug = True

materials = [{'PDMS': 'ZZ1'}, {'PDMSred': 'ZZ2'}]

FlexPrinterApparatus.Build_FlexPrinter(materials, MyApparatus)

MyApparatus['devices']['nPDMS']['descriptors'].append('PDMS')
MyApparatus['devices']['nPDMS']['trace_height'] = 0.8
MyApparatus['devices']['nPDMS']['trace_width'] = 0.8
MyApparatus['devices']['aeropump0']['descriptors'].append('PDMS')
MyApparatus['devices']['nPDMSred']['descriptors'].append('PDMSred')
MyApparatus['devices']['nPDMSred']['trace_height'] = 0.3
MyApparatus['devices']['nPDMSred']['trace_width'] = 0.4
MyApparatus['devices']['pump1']['descriptors'].append('PDMSred')
MyApparatus['devices']['gantry']['default']['speed'] = 40
MyApparatus['devices']['gantry']['nPDMS']['speed'] = 5  # Calibration is on so this is overwritten
MyApparatus['devices']['gantry']['nPDMSred']['speed'] = 7  # Calibration is on so this is overwritten
MyApparatus['devices']['aeropump0']['pumpon_time'] = 1  # Calibration is on so this is overwritten
MyApparatus['devices']['aeropump0']['mid_time'] = 1
MyApparatus['devices']['aeropump0']['pumpoff_time'] = 0
MyApparatus['devices']['aeropump0']['pumpres_time'] = 0.3
MyApparatus['devices']['aeropump0']['pressure'] = 250
Exemplo n.º 29
0
#coding:utf-8
import sys
import time
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4191 + int(index)) * 10
ip = str(150 + int(index))
sshPort = str(startPort + 1)
serverPort = str(startPort + 2)

#初始化实例
executor = Executor(
    'value-nodejs', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22",
            serverPort: "3000"
        },
        "volumeMap": {
            "/home/res/nodejs": "/home/nodejs",
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd, index)
Exemplo n.º 30
0
import time
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4091 + int(index)) * 10
ip = str(40 + int(index))
sshPort = str(startPort + 1)

#初始化实例
elmExe = Executor(
    'elm-as', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22"
        },
        "volumeMap": {
            "/home/res/elm": "/home/res/elm",
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
elmExe.execute(cmd, index)
#如果是新增或重启容器,则还要重启应用
if cmd == 'create' or cmd == 'restart':
    time.sleep(5)
    elmExe.app_restart(index)
Exemplo n.º 31
0
#!/usr/bin/python
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]

#设置端口和ip
ip = 2
sshPort = "40011"

#初始化实例
executor = Executor(
    'value-dns', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22"
        },
        "volumeMap": {
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd)
Exemplo n.º 32
0
#!/usr/bin/python
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]

#设置端口和ip
ip = 2
sshPort = "40011"

#初始化实例
executor = Executor('value-dns', {
    "ip": ip,
    "sshPort": sshPort,
    "portMap": {
        "127.0.0.1:" + sshPort: "22"
    },
    "volumeMap": {
        "~/authorized_keys": "/root/.ssh/authorized_keys"
    }
})
executor.execute(cmd)
Exemplo n.º 33
0
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4050 + int(index)) * 10
ip = str(110 + int(index))
sshPort = str(startPort + 1)
rtmpPort = str(startPort + 2)
httpPort = str(startPort + 3)

#初始化实例
executor = Executor('value-sms', {
    "ip": ip,
    "sshPort": sshPort,
    "portMap": {
        "127.0.0.1:" + sshPort: "22",
        rtmpPort: "1935",
        httpPort: "80"
    },
    "volumeMap": {
        "/home/res/sms": "/home/sms",
        "~/authorized_keys": "/root/.ssh/authorized_keys"
    }
})
executor.execute(cmd, index)
Exemplo n.º 34
0
            if (int(str(val[0]), 16) > 7):
                val = "F" * (8 - len(val)) + val
            else:
                val = "0" * (8 - len(val)) + val
        n = list(int(i, 16) for i in val)
        if (n[0] < 8):
            return (int(val, 16) % (2**(bits - 1)))
        else:
            nc = list(15 - i for i in n)
            nc[len(nc) - 1] += 1
            for i in range(len(nc) - 1, 1, -1):
                if (nc[i] == 16):
                    nc[i] = 0
                    nc[i - 1] += 1
            new_val = "".join(list(hex(i) for i in nc)).replace("0x", "")
            return -(int(new_val, 16) % (2**(bits - 1)))


class BuilderState:
    NONE = 0
    STATIC = 1
    CODE = 2


if __name__ == "__main__":
    Sim = Simulator("/Users/Seth/Desktop/MIPS Simulator/example.asm", 32)
    ex = Executor(Sim.memory.initialize(), Sim.registers)
    while (ex.can_execute()):
        Sim.registers = ex.execute()
        Sim.view()
        raw_input("")
Exemplo n.º 35
0
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4121 + int(index)) * 10
ip = str(180 + int(index))
sshPort = str(startPort + 1)
serverPort = str(startPort + 2)
httpPort = str(startPort + 3)

#初始化实例
executor = Executor(
    'value-metaq', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22",
            serverPort: serverPort,
            httpPort: "8120"
        },
        "volumeMap": {
            "~/authorized_keys": "/root/.ssh/authorized_keys"
        }
    })
executor.execute(cmd, index)
Exemplo n.º 36
0
#!/usr/bin/python
#coding:utf-8
import sys
from Executor import *

#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4161 + int(index)) * 10
ip = str(80 + int(index))
sshPort = str(startPort + 1)
ftpPort = str(startPort + 2)

#初始化实例
executor = Executor(
    'value-ftp', {
        "ip": ip,
        "sshPort": sshPort,
        "portMap": {
            "127.0.0.1:" + sshPort: "22",
            ftpPort: "21"
        },
        "volumeMap": {
            "~/authorized_keys": "/root/.ssh/authorized_keys",
            "/home/ftp/pureftp" + str(index): "/home/ftp"
        }
    })
executor.execute(cmd, index)
Exemplo n.º 37
0
#获取参数
cmd = sys.argv[1]
index = sys.argv[2]

#设置端口和ip
startPort = (4071 + int(index)) * 10
ip = str(50 + int(index))
sshPort = str(startPort + 1)

#初始化实例
circleExe = Executor('circle-as', {
    "ip": ip,
    "sshPort": sshPort,
    "portMap": {
        "127.0.0.1:" + sshPort: "22"
    },
    "volumeMap": {
        "/home/res/circle": "/home/res/circle",
        "~/authorized_keys": "/root/.ssh/authorized_keys"
    }
})
circleExe.execute(cmd, index)
circleIp = circleExe.get_ip()
#如果是新增或重启容器,则还要重启应用
if cmd == 'create' or cmd == 'restart':
    time.sleep(5)
    circleExe.app_restart(index)
if cmd == 'create':
    slb = Slb(1)
    slb.slb_add_ip(circleIp, "circle")
if cmd == 'remove':