def test_fsInfo(self): self.assertEqual(('?', '?.?.?.?'), JobManager.mountPoint('/no/such/path/')) for mnt_point in ('/project/res', '/prog/ecl'): (file_server, ip) = JobManager.mountPoint(mnt_point) self.assert_ip_address(ip) (file_server, isilon_addr), _ = JobManager.fsInfo(path=mnt_point) self.assertEqual(ip, isilon_addr)
def checkFileServerBlackList(job_manager): fs_info, usage = JobManager.fsInfo() file_server = fs_info[0] if file_server in FILE_SERVER_BLACKLIST: msg = """************************************************************************ You are now running a forward model simulation in a runpath directory: which is served from the file server: %s This file server is not suitable for large scale FMU usage. Please use a different RUNPATH setting in your ert configuration file. Please contact Ketil Nummedal if you do not understand how to proceed. ************************************************************************ """ % job_manager.file_server payload = { "user": job_manager.user, "ert_job": "FILE_SERVER_CHECK", "executable": "/bin/???", "arg_list": "--", "error_msg": "Simulation started on blacklisted file_server:%s" % job_manager.file_server, "cwd": os.getcwd(), "file_server": job_manager.isilon_node, "node": job_manager.node, "fs_use": "%s / %s / %s" % job_manager.fs_use, "stderr": "???", "stdout": "???" } print json.dumps(payload) try: stat = requests.post(ERROR_URL, headers={"Content-Type": "application/json"}, data=json.dumps(payload)) print stat.text except: pass with open("WARNING-ILLEGAL-FILESERVER.txt", "w") as f: f.write(msg) if block_illegal_fileserver: illegal_fileserver_exit(msg, job_manager.user)
def test_mountpoint(self): with TestAreaContext("mount_test"): os.makedirs("path/to/test/dir") with self.assertRaises(ValueError): JobManager.fsInfo("path/to/test/dir") with self.assertRaises(ValueError): JobManager.fsInfo("/path/does/not/exist") with self.assertRaises(ValueError): JobManager.fsInfo("/scratch") (server, ip), fs_use = JobManager.fsInfo("/prog/ecl") self.assert_ip_address(ip) self.assertEqual(len(fs_use), 3) for t in fs_use: self.assertTrue(t[0].isdigit())