import os
import sys
import argparse

parser = argparse.ArgumentParser(description='wrapper')
parser.add_argument('--job_data_root', default="/data/job_465", 
                    type=str)
args = parser.parse_args()

def run():
    print('execute prepreprocess', flush=True)
    syscommand = fr"export JOB_DATA_ROOT={args.job_data_root} &&" + \
                "bash ./preprocess_ddp_k8spod_webui.sh"

    print(fr'wrapper command {syscommand}', flush=True)
    retcode = os.WEXITSTATUS(os.system(syscommand))
    return retcode

if __name__ == "__main__":
    ret_code = run()
    if ret_code != 0:
        sys.exit(ret_code)
