def test_create(self): with TestAreaContext("run_context"): arg = None sim_fs = EnkfFs.createFileSystem("sim_fs", EnKFFSType.BLOCK_FS_DRIVER_ID, arg) target_fs = None mask = BoolVector(initial_size=100, default_value=True) mask[50] = False runpath_fmt = PathFormat("path/to/sim%d") subst_list = SubstitutionList() itr = 0 jobname_fmt = "job%d" run_context1 = ErtRunContext(EnkfRunType.ENSEMBLE_EXPERIMENT, sim_fs, target_fs, mask, runpath_fmt, jobname_fmt, subst_list, itr) run_id1 = run_context1.get_id() run_arg0 = run_context1[0] with self.assertRaises(ValueError): run_arg0.getQueueIndex() self.assertEqual(run_arg0.iter_id, itr) self.assertEqual(run_id1, run_arg0.get_run_id()) run_context2 = ErtRunContext(EnkfRunType.ENSEMBLE_EXPERIMENT, sim_fs, target_fs, mask, runpath_fmt, jobname_fmt, subst_list, itr) run_id2 = run_context2.get_id() self.assertFalse(run_id1 == run_id2) self.assertTrue(run_context1.is_active(49)) self.assertFalse(run_context1.is_active(50))
def test_create(self): with TestAreaContext("run_context"): arg = None sim_fs = EnkfFs.createFileSystem("sim_fs", EnKFFSType.BLOCK_FS_DRIVER_ID, arg) target_fs = None mask = BoolVector(initial_size=100, default_value=True) runpath_fmt = PathFormat("path/to/sim%d") subst_list = SubstitutionList() itr = 0 run_context1 = ErtRunContext(EnkfRunType.ENSEMBLE_EXPERIMENT, sim_fs, target_fs, mask, runpath_fmt, subst_list, itr) run_id1 = run_context1.get_id() run_arg0 = run_context1[0] self.assertEqual(run_id1, run_arg0.get_run_id()) run_context2 = ErtRunContext(EnkfRunType.ENSEMBLE_EXPERIMENT, sim_fs, target_fs, mask, runpath_fmt, subst_list, itr) run_id2 = run_context2.get_id() self.assertFalse(run_id1 == run_id2)
def test_create2(self): with TestAreaContext("create_fs2") as work_area: work_area.copy_parent_content(self.config_file) new_fs = EnkfFs.createFileSystem("newFS", EnKFFSType.BLOCK_FS_DRIVER_ID, mount=True) self.assertTrue(isinstance(new_fs, EnkfFs))
def getFileSystem(self, case_name, mount_root=None): """ @rtype: EnkfFs """ if mount_root is None: mount_root = self._mount_root full_case_name = self._createFullCaseName(mount_root, case_name) if not full_case_name in self._fs_rotator: if not EnkfFs.exists(full_case_name): if self._fs_rotator.atCapacity(): self._fs_rotator.dropOldestFileSystem() EnkfFs.createFileSystem(full_case_name) new_fs = EnkfFs(full_case_name) self._fs_rotator.addFileSystem(new_fs, full_case_name) fs = self._fs_rotator[full_case_name] return fs
def test_create(self): with TestAreaContext("create_fs") as work_area: work_area.copy_parent_content(self.config_file) self.assertTrue(EnkfFs.exists(self.mount_point)) fs = EnkfFs(self.mount_point) self.assertEqual(1, fs.refCount()) fs.umount() self.assertFalse(EnkfFs.exists("newFS")) fs = EnkfFs.createFileSystem("newFS") self.assertTrue(EnkfFs.exists("newFS")) self.assertTrue(fs is None) with self.assertRaises(IOError): version = EnkfFs.diskVersion("does/not/exist") version = EnkfFs.diskVersion("newFS") self.assertTrue(version >= 106)