from slurm_utils import create_and_submit_batch_job
from datetime import datetime
import os
from pathlib import Path
import argparse

PROJECT_ROOT = Path(os.path.realpath(__file__)).parents[1]

parser = argparse.ArgumentParser()
parser.add_argument('--interactive', action='store_true')
args = parser.parse_args()

# DATA_DIR = 'uspto_full'
SCRIPT_DIR = 'scripts'
platform = 'lumi'
project = 'project_462000833'

slurm_args = {
    'job_dir': 'jobs',
    'job_ids_file': 'job_ids.txt',
    'output_dir': 'output',
    'platform': platform,
    'project': project,
    'time': '04:00:00',
    'partition': 'small',
    'nodes': 1,
    'ntasks-per-node': 1,
    'cpus-per-task': 1,
    'mem': '100G', # 50G not enough for uspto_full
    'with_containers': True,
    'container': 'multiguide-lumi.sif',
    'venv_path': 'multiguide-lumi-container',
    'start_array_job': 0, # 5 to 37
    'end_array_job': 0 #37
}

time_stamp = datetime.now().strftime("%Y%m%d_%H%M%S")
experiment_name = f'get_true_synthesis_routes_{time_stamp}'  
script_args = {"script_dir": SCRIPT_DIR,
               "use_torchrun": 'false',
               "args": {
                   "dataset": "uspto_hard"
               }}
script_args['script_name'] = 'get_true_synthesis_routes.py'
slurm_args['job_name'] = experiment_name
output = create_and_submit_batch_job(slurm_args, script_args, interactive=args.interactive)