示例#1
0
	def run(self):
		if self.bConnected:
			# initialize
			explorer = None
			if self.exploration == "gridsearch":
				self.explore = GridSearcher(self.args, self.connectionExplorer)
			else:
				self.explore = Metropolis(self.args, self.connectionExplorer)
			# launch run
			self.explore.run()
		else:
			raise RuntimeError("Psx.run() cannot be executed because of invalid connections.")
示例#2
0
class Psx:

	def __init__(self, exploration=args.exploration, input_path=args.input,
				 run_type=args.runtype, path=args.path,
				 server=args.server, timeout=args.timeout):
		self.exploration = exploration
		self.args = args
		self.args.timeout = timeout
		self.args.server = server
		self.args.path = path
		self.args.runtype = run_type
		self.args.input = input_path
		# connect to server
		lstSrvHost = args.server.split(':')
		self.comm = CommPSX(lstSrvHost, args.timeout)
		# set connection and deploy communicator
		self.connectionExplorer, connectionComm = multiprocessing.Pipe()
		self.comm.connectionClient = connectionComm
		self.comm.deploy()
		# check success
		self.connectionExplorer.send({COMMAND: STATUS})
		self.bConnected = self.connectionExplorer.recv()
		# make directories
		make_dirs([path+'results', path+'results/matrices'])
		self.explore = None

	@property
	def results(self):
		return self.explore.dicSaving

	def run(self):
		if self.bConnected:
			# initialize
			explorer = None
			if self.exploration == "gridsearch":
				self.explore = GridSearcher(self.args, self.connectionExplorer)
			else:
				self.explore = Metropolis(self.args, self.connectionExplorer)
			# launch run
			self.explore.run()
		else:
			raise RuntimeError("Psx.run() cannot be executed because of invalid connections.")