def METHOD_NAME(job_id: int, port_offset: int, script: str, run_directory: str):
    if not os.access(script, os.X_OK):
        logging.warning('Skip test %s, not executable', script)
        return
    try:
        test_name = os.path.splitext(os.path.basename(script))[0] + '_' + str(job_id)
        logfile = f'{run_directory}/{test_name}.log' if run_directory else f'{test_name}.log'
        env = os.environ.copy()
        env['PORT_OFFSET'] = str(port_offset)
        env['TEST_NAME'] = test_name
        env['PYTHONPATH'] = os.path.dirname(os.path.abspath(__file__))
        try:
            print(f'Running {test_name}')
            with open(logfile, 'wt') as output:
                abs_script = os.path.abspath(script)
                subprocess.check_call(abs_script,
                                      stdout=output,
                                      stderr=output,
                                      stdin=subprocess.DEVNULL,
                                      cwd=run_directory,
                                      env=env)
        except subprocess.CalledProcessError:
            bash(f'cat {logfile} 1>&2')
            logging.error("Run test %s failed, please check the log file: %s", test_name, logfile)
            raise
    except Exception:
        traceback.print_exc()
        raise