Exemplo n.º 1
0
 def POST(self, cmd):
     web.header('Content-Type','application/json')
     data = web.data();
     jsonp = simplejson.loads(data)
     jsonp['cmd']=cmd
     dispatcher = Runner()
     return dispatcher.run(jsonp)
Exemplo n.º 2
0
 def POST(self, cmd):
     web.header("Content-Type", "application/json")
     data = web.data()
     jsonp = simplejson.loads(data)
     jsonp["cmd"] = cmd
     dispatcher = Runner()
     return dispatcher.run(jsonp)
Exemplo n.º 3
0
  def launch(self, zh, workLogNode, actionNode, statusNode):
    state = {}
    data = zookeeper.get(zh, actionNode, 0)
    jsonp = simplejson.loads(data[0])
    state['cmdPath'] = jsonp['cmdPath']
    state['actionPath'] = actionNode
    state['actionId'] = jsonp['actionId']
    state['host'] = self.znode
    state['status']='STARTING'
    self.update(zh, workLogNode, state)

    logger.info("Launch: "+simplejson.dumps(jsonp))
    dispatcher = Runner()
    try:
      result = dispatcher.run(jsonp)
      logger.info("Result: "+simplejson.dumps(result))
      if "exit_code" in result and result['exit_code']==0:
        state['status']='SUCCEEDED'
      else:
        state['status']='FAILED'
    except:
      logger.exception('Execution error: '+actionNode)
      state['status']='FAILED'
    self.update(zh, workLogNode, state)
    self.enqueue(zh, statusNode, state)
Exemplo n.º 4
0
  def launch(self, zh, workLogNode, actionNode, statusNode):
    state = {}
    data = zookeeper.get(zh, actionNode, 0)
    jsonp = simplejson.loads(data[0])
    state['cmdPath'] = jsonp['cmdPath']
    state['actionPath'] = actionNode
    state['actionId'] = jsonp['actionId']
    state['host'] = self.znode
    state['status']='STARTING'
    self.update(zh, workLogNode, state)

    logger.info("Launch: "+simplejson.dumps(jsonp))
    dispatcher = Runner()
    try:
      result = dispatcher.run(jsonp)
      logger.info("Result: "+simplejson.dumps(result))
      if "exit_code" in result and result['exit_code']==0:
        state['status']='SUCCEEDED'
      else:
        state['status']='FAILED'
    except:
      logger.exception('Execution error: '+actionNode)
      state['status']='FAILED'
    self.update(zh, workLogNode, state)
    self.enqueue(zh, statusNode, state)
 def objective(self, trial):
     hyper_params = self.get_hyperparameters(trial=trial)
     runner = Runner(device=self.device,
                     hyper_params=hyper_params,
                     study_name=self.study_name)
     score = runner.run()
     return score
Exemplo n.º 6
0
def main():
    while True:
        param = get_data()
        data = process_data(param)
        runner = Runner(data)
        print("Current Level: ", runner.level)
        ans = runner.run()
        send_data(ans)
Exemplo n.º 7
0
def run_code(code: str):
    lexer = Lexer()
    tokens = lexer.tokenize(code)

    parser = Parser(tokens)
    node_tree = parser.parse()

    runner = Runner(node_tree)
    return runner.run()
Exemplo n.º 8
0
def run(args=sys.argv[1:]):
	global total_res
	parser = optparse.OptionParser()
	parser.add_option("-t", "--tag",
						dest="tags",
						default=None,
						action='append',
						help='Use case tag filter,eg:-t smoke -t module1 ,it is filter case tag contain smoke or module1 and run it')

	parser.add_option("-f","--failfast",
						dest="failfast",
						default=False,
						action="store_true",
						help='When the case is executed, the exception is stopped immediately.')

	parser.add_option("-r","--rerun",
						dest="rerun",
						default=False,
						action="store_true",
						help='The last failed case to run again')

	parser.add_option("-o","--out_type",
						dest="out_type",
						default="cmd",
						type="string",
						help='Type of output result')

	options, args = parser.parse_args(args)

	if (not TestSuit.test_suit_arr) and (not TestSuit.test_suit_arr[0].test_case_arr):
		sys.exit("no test suit and case!")

	if options.tags:
		for test_case in TestSuit.get_all_case():
			if not test_case.case_dict.has_key('tags'):
				sys.exit("caseId:[{0}] test case have no tags!".format(test_case.id))

	for test_case in TestSuit.get_all_case():
		if not test_case.case_run_method:
			sys.exit("caseId:[{0}] has no test case run method!".format(test_case.id))

	runner = Runner(TestSuit.test_suit_arr, options.tags, options.failfast, options.rerun, options.out_type)
	total_res = runner.run()

	report_obj = ReportFactory.create_report(options.out_type,total_res)
	report_obj.out_put_report()
Exemplo n.º 9
0
 def GET(self, cmd, daemonName):
     data = []
     data['cmd'] = cmd
     data['daemonName'] = daemonName
     dispatcher = Runner()
     return dispatcher.run(data)
Exemplo n.º 10
0
 def GET(self, cmd, packageName):
     data = []
     data["cmd"] = cmd
     data["package"] = {"name": packageName}
     dispatcher = Runner()
     return dispatcher.run(data)
Exemplo n.º 11
0
 def GET(self, cmd, daemonName):
     data = []
     data['cmd']=cmd
     data['daemonName']=daemonName
     dispatcher = Runner()
     return dispatcher.run(data)
Exemplo n.º 12
0
 def run_player(self, port, team):
     x = Runner(self, port, team)
     x.run()
     print("shut down", team)
Exemplo n.º 13
0
import os
import sys

from Runner import Runner
from configuration_reader.ConfigurationReader import ConfigurationReader

configuration_reader = ConfigurationReader()
config_path = sys.argv[1] if len(sys.argv) > 1 else os.path.abspath(
    os.curdir) + "\initial_configurations\input.txt"
config = configuration_reader.read_configuration(config_path)
runner = Runner()
runner.run(config)
Exemplo n.º 14
0
 def GET(self, cmd, packageName):
     data = []
     data['cmd'] = cmd
     data['package'] = {"name": packageName}
     dispatcher = Runner()
     return dispatcher.run(data)