def make_volume_server_map( self, two_fofc_map_in, fofc_map_in ): """ make map for Volume server to serve :param: map_in: input map file :param: map_out: output map file :return: True if worked, False if failed """ if not self.node_path: logging.error('node path not set') return False if not self.volume_server_pack_path: logging.error("volume server executable not set") return False if not os.path.exists(self.volume_server_pack_path): logging.error( "volume server executable not found at {}".format(self.volume_server_pack_path) ) return False if os.path.exists(two_fofc_map_in) and os.path.exists(fofc_map_in): command = "{} {} xray {} {} {}".format( self.node_path, self.volume_server_pack_path, two_fofc_map_in, fofc_map_in, self.mdb_map_path ) return run_command_and_check_output_file(command=command, workdir=None, process_name='make mdb_map', output_file=self.mdb_map_path)
def test_run_command_python_command_correct_out(self): command = 'python --help' shutil.copy(self.test_2fofc_map_coeff_file, self.temp_out_map) ok = run_command_and_check_output_file(command=command, output_file=self.temp_out_map, process_name='test') self.assertTrue(ok)
def make_volume_server_map(self): if os.path.exists(self.em_map): command = "%s %s em %s %s" % (self.node_path, self.volume_server_pack_path, self.em_map, self.mdb_map_path) logging.debug(command) return run_command_and_check_output_file(command=command, process_name="make Volume server map", workdir=self.workdir, output_file=self.mdb_map_path) else: logging.error("input map file missing: %s", self.em_map) return False
def test_run_command_python_unknown_command(self): command = 'missing' ok = run_command_and_check_output_file(command=command, output_file=self.temp_out_map, process_name='test') self.assertFalse(ok)
def test_run_command_python_command_missing_out(self): command = 'python --help' ok = run_command_and_check_output_file(command=command, output_file=self.temp_out_map, process_name='test') self.assertFalse(ok)
def test_run_command_none_out(self): ok = run_command_and_check_output_file(command='test', output_file=None, process_name='test') self.assertFalse(ok)
def test_run_command_none_command(self): ok = run_command_and_check_output_file(command=None, output_file=self.temp_out_map, process_name='test') self.assertFalse(ok)